diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..f4f124c56 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "forgerock-parent"] + path = forgerock-parent + url = https://github.com/OpenIdentityPlatform/forgerock-parent.git diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..9d542dd61 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +language: java +matrix: + include: + - os: linux + jdk: oraclejdk8 + - os: linux + jdk: openjdk8 + - os: osx + osx_image: xcode9.1 +before_install: + - date -u + - uname -a + - env | sort +branches: + only: + - master +notifications: + email: + - open-identity-platform-opendj@googlegroups.com +cache: + directories: + - $HOME/.m2 +before_install: + - mvn -q -DskipTests install -f forgerock-parent +script: + - mvn -q install diff --git a/README b/README deleted file mode 100644 index 0deff651f..000000000 --- a/README +++ /dev/null @@ -1,15 +0,0 @@ -OpenDJ Ldap SDK - -This Maven project contains the OpenDJ Ldap Software Development Kit, -All modules are 100% Java based and require Java 7. - -OpenDJ is a downstream build of the OpenDS project, with a different name -to avoid trademark issues. - -Complete documentation for this product may be found online -at http://www.forgerock.com/opendj.html. - -This product is made available under the Common Development and Distribution -License (CDDL). The complete text for this license, and for alternate licenses -of included components, may be found in the legal-notices directory. - diff --git a/README.md b/README.md new file mode 100644 index 000000000..c43375b6a --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ + + +OpenDJ SDK +========== +[![Build Status](https://travis-ci.org/OpenIdentityPlatform/OpenDJ-SDK.svg)](https://travis-ci.org/OpenIdentityPlatform/OpenDJ-SDK) + +## How-to build + +```bash +git clone --recursive https://github.com/OpenIdentityPlatform/OpenDJ-SDK.git +mvn clean install -f OpenDJ-SDK/forgerock-parent +mvn clean install -f OpenDJ-SDK +``` + +About +========== + +The **OpenDJ LDAP SDK** provides a set of modern, developer-friendly Java APIs as part of the +[OpenDJ](https://github.com/OpenIdentityPlatform/OpenDJ) product suite. +The product suite includes the client SDK alongside command-line tools and +sample code, a 100% pure Java directory server, and more. You can use **OpenDJ SDK** to create client applications +for use with any server that complies with the +[RFC 4510: LDAP - Technical Specification Road Map](http://tools.ietf.org/html/rfc4510). + +The **OpenDJ LDAP SDK** brings you easy-to-use connection management, connection pooling, load balancing, and all the +standard LDAP operations to read and write directory entries. **OpenDJ LDAP SDK** also lets you build applications with +capabilities defined in additional draft and experimental RFCs that are supported by modern LDAP servers. + +Documentation +============= + +Javadoc for this module can be found [here](http://opendj.forgerock.org/opendj-core/apidocs/index.html). Read the +[developer guide](http://opendj.forgerock.org/doc/dev-guide/index.html) for a deeper understanding of LDAP application +development, as well as a detailed overview of LDAP itself. + +Get the OpenDJ LDAP SDK +======================= + +You can start developing your LDAP applications now by obtaining the **OpenDJ LDAP SDK** using any of the following +methods: + +Maven +----- + +The following dependencies will load both the [OpenDJ Core APIs](opendj-core) and the [OpenDJ Grizzly](opendj-grizzly) +network transport. Remember to override the version according to your needs: + +```xml + + + org.forgerock.opendj + opendj-sdk-core + 4.0.0-SNAPSHOT + + + org.forgerock.opendj + opendj-sdk-grizzly + 4.0.0-SNAPSHOT + + +``` + +In some use-cases, such as developing LDAP unit tests or embedded LDAP applications, the network transport is not +required, in which case you can simply declare a dependency on the OpenDJ core APIs: + +```xml + + + org.forgerock.opendj + opendj-sdk-core + 4.0.0-SNAPSHOT + + +``` + + +Getting started +=============== + +The following example shows how the **OpenDJ LDAP SDK** may be used to connect to a Directory Server, authenticate, and +then perform a search. The search results are output as LDIF to the standard output: + +```java +// Create an LDIF writer which will write the search results to stdout. +final LDIFEntryWriter writer = new LDIFEntryWriter(System.out); + +// Connect and bind to the server. +final LDAPConnectionFactory factory = new LDAPConnectionFactory(hostName, port); +final Connection connection = factory.getConnection(); +connection.bind(userName, password.toCharArray()); + +// Read the entries and output them as LDIF. +final ConnectionEntryReader reader = connection.search(baseDN, scope, filter, attributes); +while (reader.hasNext()) { + if (!reader.isReference()) { + final SearchResultEntry entry = reader.readEntry(); + writer.writeComment("Search result entry: " + entry.getName()); + writer.writeEntry(entry); + } else { + final SearchResultReference ref = reader.readReference(); + writer.writeComment("Search result reference: " + ref.getURIs()); + } +} +writer.flush(); +connection.close(); +``` + +License +======= + +**OpenDJ LDAP SDK** is licensed under [CDDL 1.0](legal-notices/CDDLv1_0.txt) (COMMON DEVELOPMENT AND DISTRIBUTION +LICENSE Version 1.0) diff --git a/forgerock-parent b/forgerock-parent new file mode 160000 index 000000000..3f8788491 --- /dev/null +++ b/forgerock-parent @@ -0,0 +1 @@ +Subproject commit 3f8788491a311667503b53b12e9cc2f4fca5559a diff --git a/opendj-cli/pom.xml b/opendj-cli/pom.xml index dac9b76c8..23c6c81a7 100644 --- a/opendj-cli/pom.xml +++ b/opendj-cli/pom.xml @@ -1,28 +1,18 @@ 4.0.0 @@ -30,9 +20,9 @@ opendj-sdk-parent org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml + 4.0.0-SNAPSHOT + opendj-cli OpenDJ CLI API This module includes CLI API for implementing CLI applications. @@ -42,12 +32,12 @@ org.forgerock.opendj - opendj-core + opendj-sdk-core org.forgerock.opendj - opendj-core + opendj-sdk-core test-jar test diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ApplicationKeyManager.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ApplicationKeyManager.java old mode 100755 new mode 100644 index 132124fc9..160870dbf --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ApplicationKeyManager.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ApplicationKeyManager.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008-2010 Sun Microsystems, Inc. - * Portions Copyright 2009 Parametric Technology Corporation (PTC) - * Portions copyright 2014 ForgeRock AS + * Copyright 2008-2010 Sun Microsystems, Inc. + * Portions Copyright 2009 Parametric Technology Corporation (PTC) + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -160,6 +150,7 @@ final class ApplicationKeyManager implements X509KeyManager { * @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) { @@ -186,6 +177,7 @@ public String chooseClientAlias(final String[] keyType, final Principal[] issuer * @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); @@ -202,6 +194,7 @@ public String chooseServerAlias(final String keyType, final Principal[] issuers, * 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); @@ -222,6 +215,7 @@ public X509Certificate[] getCertificateChain(final String 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); @@ -236,6 +230,7 @@ public String[] getClientAliases(final String keyType, final Principal[] 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); @@ -256,6 +251,7 @@ public PrivateKey getPrivateKey(final String 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); diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Argument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Argument.java index c13b12084..db3da969c 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Argument.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Argument.java @@ -1,39 +1,30 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; import static com.forgerock.opendj.cli.CliMessages.*; -import static com.forgerock.opendj.util.StaticUtils.*; import java.util.Iterator; import java.util.LinkedList; +import java.util.List; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.util.Reject; /** * This class defines a generic argument that may be used in the argument list @@ -41,110 +32,219 @@ * order to provide specific functionality. */ public abstract class Argument implements DocDescriptionSupplement { - /** Indicates whether this argument should be hidden in the usage information. */ - private boolean isHidden; - /** Indicates whether this argument may be specified more than once for multiple values. */ - private boolean isMultiValued; - /** Indicates whether this argument was provided in the set of command-line arguments. */ - private boolean isPresent; - /** Indicates whether this argument is required to have a value. */ - private boolean isRequired; - /** Indicates whether this argument requires a value. */ - private boolean needsValue; - /** The default value for the argument if none other is provided. */ - private String defaultValue; - /** The single-character identifier for this argument. */ - private final Character shortIdentifier; + /** + * An abstract base class to build a generic {@link Argument}. + * + * @param + * The concrete {@link ArgumentBuilder} subclass. + * @param + * The default value type of the {@link Argument}. + * @param + * The concrete {@link Argument} type to build. + */ + static abstract class ArgumentBuilder, T, A extends Argument> { + T defaultValue; + LocalizableMessage description; + LocalizableMessage docDescriptionSupplement; + boolean hidden; + final String longIdentifier; + boolean multiValued; + boolean needsValue = true; + boolean required; + Character shortIdentifier; + LocalizableMessage valuePlaceholder; + + ArgumentBuilder(final String longIdentifier) { + Reject.ifNull(longIdentifier, "An argument must have a long identifier"); + this.longIdentifier = longIdentifier; + } + + abstract B getThis(); + + /** + * Build the argument. + * + * @return The argument built. + * @throws ArgumentException + * If there is a problem with any of the parameters used to + * create this argument. + */ + public abstract A buildArgument() throws ArgumentException; + + /** + * Build the argument and add it to the provided {@link ArgumentParser}. + * + * @param parser + * The argument parser. + * @return The argument built. + * @throws ArgumentException + * If there is a problem with any of the parameters used to + * create this argument. + */ + public A buildAndAddToParser(final ArgumentParser parser) throws ArgumentException { + final A arg = buildArgument(); + parser.addArgument(arg); + return arg; + } + + /** + * Build the argument and add it to the provided {@link SubCommand}. + * + * @param subCommand + * The sub command. + * @return The argument built. + * @throws ArgumentException + * If there is a problem with any of the parameters used to + * create this argument. + */ + public A buildAndAddToSubCommand(final SubCommand subCommand) throws ArgumentException { + final A arg = buildArgument(); + subCommand.addArgument(arg); + return arg; + } + + /** + * Sets this argument default value. + * + * @param defaultValue + * The default value. + * @return This builder. + */ + public B defaultValue(final T defaultValue) { + this.defaultValue = defaultValue; + return getThis(); + } + + /** + * Sets this argument description. + * + * @param description + * The localized description. + * @return This builder. + */ + public B description(final LocalizableMessage description) { + this.description = description; + return getThis(); + } + + /** + * Sets a supplement to the description intended for use in generated reference documentation. + * + * @param docDescriptionSupplement + * The supplement to the description for use in generated reference documentation. + * @return This builder. + */ + public B docDescriptionSupplement(final LocalizableMessage docDescriptionSupplement) { + this.docDescriptionSupplement = docDescriptionSupplement; + return getThis(); + } + + /** + * Specifies that this argument is hidden. + * + * @return This builder. + */ + public B hidden() { + this.hidden = true; + return getThis(); + } + + /** + * Specifies that this argument may have multiple values. + * + * @return This builder. + */ + public B multiValued() { + this.multiValued = true; + return getThis(); + } + + /** + * Specifies that this argument is required. + * + * @return This builder. + */ + public B required() { + this.required = true; + return getThis(); + } + + /** + * Sets this argument single-character identifier. + * + * @param shortIdentifier + * The single-character identifier. + * @return This builder. + */ + public B shortIdentifier(final Character shortIdentifier) { + this.shortIdentifier = shortIdentifier; + return getThis(); + } + + /** + * Sets this argument value placeholder, which will be used in usage information. + * + * @param valuePlaceholder + * The localized value placeholder. + * @return This builder. + */ + public B valuePlaceholder(final LocalizableMessage valuePlaceholder) { + this.valuePlaceholder = valuePlaceholder; + return getThis(); + } + } + /** The long identifier for this argument. */ - private final String longIdentifier; + final String longIdentifier; + /** The single-character identifier for this argument. */ + private final Character shortIdentifier; /** The unique ID of the description for this argument. */ private final LocalizableMessage description; + /** Indicates whether this argument should be hidden in the usage information. */ + private final boolean isHidden; + /** Indicates whether this argument may be specified more than once for multiple values. */ + private final boolean isMultiValued; + /** Indicates whether this argument is required to have a value. */ + private final boolean isRequired; + /** Indicates whether this argument requires a value. */ + private final boolean needsValue; + /** The default value for the argument if none other is provided. */ + private final String defaultValue; + /** The value placeholder for this argument, which will be used in usage information. */ + private final LocalizableMessage valuePlaceholder; /** The set of values for this argument. */ private final LinkedList values = new LinkedList<>(); - /** The generic name that will be used to refer to this argument. */ - private final String name; - - /** The name of the property that can be used to set the default value. */ - private String propertyName; - - /** The value placeholder for this argument, which will be used in usage information. */ - private LocalizableMessage valuePlaceholder; + /** Indicates whether this argument was provided in the set of command-line arguments. */ + private boolean isPresent; /** * Indicates whether this argument was provided in the set of - * properties found is a properties file. + * properties found in a properties file. */ private boolean isValueSetByProperty; - /** - * Creates a new argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param isMultiValued - * Indicates whether this argument may be specified more than - * once to provide multiple values. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param defaultValue - * The default value that should be used for this argument if - * none is provided in a properties file or on the command line. - * This may be null if there is no generic default. - * @param propertyName - * The name of the property in a property file that may be used - * to override the default value but will be overridden by a - * command-line argument. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - protected Argument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean isMultiValued, - final boolean needsValue, final LocalizableMessage valuePlaceholder, - final String defaultValue, final String propertyName, - final LocalizableMessage description) throws ArgumentException { - this.name = name; - this.shortIdentifier = shortIdentifier; - this.longIdentifier = longIdentifier; - this.isRequired = isRequired; - this.isMultiValued = isMultiValued; - this.needsValue = needsValue; - this.valuePlaceholder = valuePlaceholder; - this.defaultValue = defaultValue; - this.propertyName = propertyName; - this.description = description; - this.isValueSetByProperty = false; - - if (shortIdentifier == null && longIdentifier == null) { - throw new ArgumentException(ERR_ARG_NO_IDENTIFIER.get(name)); - } + , T, A extends Argument> Argument(final ArgumentBuilder builder) + throws ArgumentException { + this.shortIdentifier = builder.shortIdentifier; + this.longIdentifier = builder.longIdentifier; + this.isRequired = builder.required; + this.isMultiValued = builder.multiValued; + this.needsValue = builder.needsValue; + this.valuePlaceholder = builder.valuePlaceholder; + this.defaultValue = builder.defaultValue != null ? String.valueOf(builder.defaultValue) : null; + this.description = builder.description; + this.isHidden = builder.hidden; + this.docDescriptionSupplement = builder.docDescriptionSupplement; if (needsValue && valuePlaceholder == null) { - throw new ArgumentException(ERR_ARG_NO_VALUE_PLACEHOLDER.get(name)); + throw new ArgumentException(ERR_ARG_NO_VALUE_PLACEHOLDER.get(longIdentifier)); } isPresent = false; - isHidden = false; } /** @@ -170,35 +270,6 @@ public void clearValues() { values.clear(); } - /** - * Retrieves the value of this argument as a Boolean. - * - * @return The value of this argument as a Boolean. - * @throws ArgumentException - * If this argument cannot be interpreted as a Boolean value. - */ - public boolean getBooleanValue() throws ArgumentException { - if (values.isEmpty()) { - throw new ArgumentException(ERR_ARG_NO_BOOLEAN_VALUE.get(name)); - } - - final Iterator iterator = values.iterator(); - final String valueString = toLowerCase(iterator.next()); - if (iterator.hasNext()) { - throw new ArgumentException(ERR_ARG_BOOLEAN_MULTIPLE_VALUES.get(name)); - } - - if ("true".equals(valueString) || "yes".equals(valueString) - || "on".equals(valueString) || "1".equals(valueString)) { - return true; - } else if ("false".equals(valueString) || "no".equals(valueString) - || "off".equals(valueString) || "0".equals(valueString)) { - return false; - } else { - throw new ArgumentException(ERR_ARG_CANNOT_DECODE_AS_BOOLEAN.get(valueString, name)); - } - } - /** * Retrieves the default value that will be used for this argument if it is * not specified on the command line and it is not set from a properties @@ -222,69 +293,14 @@ public LocalizableMessage getDescription() { return description != null ? description : LocalizableMessage.EMPTY; } - /** - * A supplement to the description intended for use in generated reference documentation. - */ + /** A supplement to the description intended for use in generated reference documentation. */ 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; - } - - /** - * Retrieves the value of this argument as an integer. - * - * @return The value of this argument as an integer. - * @throws ArgumentException - * If there are multiple values, or the value cannot be parsed - * as an integer. - */ - public double getDoubleValue() throws ArgumentException { - if (values.isEmpty()) { - throw new ArgumentException(ERR_ARG_NO_INT_VALUE.get(name)); - } - - final Iterator iterator = values.iterator(); - final String valueString = iterator.next(); - if (iterator.hasNext()) { - throw new ArgumentException(ERR_ARG_INT_MULTIPLE_VALUES.get(name)); - } - - try { - return Double.parseDouble(valueString); - } catch (final Exception e) { - throw new ArgumentException(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name), e); - } - } - - /** - * Retrieves the set of values for this argument as a list of integers. - * - * @return A list of the integer representations of the values for this - * argument. - * @throws ArgumentException - * If any of the values cannot be parsed as an integer. - */ - public LinkedList getDoubleValues() throws ArgumentException { - final LinkedList results = new LinkedList<>(); - for (String valueString : values) { - try { - results.add(Double.valueOf(valueString)); - } catch (final Exception e) { - throw new ArgumentException(ERR_ARG_CANNOT_DECODE_AS_DOUBLE.get(valueString, name), e); - } - } - return results; - } - /** * Retrieves the value of this argument as an integer. * @@ -295,42 +311,22 @@ public LinkedList getDoubleValues() throws ArgumentException { */ public int getIntValue() throws ArgumentException { if (values.isEmpty()) { - throw new ArgumentException(ERR_ARG_NO_INT_VALUE.get(name)); + throw new ArgumentException(ERR_ARG_NO_INT_VALUE.get(longIdentifier)); } final Iterator iterator = values.iterator(); final String valueString = iterator.next(); if (iterator.hasNext()) { - throw new ArgumentException(ERR_ARG_INT_MULTIPLE_VALUES.get(name)); + throw new ArgumentException(ERR_ARG_INT_MULTIPLE_VALUES.get(longIdentifier)); } try { return Integer.parseInt(valueString); } catch (final Exception e) { - throw new ArgumentException(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name), e); + throw new ArgumentException(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, longIdentifier), e); } } - /** - * Retrieves the set of values for this argument as a list of integers. - * - * @return A list of the integer representations of the values for this - * argument. - * @throws ArgumentException - * If any of the values cannot be parsed as an integer. - */ - public LinkedList getIntValues() throws ArgumentException { - final LinkedList results = new LinkedList<>(); - for (String valueString : values) { - try { - results.add(Integer.valueOf(valueString)); - } catch (final Exception e) { - throw new ArgumentException(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, name), e); - } - } - return results; - } - /** * Retrieves the long (multi-character) identifier that may be used to * specify the value of this argument. @@ -342,29 +338,6 @@ public String getLongIdentifier() { return longIdentifier; } - /** - * Retrieves the generic name that will be used to refer to this argument. - * - * @return The generic name that will be used to refer to this argument. - */ - public String getName() { - return name; - } - - /** - * Retrieves the name of a property in a properties file that may be used to - * set the default value for this argument if it is present. A value read - * from a properties file will override the default value returned from the - * getDefaultValue, but the properties file value will be - * overridden by a value supplied on the command line. - * - * @return The name of a property in a properties file that may be used to - * set the default value for this argument if it is present. - */ - public String getPropertyName() { - return propertyName; - } - /** * Retrieves the single-character identifier that may be used to specify the * value of this argument. @@ -404,7 +377,7 @@ public LocalizableMessage getValuePlaceholder() { * * @return The set of string values for this argument. */ - public LinkedList getValues() { + public List getValues() { return values; } @@ -486,57 +459,6 @@ public boolean needsValue() { return needsValue; } - /** - * Specifies the default value that will be used for this argument if it is - * not specified on the command line and it is not set from a properties - * file. - * - * @param defaultValue - * The default value that will be used for this argument if it is - * not specified on the command line and it is not set from a - * properties file. - */ - public void setDefaultValue(final String defaultValue) { - this.defaultValue = defaultValue; - } - - /** - * Specifies whether this argument should be hidden from the usage - * information. - * - * @param isHidden - * Indicates whether this argument should be hidden from the - * usage information. - */ - public void setHidden(final boolean isHidden) { - this.isHidden = isHidden; - } - - /** - * Specifies whether this argument may be provided more than once on the - * command line to specify multiple values. - * - * @param isMultiValued - * Indicates whether this argument may be provided more than once - * on the command line to specify multiple values. - */ - public void setMultiValued(final boolean isMultiValued) { - this.isMultiValued = isMultiValued; - } - - /** - * Specifies whether a value must be provided with this argument if it is - * present. If this is changed from false to true, - * then a value placeholder must also be provided. - * - * @param needsValue - * Indicates whether a value must be provided with this argument - * if it is present. - */ - public void setNeedsValue(final boolean needsValue) { - this.needsValue = needsValue; - } - /** * Specifies whether this argument is present in the parsed set of * command-line arguments. @@ -549,52 +471,8 @@ public void setPresent(final boolean isPresent) { this.isPresent = isPresent; } - /** - * Specifies the name of a property in a properties file that may be used to - * set the default value for this argument if it is present. - * - * @param propertyName - * The name of a property in a properties file that may be used - * to set the default value for this argument if it is present. - */ - public void setPropertyName(final String propertyName) { - this.propertyName = propertyName; - } - - /** - * Specifies whether this argument is required to have at least one value. - * - * @param isRequired - * Indicates whether this argument is required to have at least - * one value. - */ - public void setRequired(final boolean isRequired) { - this.isRequired = isRequired; - } - - /** - * Specifies the value placeholder that will be displayed for this argument - * in the generated usage information. It may be null only if - * needsValue() returns false. - * - * @param valuePlaceholder - * The value placeholder that will be displayed for this argument - * in the generated usage information. - */ - public void setValuePlaceholder(final LocalizableMessage valuePlaceholder) { - this.valuePlaceholder = valuePlaceholder; - } - - /** - * Specifies whether this argument was provided in the set of properties - * found is a properties file. - * - * @param isValueSetByProperty - * Specify whether this argument was provided in the set of - * properties found is a properties file. - */ - public void setValueSetByProperty(final boolean isValueSetByProperty) { - this.isValueSetByProperty = isValueSetByProperty; + void valueSetByProperty() { + isValueSetByProperty = true; } /** @@ -609,10 +487,8 @@ public void setValueSetByProperty(final boolean isValueSetByProperty) { * @return true if the value is acceptable, or * false if it is not. */ - public abstract boolean valueIsAcceptable(String valueString, - LocalizableMessageBuilder invalidReason); + public abstract boolean valueIsAcceptable(String valueString, LocalizableMessageBuilder invalidReason); - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder sb = new StringBuilder(); @@ -633,4 +509,14 @@ public String toString() { sb.append(")"); return sb.toString(); } + + @Override + public boolean equals(final Object arg) { + return this == arg || (arg instanceof Argument && ((Argument) arg).longIdentifier.equals(this.longIdentifier)); + } + + @Override + public int hashCode() { + return longIdentifier.hashCode(); + } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java index 4a700c212..049c7cccc 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentConstants.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -227,30 +217,10 @@ public final class ArgumentConstants { /** The value for the long option version. */ public static final String OPTION_LONG_PRODUCT_VERSION = "version"; - /** The value for the short option groupName attributes. */ - public static final char OPTION_SHORT_GROUPNAME = 'g'; - /** The value for the long option groupName attribute. */ - public static final String OPTION_LONG_GROUPNAME = "groupName"; - - /** The value for the short option newGroupName attribute. */ - public static final char OPTION_SHORT_NEWGROUPNAME = 'n'; - /** The value for the long option groupName attribute. */ - public static final String OPTION_LONG_NEWGROUPNAME = "newGroupName"; - - /** The value for the short option serverID attributes. */ - public static final String OPTION_SHORT_SERVERID = null; - /** The value for the long option serverID attribute. */ - public static final String OPTION_LONG_SERVERID = "serverID"; - - /** The value for the short option userID attributes. */ - public static final String OPTION_SHORT_USERID = null; - /** The value for the long option userID attribute. */ - public static final String OPTION_LONG_USERID = "userID"; - - /** The value for the short option set. */ - public static final Character OPTION_SHORT_SET = null; - /** The value for the long option set. */ - public static final String OPTION_LONG_SET = "set"; + /** The value for the long "checkStoppability" {@link Argument}. */ + public static final String OPTION_LONG_CHECK_STOPPABILITY = "checkStoppability"; + /** The value for the long "windowsNetStop" {@link Argument}. */ + public static final String OPTION_LONG_WINDOWS_NET_STOP = "windowsNetStop"; /** Value for the quiet option short form. */ public static final Character OPTION_SHORT_QUIET = 'Q'; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentException.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentException.java index 1b20baf91..6fbea184d 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentException.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -63,7 +53,7 @@ public ArgumentException(final LocalizableMessage message, final Throwable cause this.message = message; } - /** {@inheritDoc} */ + @Override public LocalizableMessage getMessageObject() { return this.message; } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentGroup.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentGroup.java index a66be26f9..4a61751bc 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentGroup.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentGroup.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2008 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -60,7 +50,6 @@ public ArgumentGroup(final LocalizableMessage description, final int priority) { this.priority = priority; } - /** {@inheritDoc} */ @Override public int compareTo(final ArgumentGroup o) { // Groups with higher priority numbers appear before @@ -102,7 +91,7 @@ public boolean addArgument(final Argument arg) { * @return boolean where true means this group contains members */ boolean containsArguments() { - return this.args.size() > 0; + return !args.isEmpty(); } /** @@ -158,7 +147,6 @@ void setDescription(final LocalizableMessage description) { this.description = description; } - /** {@inheritDoc} */ @Override public String toString() { return getClass().getSimpleName() + "(description=" + description + ")"; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java index 0e4fdf842..96e570d2d 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -38,10 +28,12 @@ import java.io.PrintStream; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.Date; import java.util.Enumeration; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -54,7 +46,6 @@ import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.i18n.slf4j.LocalizedLogger; -import org.forgerock.util.Utils; /** * This class defines a utility that can be used to deal with command-line @@ -69,6 +60,15 @@ public class ArgumentParser implements ToolRefDocContainer { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); + + private static final Set HOST_LONG_IDENTIFIERS = new HashSet<>(Arrays.asList( + OPTION_LONG_HOST, + OPTION_LONG_REFERENCED_HOST_NAME, + "host1", + "host2", + "hostSource", + "hostDestination")); + /** * The name of the OpenDJ configuration direction in the user home * directory. @@ -121,13 +121,11 @@ public String toString() { }; /** The set of arguments defined for this parser, referenced by short ID. */ - private final HashMap shortIDMap = new HashMap<>(); + private final Map shortIDMap = new HashMap<>(); /** The set of arguments defined for this parser, referenced by long ID. */ - private final HashMap longIDMap = new HashMap<>(); - /** The set of arguments defined for this parser, referenced by argument name. */ - private final HashMap argumentMap = new HashMap<>(); + private final Map longIDMap = new HashMap<>(); /** The total set of arguments defined for this parser. */ - private final LinkedList argumentList = new LinkedList<>(); + private final List argumentList = new LinkedList<>(); /** The maximum number of unnamed trailing arguments that may be provided. */ private final int maxTrailingArguments; @@ -154,9 +152,6 @@ public String toString() { /** The display name that will be used for the trailing arguments in the usage information. */ private final String trailingArgsDisplayName; - /** The raw set of command-line arguments that were provided. */ - private String[] rawArguments; - /** Set of argument groups. */ protected final Set argumentGroups = new TreeSet<>(); @@ -292,9 +287,9 @@ public void addArgument(final Argument argument) throws ArgumentException { public void addArgument(final Argument argument, ArgumentGroup group) throws ArgumentException { final Character shortID = argument.getShortIdentifier(); if (shortID != null && shortIDMap.containsKey(shortID)) { - final String conflictingName = shortIDMap.get(shortID).getName(); + final String conflictingID = shortIDMap.get(shortID).getLongIdentifier(); throw new ArgumentException( - ERR_ARGPARSER_DUPLICATE_SHORT_ID.get(argument.getName(), shortID, conflictingName)); + ERR_ARGPARSER_DUPLICATE_SHORT_ID.get(argument.getLongIdentifier(), shortID, conflictingID)); } // JNR: what is the requirement for the following code? @@ -311,16 +306,9 @@ public void addArgument(final Argument argument, ArgumentGroup group) throws Arg } } - String longID = argument.getLongIdentifier(); - if (longID != null) { - if (!longArgumentsCaseSensitive) { - longID = toLowerCase(longID); - } - if (longIDMap.containsKey(longID)) { - final String conflictingName = longIDMap.get(longID).getName(); - throw new ArgumentException(ERR_ARGPARSER_DUPLICATE_LONG_ID.get( - argument.getName(), argument.getLongIdentifier(), conflictingName)); - } + final String longID = formatLongIdentifier(argument.getLongIdentifier()); + if (longIDMap.containsKey(longID)) { + throw new ArgumentException(ERR_ARGPARSER_DUPLICATE_LONG_ID.get(argument.getLongIdentifier())); } if (shortID != null) { @@ -341,8 +329,10 @@ public void addArgument(final Argument argument, ArgumentGroup group) throws Arg } private BooleanArgument getVersionArgument(final boolean displayShortIdentifier) throws ArgumentException { - return new BooleanArgument(OPTION_LONG_PRODUCT_VERSION, displayShortIdentifier ? OPTION_SHORT_PRODUCT_VERSION - : null, OPTION_LONG_PRODUCT_VERSION, INFO_DESCRIPTION_PRODUCT_VERSION.get()); + return BooleanArgument.builder(OPTION_LONG_PRODUCT_VERSION) + .shortIdentifier(displayShortIdentifier ? OPTION_SHORT_PRODUCT_VERSION : null) + .description(INFO_DESCRIPTION_PRODUCT_VERSION.get()) + .buildArgument(); } /** @@ -407,9 +397,8 @@ Properties checkExternalProperties() throws ArgumentException { return null; } - // check if the properties file argument has been set. If not - // look for default location. - String propertiesFilePath = null; + // check if the properties file argument has been set. If not look for default location. + String propertiesFilePath; if (filePropertiesPathArgument.isPresent()) { propertiesFilePath = filePropertiesPathArgument.getValue(); } else { @@ -425,13 +414,13 @@ Properties checkExternalProperties() throws ArgumentException { } // We have a location for the properties file. - final Properties argumentProperties = new Properties(); - final String scriptName = getScriptName(); try { + final Properties argumentProperties = new Properties(); + final String scriptName = getScriptName(); final Properties p = new Properties(); - final FileInputStream fis = new FileInputStream(propertiesFilePath); - p.load(fis); - fis.close(); + try (final FileInputStream fis = new FileInputStream(propertiesFilePath)) { + p.load(fis); + } for (final Enumeration e = p.propertyNames(); e.hasMoreElements();) { final String currentPropertyName = (String) e.nextElement(); @@ -449,24 +438,12 @@ Properties checkExternalProperties() throws ArgumentException { argumentProperties.setProperty(propertyName.toLowerCase(), p .getProperty(currentPropertyName)); } + return argumentProperties; } catch (final Exception e) { final LocalizableMessage message = ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE.get(propertiesFilePath, getExceptionMessage(e)); throw new ArgumentException(message, e); } - return argumentProperties; - } - - /** - * Retrieves the argument with the specified name. - * - * @param name - * The name of the argument to retrieve. - * @return The argument with the specified name, or null if - * there is no such argument. - */ - Argument getArgument(final String name) { - return argumentMap.get(name); } /** @@ -478,19 +455,7 @@ Argument getArgument(final String name) { * null if there is no such argument. */ public Argument getArgumentForLongID(final String longID) { - return longIDMap.get(longID); - } - - /** - * Retrieves the argument with the specified short identifier. - * - * @param shortID - * The short ID for the argument to retrieve. - * @return The argument with the specified short identifier, or - * null if there is no such argument. - */ - Argument getArgumentForShortID(final Character shortID) { - return shortIDMap.get(shortID); + return longIDMap.get(formatLongIdentifier(longID)); } /** @@ -500,34 +465,10 @@ Argument getArgumentForShortID(final Character shortID) { * @return The list of all arguments that have been defined for this * argument parser. */ - public LinkedList getArgumentList() { + public List getArgumentList() { return argumentList; } - /** - * Retrieves the set of arguments mapped by the long identifier that may be - * used to reference them. Note that arguments that do not have a long - * identifier will not be present in this list. - * - * @return The set of arguments mapped by the long identifier that may be - * used to reference them. - */ - HashMap getArgumentsByLongID() { - return longIDMap; - } - - /** - * Retrieves the set of arguments mapped by the short identifier that may be - * used to reference them. Note that arguments that do not have a short - * identifier will not be present in this list. - * - * @return The set of arguments mapped by the short identifier that may be - * used to reference them. - */ - HashMap getArgumentsByShortID() { - return shortIDMap; - } - /** * Retrieves the fully-qualified name of the Java class that should be * invoked to launch the program with which this argument parser is @@ -541,40 +482,6 @@ String getMainClassName() { return mainClassName; } - /** - * Retrieves the maximum number of unnamed trailing arguments that may be - * provided. - * - * @return The maximum number of unnamed trailing arguments that may be - * provided, or a value less than or equal to zero if no maximum - * will be enforced. - */ - int getMaxTrailingArguments() { - return maxTrailingArguments; - } - - /** - * Retrieves the minimum number of unnamed trailing arguments that must be - * provided. - * - * @return The minimum number of unnamed trailing arguments that must be - * provided, or a value less than or equal to zero if no minimum - * will be enforced. - */ - int getMinTrailingArguments() { - return minTrailingArguments; - } - - /** - * Retrieves the raw set of arguments that were provided. - * - * @return The raw set of arguments that were provided, or null - * if the argument list has not yet been parsed. - */ - String[] getRawArguments() { - return rawArguments; - } - /** * Given an argument, returns an appropriate group. Arguments may be part of * one of the special groups or the default group. @@ -620,7 +527,7 @@ public void setShortToolDescription(final LocalizableMessage shortDescription) { * A supplement to the description for this tool * intended for use in generated reference documentation. */ - private DocDescriptionSupplement docToolDescriptionSupplement; + private DocSubcommandDescriptionSupplement docToolDescriptionSupplement; @Override public LocalizableMessage getDocToolDescriptionSupplement() { @@ -640,7 +547,7 @@ public void setDocToolDescriptionSupplement(final LocalizableMessage supplement) * A supplement to the description for all subcommands of this tool, * intended for use in generated reference documentation. */ - private class DocSubcommandsDescriptionSupplement implements DocDescriptionSupplement { + private class DocSubcommandDescriptionSupplement implements DocDescriptionSupplement { /** A supplement to the description intended for use in generated reference documentation. */ private LocalizableMessage docDescriptionSupplement; @@ -649,13 +556,12 @@ public LocalizableMessage getDocDescriptionSupplement() { return docDescriptionSupplement != null ? docDescriptionSupplement : LocalizableMessage.EMPTY; } - @Override - public void setDocDescriptionSupplement(final LocalizableMessage docDescriptionSupplement) { + private void setDocDescriptionSupplement(final LocalizableMessage docDescriptionSupplement) { this.docDescriptionSupplement = docDescriptionSupplement; } } - private DocDescriptionSupplement docSubcommandsDescriptionSupplement; + private DocSubcommandDescriptionSupplement docSubcommandsDescriptionSupplement; @Override public LocalizableMessage getDocSubcommandsDescriptionSupplement() { @@ -671,11 +577,11 @@ public void setDocSubcommandsDescriptionSupplement(final LocalizableMessage supp this.docSubcommandsDescriptionSupplement.setDocDescriptionSupplement(supplement); } - private DocDescriptionSupplement constructIfNull(DocDescriptionSupplement supplement) { + private DocSubcommandDescriptionSupplement constructIfNull(DocSubcommandDescriptionSupplement supplement) { if (supplement != null) { return supplement; } - return new DocSubcommandsDescriptionSupplement(); + return new DocSubcommandDescriptionSupplement(); } /** @@ -797,15 +703,15 @@ protected String getOptionsRefSect1(String scriptName) { continue; } - // Return a generic FQDN for localhost as the default hostname - // in reference documentation. + final Map argumentMap = getArgumentMap(a); + // Return a generic FQDN for localhost as the default hostname in reference documentation. if (isHostNameArgument(a)) { - a.setDefaultValue("localhost.localdomain"); + argumentMap.put("default", REF_DEFAULT.get("localhost.localdomain")); } // Return a generic message as default backend type depends on the server distribution. - if (a.getName().equalsIgnoreCase(OPTION_LONG_BACKEND_TYPE)) { - a.setDefaultValue(REF_DEFAULT_BACKEND_TYPE.get().toString()); + if (a.getLongIdentifier().equals(OPTION_LONG_BACKEND_TYPE)) { + argumentMap.put("default", REF_DEFAULT_BACKEND_TYPE.get().toString()); } // The help argument should be added at the end. @@ -814,7 +720,7 @@ protected String getOptionsRefSect1(String scriptName) { continue; } - options.add(getArgumentMap(a)); + options.add(argumentMap); } group.put("options", options); if (!options.isEmpty()) { @@ -842,13 +748,7 @@ protected String getOptionsRefSect1(String scriptName) { * @return true if this argument is for setting a hostname. */ boolean isHostNameArgument(final Argument a) { - final String name = a.getName(); - return name.equalsIgnoreCase(OPTION_LONG_HOST) - || name.equalsIgnoreCase(OPTION_LONG_REFERENCED_HOST_NAME) - || name.equalsIgnoreCase("host1") - || name.equalsIgnoreCase("host2") - || name.equalsIgnoreCase("hostSource") - || name.equalsIgnoreCase("hostDestination"); + return HOST_LONG_IDENTIFIERS.contains(a.getLongIdentifier()); } /** @@ -1037,19 +937,7 @@ Argument getUsageArgument() { * @return true if the provided argument is the usage argument, false otherwise */ boolean isUsageArgument(final Argument a) { - return usageArgument != null && usageArgument.getName().equals(a.getName()); - } - - /** - * Retrieves a message containing usage information based on the defined - * arguments. - * - * @return A string containing usage information based on the defined - * arguments. - */ - public LocalizableMessage getUsageMessage() { - // TODO: rework getUsage(OutputStream) to work with messages framework - return LocalizableMessage.raw(getUsage()); + return usageArgument != null && usageArgument.getLongIdentifier().equals(a.getLongIdentifier()); } /** Prints the version. */ @@ -1119,10 +1007,7 @@ public void parseArguments(final String[] rawArguments) throws ArgumentException * If a problem was encountered while parsing the provided * arguments. */ - public void parseArguments(final String[] rawArguments, Properties argumentProperties) - throws ArgumentException { - this.rawArguments = rawArguments; - + public void parseArguments(final String[] rawArguments, Properties argumentProperties) throws ArgumentException { boolean inTrailingArgs = false; final int numArguments = rawArguments.length; @@ -1155,12 +1040,11 @@ public void parseArguments(final String[] rawArguments, Properties argumentPrope String argName = arg.substring(2); String argValue = null; final int equalPos = argName.indexOf('='); - if (equalPos < 0) { - // This is fine. The value is not part of the argument name token. - } else if (equalPos == 0) { + // If equalsPos < 0, this is fine. The value is not part of the argument name token. + if (equalPos == 0) { // The argument starts with "--=", which is not acceptable. throw new ArgumentException(ERR_ARGPARSER_LONG_ARG_WITHOUT_NAME.get(arg)); - } else { + } else if (equalPos > 0) { // The argument is in the form --name=value, so parse them both out. argValue = argName.substring(equalPos + 1); argName = argName.substring(0, equalPos); @@ -1168,9 +1052,7 @@ public void parseArguments(final String[] rawArguments, Properties argumentPrope // If we're not case-sensitive, then convert the name to lowercase. final String origArgName = argName; - if (!longArgumentsCaseSensitive) { - argName = toLowerCase(argName); - } + argName = formatLongIdentifier(argName); // Get the argument with the specified name. final Argument a = longIDMap.get(argName); @@ -1380,13 +1262,9 @@ public void parseArguments(final String[] rawArguments, Properties argumentPrope */ public void parseArguments(final String[] rawArguments, final String propertiesFile, final boolean requirePropertiesFile) throws ArgumentException { - this.rawArguments = rawArguments; - Properties argumentProperties = null; - FileInputStream fis = null; - try { - fis = new FileInputStream(propertiesFile); + try (final FileInputStream fis = new FileInputStream(propertiesFile)) { final Properties p = new Properties(); p.load(fis); argumentProperties = p; @@ -1396,8 +1274,6 @@ public void parseArguments(final String[] rawArguments, final String propertiesF ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE.get(propertiesFile, getExceptionMessage(e)); throw new ArgumentException(message, e); } - } finally { - Utils.closeSilently(fis); } parseArguments(rawArguments, argumentProperties); @@ -1420,16 +1296,6 @@ boolean printUsageGroupHeaders() { return groupsContainingArgs > 1; } - /** - * Sets the usage group description for the default argument group. - * - * @param description - * for the default group - */ - void setDefaultArgumentGroupDescription(final LocalizableMessage description) { - this.defaultArgGroup.setDescription(description); - } - /** * Sets the provided argument which will be used to identify the file * properties. @@ -1442,36 +1308,6 @@ public void setFilePropertiesArgument(final StringArgument argument) { filePropertiesPathArgument = argument; } - /** - * Sets the usage group description for the general argument group. - * - * @param description - * for the general group - */ - void setGeneralArgumentGroupDescription(final LocalizableMessage description) { - this.generalArgGroup.setDescription(description); - } - - /** - * Sets the usage group description for the input/output argument group. - * - * @param description - * for the input/output group - */ - void setInputOutputArgumentGroupDescription(final LocalizableMessage description) { - this.ioArgGroup.setDescription(description); - } - - /** - * Sets the usage group description for the LDAP argument group. - * - * @param description - * for the LDAP group - */ - void setLdapArgumentGroupDescription(final LocalizableMessage description) { - this.ldapArgGroup.setDescription(description); - } - /** * Sets the provided argument which will be used to identify the file * properties. @@ -1484,15 +1320,6 @@ public void setNoPropertiesFileArgument(final BooleanArgument argument) { noPropertiesFileArgument = argument; } - /** - * Sets the raw set of arguments. - * - * @param rawArguments the raw set of arguments to set - */ - void setRawArguments(String[] rawArguments) { - this.rawArguments = rawArguments; - } - /** * Sets the provided argument as one which will automatically trigger the * output of usage information if it is provided on the command line and no @@ -1739,20 +1566,18 @@ void printLineForShortLongArgument(final Argument a, final StringBuilder buffer) void normalizeArguments(final Properties argumentProperties, final List arguments) throws ArgumentException { for (final Argument a : arguments) { - if (!a.isPresent() - // See if there is a value in the properties that can be used - && argumentProperties != null && a.getPropertyName() != null) { - final String value = argumentProperties.getProperty(a.getPropertyName().toLowerCase()); + // See if there is a value in the properties that can be used + if (!a.isPresent() && argumentProperties != null) { + final String value = argumentProperties.getProperty(a.getLongIdentifier().toLowerCase()); final LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder(); if (value != null) { - boolean addValue = (a instanceof BooleanArgument) ? true - : a.valueIsAcceptable(value, invalidReason); + boolean addValue = (a instanceof BooleanArgument) || a.valueIsAcceptable(value, invalidReason); if (addValue) { a.addValue(value); if (a.needsValue()) { a.setPresent(true); } - a.setValueSetByProperty(true); + a.valueSetByProperty(); } } } @@ -1765,7 +1590,7 @@ void normalizeArguments(final Properties argumentProperties, final List longIDToArg, + final Map shortIDToArg, final List argumentList, final Argument argument) { + final String longID = formatLongIdentifier(argument.getLongIdentifier()); + if (!longIDToArg.containsKey(longID)) { + return; + } + longIDToArg.put(longID, argument); + shortIDToArg.put(argument.getShortIdentifier(), argument); + argumentList.remove(argument); + argumentList.add(argument); + for (final ArgumentGroup group : argumentGroups) { + if (group.getArguments().contains(argument)) { + group.removeArgument(argument); + group.addArgument(argument); + } + } + } + + String formatLongIdentifier(final String longIdentifier) { + return longArgumentsCaseSensitive ? longIdentifier : toLowerCase(longIdentifier); + } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/BooleanArgument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/BooleanArgument.java index e8efc580b..be5fb4323 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/BooleanArgument.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/BooleanArgument.java @@ -1,34 +1,23 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; import static com.forgerock.opendj.cli.CliMessages.ERR_BOOLEANARG_NO_VALUE_ALLOWED; -import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; /** @@ -39,32 +28,42 @@ * default value will always be "false". */ public final class BooleanArgument extends Argument { + /** - * Creates a new Boolean argument with the provided information. + * Returns a builder which can be used for incrementally constructing a new + * {@link BooleanArgument}. * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. + * The long identifier that will be used to refer to this argument. + * @return A builder to continue building the {@link BooleanArgument}. */ - public BooleanArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, false, false, false, null, String - .valueOf(false), null, description); + public static Builder builder(final String longIdentifier) { + return new Builder(longIdentifier); + } + + /** A fluent API for incrementally constructing {@link BooleanArgument}. */ + public static final class Builder extends ArgumentBuilder { + private Builder(final String longIdentifier) { + super(longIdentifier); + this.needsValue = false; + this.defaultValue = false; + } + + @Override + Builder getThis() { + return this; + } + + @Override + public BooleanArgument buildArgument() throws ArgumentException { + return new BooleanArgument(this); + } + } + + private BooleanArgument(final Builder builder) throws ArgumentException { + super(builder); } - /** {@inheritDoc} */ @Override public final void addValue(final String valueString) { if (valueString != null) { @@ -74,30 +73,16 @@ public final void addValue(final String valueString) { } } - /** {@inheritDoc} */ @Override public final void setPresent(final boolean isPresent) { addValue(String.valueOf(isPresent)); } - /** - * Indicates whether the provided value is acceptable for use in this - * argument. - * - * @param valueString - * The value for which to make the determination. - * @param invalidReason - * A buffer into which the invalid reason may be written if the - * value is not acceptable. - * @return true if the value is acceptable, or - * false if it is not. - */ @Override - public boolean valueIsAcceptable(final String valueString, - final LocalizableMessageBuilder invalidReason) { + public boolean valueIsAcceptable(final String valueString, final LocalizableMessageBuilder invalidReason) { // This argument type should never have a value, so any value // provided will be unacceptable. - invalidReason.append(ERR_BOOLEANARG_NO_VALUE_ALLOWED.get(getName())); + invalidReason.append(ERR_BOOLEANARG_NO_VALUE_ALLOWED.get(longIdentifier)); return false; } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/CliConstants.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/CliConstants.java old mode 100755 new mode 100644 index f188adad6..32be644be --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/CliConstants.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/CliConstants.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ClientException.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ClientException.java index 4848ad582..6316bba77 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ClientException.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ClientException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommandBuilder.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommandBuilder.java index b49b1f968..6f379e84c 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommandBuilder.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommandBuilder.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008-2009 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2008-2009 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -70,6 +60,11 @@ public class CommandBuilder { } } + /** Creates a {@link CommandBuilder} with {@code null} command and subcommand names. */ + public CommandBuilder() { + this(null, null); + } + /** * The constructor for the CommandBuilder. * @@ -120,6 +115,19 @@ public boolean removeArgument(final Argument argument) { return args.remove(argument); } + /** + * Removes the provided arguments from this CommandBuilder. + * Arguments which are not in this {@link CommandBuilder} will be ignored. + * + * @param arguments + * Arguments to be removed. + */ + public void removeArguments(final Argument... arguments) { + for (final Argument argument : arguments) { + removeArgument(argument); + } + } + /** * Appends the arguments of another command builder to this command builder. * @@ -141,6 +149,7 @@ public void append(final CommandBuilder builder) { * * @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); } @@ -174,7 +183,7 @@ private String toString(final boolean showObfuscated, final String lineSeparator for (final Argument arg : args) { // This CLI is always using SSL, and the argument has been removed from // the user interface - if ("useSSL".equals(arg.getName())) { + if (ArgumentConstants.OPTION_LONG_USE_SSL.equals(arg.getLongIdentifier())) { continue; } String argName; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java index ba719ece6..ce34201d1 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/CommonArguments.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -49,9 +39,11 @@ private CommonArguments() { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getShowUsage() throws ArgumentException { - return new BooleanArgument(OPTION_LONG_HELP.toLowerCase(), OPTION_SHORT_HELP, OPTION_LONG_HELP, - INFO_DESCRIPTION_SHOWUSAGE.get()); + public static BooleanArgument showUsageArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_HELP) + .shortIdentifier(OPTION_SHORT_HELP) + .description(INFO_DESCRIPTION_SHOWUSAGE.get()) + .buildArgument(); } /** @@ -61,24 +53,11 @@ public static BooleanArgument getShowUsage() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getVerbose() throws ArgumentException { - final BooleanArgument verbose = new BooleanArgument(OPTION_LONG_VERBOSE.toLowerCase(), OPTION_SHORT_VERBOSE, - OPTION_LONG_VERBOSE, INFO_DESCRIPTION_VERBOSE.get()); - verbose.setPropertyName("verbose"); - return verbose; - } - - /** - * Returns the "port" integer argument. - * - * @param defaultPort - * The default port number. - * @return The "port" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static IntegerArgument getPort(final int defaultPort) throws ArgumentException { - return getPort(defaultPort, null); + public static BooleanArgument verboseArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_VERBOSE) + .shortIdentifier(OPTION_SHORT_VERBOSE) + .description(INFO_DESCRIPTION_VERBOSE.get()) + .buildArgument(); } /** @@ -94,36 +73,15 @@ public static IntegerArgument getPort(final int defaultPort) throws ArgumentExce * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getPort(final int defaultPort, final LocalizableMessage description) + public static IntegerArgument portArgument(final int defaultPort, final LocalizableMessage description) throws ArgumentException { - return new IntegerArgument(OPTION_LONG_PORT.toLowerCase(), OPTION_SHORT_PORT, OPTION_LONG_PORT, false, false, - true, INFO_PORT_PLACEHOLDER.get(), defaultPort, OPTION_LONG_PORT, true, 1, true, 65535, - description != null ? description : INFO_DESCRIPTION_ADMIN_PORT.get()); - } - - /** - * Returns the "postreadattrs" string argument. - * - * @return The "postreadattrs" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getPostReadAttributes() throws ArgumentException { - return new StringArgument("postreadattrs", null, "postReadAttributes", false, false, true, - INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, "postReadAttributes", - INFO_DESCRIPTION_POSTREAD_ATTRS.get()); - } - - /** - * Returns the "prereadattrs" string argument. - * - * @return The "prereadattrs" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getPreReadAttributes() throws ArgumentException { - return new StringArgument("prereadattrs", null, "preReadAttributes", false, false, true, - INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, "preReadAttributes", INFO_DESCRIPTION_PREREAD_ATTRS.get()); + return IntegerArgument.builder(OPTION_LONG_PORT) + .shortIdentifier(OPTION_SHORT_PORT) + .description(description != null ? description : INFO_DESCRIPTION_ADMIN_PORT.get()) + .range(1, 65535) + .defaultValue(defaultPort) + .valuePlaceholder(INFO_PORT_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -133,9 +91,11 @@ public static StringArgument getPreReadAttributes() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getPropertiesFile() throws ArgumentException { - return new StringArgument(OPTION_LONG_PROP_FILE_PATH.toLowerCase(), null, OPTION_LONG_PROP_FILE_PATH, false, - false, true, INFO_PROP_FILE_PATH_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_PROP_FILE_PATH.get()); + public static StringArgument propertiesFileArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_PROP_FILE_PATH) + .description(INFO_DESCRIPTION_PROP_FILE_PATH.get()) + .valuePlaceholder(INFO_PROP_FILE_PATH_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -145,10 +105,12 @@ public static StringArgument getPropertiesFile() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getProxyAuthId() throws ArgumentException { - return new StringArgument("proxyauthzid", OPTION_SHORT_PROXYAUTHID, OPTION_LONG_PROXYAUTHID, false, false, - true, INFO_PROXYAUTHID_PLACEHOLDER.get(), null, OPTION_LONG_PROXYAUTHID, - INFO_DESCRIPTION_PROXYAUTHZID.get()); + public static StringArgument proxyAuthIdArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_PROXYAUTHID) + .shortIdentifier(OPTION_SHORT_PROXYAUTHID) + .description(INFO_DESCRIPTION_PROXYAUTHZID.get()) + .valuePlaceholder(INFO_PROXYAUTHID_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -158,9 +120,10 @@ public static StringArgument getProxyAuthId() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getNoPropertiesFile() throws ArgumentException { - return new BooleanArgument(OPTION_LONG_NO_PROP_FILE.toLowerCase(), null, OPTION_LONG_NO_PROP_FILE, - INFO_DESCRIPTION_NO_PROP_FILE.get()); + public static BooleanArgument noPropertiesFileArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_NO_PROP_FILE) + .description(INFO_DESCRIPTION_NO_PROP_FILE.get()) + .buildArgument(); } /** @@ -171,11 +134,11 @@ public static BooleanArgument getNoPropertiesFile() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getContinueOnError() throws ArgumentException { - final BooleanArgument continueOnError = new BooleanArgument("continueOnError", 'c', "continueOnError", - INFO_DESCRIPTION_CONTINUE_ON_ERROR.get()); - continueOnError.setPropertyName("continueOnError"); - return continueOnError; + public static BooleanArgument continueOnErrorArgument() throws ArgumentException { + return BooleanArgument.builder("continueOnError") + .shortIdentifier('c') + .description(INFO_DESCRIPTION_CONTINUE_ON_ERROR.get()) + .buildArgument(); } /** @@ -185,13 +148,14 @@ public static BooleanArgument getContinueOnError() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getControl() throws ArgumentException { - StringArgument controlStr = - new StringArgument(OPTION_LONG_CONTROL.toLowerCase(), OPTION_SHORT_CONTROL, OPTION_LONG_CONTROL, false, - true, true, INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, OPTION_LONG_CONTROL, - INFO_DESCRIPTION_CONTROLS.get()); - controlStr.setDocDescriptionSupplement(SUPPLEMENT_DESCRIPTION_CONTROLS.get()); - return controlStr; + public static StringArgument controlArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_CONTROL) + .shortIdentifier(OPTION_SHORT_CONTROL) + .description(INFO_DESCRIPTION_CONTROLS.get()) + .docDescriptionSupplement(SUPPLEMENT_DESCRIPTION_CONTROLS.get()) + .multiValued() + .valuePlaceholder(INFO_LDAP_CONTROL_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -201,24 +165,13 @@ public static StringArgument getControl() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getLdapVersion() throws ArgumentException { - return new IntegerArgument(OPTION_LONG_PROTOCOL_VERSION.toLowerCase(), OPTION_SHORT_PROTOCOL_VERSION, - OPTION_LONG_PROTOCOL_VERSION, false, false, true, INFO_PROTOCOL_VERSION_PLACEHOLDER.get(), 3, - OPTION_LONG_PROTOCOL_VERSION, INFO_DESCRIPTION_VERSION.get()); - } - - /** - * Returns the "windowsnetstop" boolean argument. - * - * @return The "windowsnetstop" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getWindowsNetStop() throws ArgumentException { - final BooleanArgument netStop = new BooleanArgument("windowsnetstop", null, "windowsNetStop", - INFO_DESCRIPTION_WINDOWS_NET_STOP.get()); - netStop.setHidden(true); - return netStop; + public static IntegerArgument ldapVersionArgument() throws ArgumentException { + return IntegerArgument.builder(OPTION_LONG_PROTOCOL_VERSION) + .shortIdentifier(OPTION_SHORT_PROTOCOL_VERSION) + .description(INFO_DESCRIPTION_VERSION.get()) + .defaultValue(3) + .valuePlaceholder(INFO_PROTOCOL_VERSION_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -228,12 +181,11 @@ public static BooleanArgument getWindowsNetStop() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getQuiet() throws ArgumentException { - final BooleanArgument quiet = new BooleanArgument(OPTION_LONG_QUIET, OPTION_SHORT_QUIET, OPTION_LONG_QUIET, - INFO_DESCRIPTION_QUIET.get()); - quiet.setPropertyName(OPTION_LONG_QUIET); - return quiet; - + public static BooleanArgument quietArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_QUIET) + .shortIdentifier(OPTION_SHORT_QUIET) + .description(INFO_DESCRIPTION_QUIET.get()) + .buildArgument(); } /** @@ -244,8 +196,11 @@ public static BooleanArgument getQuiet() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getNoOp() throws ArgumentException { - return new BooleanArgument("no-op", OPTION_SHORT_DRYRUN, OPTION_LONG_DRYRUN, INFO_DESCRIPTION_NOOP.get()); + public static BooleanArgument noOpArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_DRYRUN) + .shortIdentifier(OPTION_SHORT_DRYRUN) + .description(INFO_DESCRIPTION_NOOP.get()) + .buildArgument(); } /** @@ -256,9 +211,11 @@ public static BooleanArgument getNoOp() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getNoPrompt() throws ArgumentException { - return new BooleanArgument(OPTION_LONG_NO_PROMPT, OPTION_SHORT_NO_PROMPT, OPTION_LONG_NO_PROMPT, - INFO_DESCRIPTION_NO_PROMPT.get()); + public static BooleanArgument noPromptArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_NO_PROMPT) + .shortIdentifier(OPTION_SHORT_NO_PROMPT) + .description(INFO_DESCRIPTION_NO_PROMPT.get()) + .buildArgument(); } /** @@ -268,39 +225,10 @@ public static BooleanArgument getNoPrompt() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getAcceptLicense() throws ArgumentException { - return new BooleanArgument(OPTION_LONG_ACCEPT_LICENSE, null, OPTION_LONG_ACCEPT_LICENSE, - INFO_OPTION_ACCEPT_LICENSE.get()); - } - - /** - * Returns the "targetldif" string argument. - *
N.B : the 't' short option is also used by timelimit, - * testonly, trustmanagerproviderdn, stoptime, start(dateTime). - * - * @param description - * The description of this argument. - * @return The "targetldif" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getTargetLDIF(final LocalizableMessage description) throws ArgumentException { - return new StringArgument("targetldif", 't', "targetLDIF", true, false, true, INFO_LDIFFILE_PLACEHOLDER.get(), - null, null, description); - } - - /** - * Returns the "timelimit" boolean argument.
- * N.B : the 't' short option is also used by targetldif, testonly, trustmanagerproviderdn, stoptime, - * start(dateTime). - * - * @return The "timelimit" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static IntegerArgument getTimeLimit() throws ArgumentException { - return new IntegerArgument("timelimit", 't', "timeLimit", false, false, true, - INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null, true, 0, false, 0, INFO_DESCRIPTION_TIME_LIMIT.get()); + public static BooleanArgument acceptLicenseArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_ACCEPT_LICENSE) + .description(INFO_OPTION_ACCEPT_LICENSE.get()) + .buildArgument(); } /** @@ -310,26 +238,11 @@ public static IntegerArgument getTimeLimit() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getTrustAll() throws ArgumentException { - final BooleanArgument trustAll = new BooleanArgument(OPTION_LONG_TRUSTALL, OPTION_SHORT_TRUSTALL, - OPTION_LONG_TRUSTALL, INFO_DESCRIPTION_TRUSTALL.get()); - trustAll.setPropertyName(OPTION_LONG_TRUSTALL); - return trustAll; - } - - /** - * Returns the "trustmanagerproviderdn" string argument. - *
N.B : the 't' short option is also used by targetldif, timelimit, - * testonly, stoptime, start(dateTime) - * - * @return The "trustmanagerproviderdn" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getTrustManagerProviderDN() throws ArgumentException { - return new StringArgument("trustmanagerproviderdn", 't', "trustManagerProviderDN", false, false, true, - INFO_TRUST_MANAGER_PROVIDER_DN_PLACEHOLDER.get(), null, null, - INFO_DESCRIPTION_TRUSTMANAGER_PROVIDER_DN.get()); + public static BooleanArgument trustAllArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_TRUSTALL) + .shortIdentifier(OPTION_SHORT_TRUSTALL) + .description(INFO_DESCRIPTION_TRUSTALL.get()) + .buildArgument(); } /** @@ -339,24 +252,26 @@ public static StringArgument getTrustManagerProviderDN() throws ArgumentExceptio * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getTrustStorePath() throws ArgumentException { - return new StringArgument("trustStorePath", OPTION_SHORT_TRUSTSTOREPATH, OPTION_LONG_TRUSTSTOREPATH, false, - false, true, INFO_TRUSTSTOREPATH_PLACEHOLDER.get(), null, OPTION_LONG_TRUSTSTOREPATH, - INFO_DESCRIPTION_TRUSTSTOREPATH.get()); + public static StringArgument trustStorePathArgument() throws ArgumentException { + return trustStorePathArgument(null); } /** - * Returns the "typesOnly" boolean argument. + * Returns the "trustStorePath" string argument initialized with the provided default value. * - * @return The "typesOnly" argument. + * @param defaultValue + * The "trustStorePath" argument default value + * @return The "trustStorePath" string argument initialized with the provided default value. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getTypesOnly() throws ArgumentException { - final BooleanArgument typesOnly = new BooleanArgument("typesOnly", 'A', "typesOnly", - INFO_DESCRIPTION_TYPES_ONLY.get()); - typesOnly.setPropertyName("typesOnly"); - return typesOnly; + public static StringArgument trustStorePathArgument(final String defaultValue) throws ArgumentException { + return StringArgument.builder(OPTION_LONG_TRUSTSTOREPATH) + .shortIdentifier(OPTION_SHORT_TRUSTSTOREPATH) + .description(INFO_DESCRIPTION_TRUSTSTOREPATH.get()) + .defaultValue(defaultValue) + .valuePlaceholder(INFO_TRUSTSTOREPATH_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -366,10 +281,12 @@ public static BooleanArgument getTypesOnly() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getTrustStorePassword() throws ArgumentException { - return new StringArgument("truststorepw", OPTION_SHORT_TRUSTSTORE_PWD, OPTION_LONG_TRUSTSTORE_PWD, false, - false, true, INFO_TRUSTSTORE_PWD_PLACEHOLDER.get(), null, OPTION_LONG_TRUSTSTORE_PWD, - INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get()); + public static StringArgument trustStorePasswordArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_TRUSTSTORE_PWD) + .shortIdentifier(OPTION_SHORT_TRUSTSTORE_PWD) + .description(INFO_DESCRIPTION_TRUSTSTOREPASSWORD.get()) + .valuePlaceholder(INFO_TRUSTSTORE_PWD_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -379,41 +296,46 @@ public static StringArgument getTrustStorePassword() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static FileBasedArgument getTrustStorePasswordFile() throws ArgumentException { - return new FileBasedArgument("trustStorePasswordFile", OPTION_SHORT_TRUSTSTORE_PWD_FILE, - OPTION_LONG_TRUSTSTORE_PWD_FILE, false, false, INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get(), null, - OPTION_LONG_TRUSTSTORE_PWD_FILE, INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get()); + public static FileBasedArgument trustStorePasswordFileArgument() throws ArgumentException { + return FileBasedArgument.builder(OPTION_LONG_TRUSTSTORE_PWD_FILE) + .shortIdentifier(OPTION_SHORT_TRUSTSTORE_PWD_FILE) + .description(INFO_DESCRIPTION_TRUSTSTOREPASSWORD_FILE.get()) + .valuePlaceholder(INFO_TRUSTSTORE_PWD_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "connectTimeout" integer argument. + * Returns a "connectTimeout" hidden integer argument. * - * @return The "connectTimeout" argument. + * @return A "connectTimeout" hidden integer argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getConnectTimeOut() throws ArgumentException { - final IntegerArgument connectTimeout = new IntegerArgument(OPTION_LONG_CONNECT_TIMEOUT, null, - OPTION_LONG_CONNECT_TIMEOUT, false, false, true, INFO_TIMEOUT_PLACEHOLDER.get(), - DEFAULT_LDAP_CONNECT_TIMEOUT, null, true, 0, false, Integer.MAX_VALUE, - INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()); - connectTimeout.setPropertyName(OPTION_LONG_CONNECT_TIMEOUT); - connectTimeout.setHidden(true); - return connectTimeout; + public static IntegerArgument connectTimeOutHiddenArgument() throws ArgumentException { + return connectTimeOutArgument(true); } /** - * Returns the "cleanupservice" string argument.
- * N.B : the 'c' short option is also used by continueOnError, compress. + * Returns a "connectTimeout" integer argument. * - * @return The "cleanupservice" argument. + * @return A "connectTimeout" integer argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getCleanupService() throws ArgumentException { - return new StringArgument("cleanupservice", 'c', "cleanupService", false, false, true, - INFO_SERVICE_NAME_PLACEHOLDER.get(), null, null, - INFO_CONFIGURE_WINDOWS_SERVICE_DESCRIPTION_CLEANUP.get()); + public static IntegerArgument connectTimeOutArgument() throws ArgumentException { + return connectTimeOutArgument(false); + } + + private static IntegerArgument connectTimeOutArgument(final boolean hidden) throws ArgumentException { + final IntegerArgument.Builder builder = IntegerArgument.builder(OPTION_LONG_CONNECT_TIMEOUT) + .description(INFO_DESCRIPTION_CONNECTION_TIMEOUT.get()) + .lowerBound(0) + .defaultValue(DEFAULT_LDAP_CONNECT_TIMEOUT) + .valuePlaceholder(INFO_TIMEOUT_PLACEHOLDER.get()); + if (hidden) { + builder.hidden(); + } + return builder.buildArgument(); } /** @@ -424,25 +346,11 @@ public static StringArgument getCleanupService() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getCLI() throws ArgumentException { - final BooleanArgument cli = new BooleanArgument(OPTION_LONG_CLI.toLowerCase(), OPTION_SHORT_CLI, - OPTION_LONG_CLI, INFO_ARGUMENT_DESCRIPTION_CLI.get()); - cli.setPropertyName(OPTION_LONG_CLI); - return cli; - } - - /** - * Returns the "checkstoppability" boolean argument. - * - * @return The "checkstoppability" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getCheckStoppability() throws ArgumentException { - final BooleanArgument cs = new BooleanArgument("checkstoppability", null, "checkStoppability", - INFO_CHECK_STOPPABILITY.get()); - cs.setHidden(true); - return cs; + public static BooleanArgument cliArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_CLI) + .shortIdentifier(OPTION_SHORT_CLI) + .description(INFO_ARGUMENT_DESCRIPTION_CLI.get()) + .buildArgument(); } /** @@ -453,11 +361,14 @@ public static BooleanArgument getCheckStoppability() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getConfigFile() throws ArgumentException { - final StringArgument configFile = new StringArgument("configfile", 'f', "configFile", true, false, true, - INFO_CONFIGFILE_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_CONFIG_FILE.get()); - configFile.setHidden(true); - return configFile; + public static StringArgument configFileArgument() throws ArgumentException { + return StringArgument.builder("configFile") + .shortIdentifier('f') + .description(INFO_DESCRIPTION_CONFIG_FILE.get()) + .hidden() + .required() + .valuePlaceholder(INFO_CONFIGFILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -469,62 +380,15 @@ public static StringArgument getConfigFile() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getConfigClass(final String configFileHandlerName) throws ArgumentException { - final StringArgument configClass = new StringArgument("configclass", OPTION_SHORT_CONFIG_CLASS, - OPTION_LONG_CONFIG_CLASS, true, false, true, INFO_CONFIGCLASS_PLACEHOLDER.get(), configFileHandlerName, - null, INFO_DESCRIPTION_CONFIG_CLASS.get()); - configClass.setHidden(true); - return configClass; - } - - /** - * Returns the "backendid" string argument.
- * N.B : the 'n' short option is also used by newGroupName, no-prompt. - * - * @return The "backendid" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getBackendId() throws ArgumentException { - return new StringArgument("backendid", 'n', "backendID", false, true, true, INFO_BACKENDNAME_PLACEHOLDER.get(), - null, null, INFO_BACKUPDB_DESCRIPTION_BACKEND_ID.get()); - } - - /** - * Returns the "backupdirectory" string argument.
- * N.B : the 'd' short option is also used by sampledata, disableservice. - * - * @return The "backupdirectory" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getBackupDirectory() throws ArgumentException { - return new StringArgument("backupdirectory", 'd', "backupDirectory", true, false, true, - INFO_BACKUPDIR_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_BACKUP_DIR.get()); - } - - /** - * Returns the "backupID" string argument. - * - * @return The "backupID" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getBackupId() throws ArgumentException { - return new StringArgument("backupid", 'I', "backupID", false, false, true, - INFO_BACKUPID_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_BACKUP_ID.get()); - } - - /** - * Returns the "backupall" boolean argument.
N.B : the 'a' short option is also used by addbaseentry, - * defaultAdd. - * - * @return The "backupall" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getBackupAll() throws ArgumentException { - return new BooleanArgument("backupall", 'a', "backUpAll", INFO_DESCRIPTION_BACKUP_ALL.get()); + public static StringArgument configClassArgument(final String configFileHandlerName) throws ArgumentException { + return StringArgument.builder(OPTION_LONG_CONFIG_CLASS) + .shortIdentifier(OPTION_SHORT_CONFIG_CLASS) + .description(INFO_DESCRIPTION_CONFIG_CLASS.get()) + .hidden() + .required() + .defaultValue(configFileHandlerName) + .valuePlaceholder(INFO_CONFIGCLASS_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -534,38 +398,50 @@ public static BooleanArgument getBackupAll() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getBaseDN() throws ArgumentException { - return new StringArgument(OPTION_LONG_BASEDN.toLowerCase(), OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, false, - true, true, INFO_BASEDN_PLACEHOLDER.get(), null, OPTION_LONG_BASEDN, - INFO_ARGUMENT_DESCRIPTION_BASEDN.get()); + public static StringArgument baseDNArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_BASEDN) + .shortIdentifier(OPTION_SHORT_BASEDN) + .description(INFO_ARGUMENT_DESCRIPTION_BASEDN.get()) + .multiValued() + .valuePlaceholder(INFO_BASEDN_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "batchFilePath" string argument. + * Returns the "bindDN" string argument.
+ * N.B : the 'D' short option is also used by rootUserDN. * - * @return The "batchFilePath" argument. + * @param defaultBindDN + * The default bind DN. + * @return The "bindDN" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getBatchFilePath() throws ArgumentException { - return new StringArgument(OPTION_LONG_BATCH_FILE_PATH, OPTION_SHORT_BATCH_FILE_PATH, - OPTION_LONG_BATCH_FILE_PATH, false, false, true, INFO_BATCH_FILE_PATH_PLACEHOLDER.get(), null, null, - INFO_DESCRIPTION_BATCH_FILE_PATH.get()); + public static StringArgument bindDNArgument(final String defaultBindDN) throws ArgumentException { + return bindDNArgument(defaultBindDN, INFO_DESCRIPTION_BINDDN.get()); } + /** * Returns the "bindDN" string argument.
* N.B : the 'D' short option is also used by rootUserDN. * * @param defaultBindDN * The default bind DN. + * @param description + * The localized description to print in help messages. * @return The "bindDN" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getBindDN(final String defaultBindDN) throws ArgumentException { - return new StringArgument("bindDN", OPTION_SHORT_BINDDN, OPTION_LONG_BINDDN, false, false, true, - INFO_BINDDN_PLACEHOLDER.get(), defaultBindDN, OPTION_LONG_BINDDN, INFO_DESCRIPTION_BINDDN.get()); + public static StringArgument bindDNArgument(final String defaultBindDN, final LocalizableMessage description) + throws ArgumentException { + return StringArgument.builder(OPTION_LONG_BINDDN) + .shortIdentifier(OPTION_SHORT_BINDDN) + .description(description) + .defaultValue(defaultBindDN) + .valuePlaceholder(INFO_BINDDN_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -575,9 +451,12 @@ public static StringArgument getBindDN(final String defaultBindDN) throws Argume * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getBindPassword() throws ArgumentException { - return new StringArgument("bindPassword", OPTION_SHORT_BINDPWD, OPTION_LONG_BINDPWD, false, false, true, - INFO_BINDPWD_PLACEHOLDER.get(), null, OPTION_LONG_BINDPWD, INFO_DESCRIPTION_BINDPASSWORD.get()); + public static StringArgument bindPasswordArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_BINDPWD) + .shortIdentifier(OPTION_SHORT_BINDPWD) + .description(INFO_DESCRIPTION_BINDPASSWORD.get()) + .valuePlaceholder(INFO_BINDPWD_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -587,10 +466,12 @@ public static StringArgument getBindPassword() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static FileBasedArgument getBindPasswordFile() throws ArgumentException { - return new FileBasedArgument("bindPasswordFile", OPTION_SHORT_BINDPWD_FILE, OPTION_LONG_BINDPWD_FILE, false, - false, INFO_BINDPWD_FILE_PLACEHOLDER.get(), null, OPTION_LONG_BINDPWD_FILE, - INFO_DESCRIPTION_BINDPASSWORDFILE.get()); + public static FileBasedArgument bindPasswordFileArgument() throws ArgumentException { + return FileBasedArgument.builder(OPTION_LONG_BINDPWD_FILE) + .shortIdentifier(OPTION_SHORT_BINDPWD_FILE) + .description(INFO_DESCRIPTION_BINDPASSWORDFILE.get()) + .valuePlaceholder(INFO_BINDPWD_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -601,11 +482,11 @@ public static FileBasedArgument getBindPasswordFile() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getAddBaseEntry() throws ArgumentException { - final BooleanArgument addBaseEntryArg = new BooleanArgument("addBaseEntry".toLowerCase(), 'a', "addBaseEntry", - INFO_ARGUMENT_DESCRIPTION_ADDBASE.get()); - addBaseEntryArg.setPropertyName("addBaseEntry"); - return addBaseEntryArg; + public static BooleanArgument addBaseEntryArgument() throws ArgumentException { + return BooleanArgument.builder("addBaseEntry") + .shortIdentifier('a') + .description(INFO_ARGUMENT_DESCRIPTION_ADDBASE.get()) + .buildArgument(); } /** @@ -616,9 +497,12 @@ public static BooleanArgument getAddBaseEntry() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getRejectedImportLdif() throws ArgumentException { - return new StringArgument("rejectFile".toLowerCase(), 'R', "rejectFile", false, false, true, - INFO_REJECT_FILE_PLACEHOLDER.get(), null, "rejectFile", INFO_GENERAL_DESCRIPTION_REJECTED_FILE.get()); + public static StringArgument rejectedImportLdifArgument() throws ArgumentException { + return StringArgument.builder("rejectFile") + .shortIdentifier('R') + .description(INFO_GENERAL_DESCRIPTION_REJECTED_FILE.get()) + .valuePlaceholder(INFO_REJECT_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -629,11 +513,11 @@ public static StringArgument getRejectedImportLdif() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getRemote() throws ArgumentException { - final BooleanArgument remote = new BooleanArgument(OPTION_LONG_REMOTE.toLowerCase(), OPTION_SHORT_REMOTE, - OPTION_LONG_REMOTE, INFO_DESCRIPTION_REMOTE.get()); - remote.setPropertyName(OPTION_LONG_REMOTE); - return remote; + public static BooleanArgument remoteArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_REMOTE) + .shortIdentifier(OPTION_SHORT_REMOTE) + .description(INFO_DESCRIPTION_REMOTE.get()) + .buildArgument(); } /** @@ -643,11 +527,11 @@ public static BooleanArgument getRemote() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getReportAuthzId() throws ArgumentException { - final BooleanArgument report = new BooleanArgument(OPTION_LONG_REPORT_AUTHZ_ID.toLowerCase(), 'E', - OPTION_LONG_REPORT_AUTHZ_ID, INFO_DESCRIPTION_REPORT_AUTHZID.get()); - report.setPropertyName("reportAuthzID"); - return report; + public static BooleanArgument reportAuthzIdArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_REPORT_AUTHZ_ID) + .shortIdentifier('E') + .description(INFO_DESCRIPTION_REPORT_AUTHZID.get()) + .buildArgument(); } /** @@ -658,11 +542,11 @@ public static BooleanArgument getReportAuthzId() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getRestart() throws ArgumentException { - final BooleanArgument restart = new BooleanArgument(OPTION_LONG_RESTART.toLowerCase(), 'R', - OPTION_LONG_RESTART, INFO_DESCRIPTION_RESTART.get()); - restart.setPropertyName(OPTION_LONG_RESTART); - return restart; + public static BooleanArgument restartArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_RESTART) + .shortIdentifier('R') + .description(INFO_DESCRIPTION_RESTART.get()) + .buildArgument(); } /** @@ -672,9 +556,11 @@ public static BooleanArgument getRestart() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getSkippedImportFile() throws ArgumentException { - return new StringArgument("skipFile".toLowerCase(), null, "skipFile", false, false, true, - INFO_SKIP_FILE_PLACEHOLDER.get(), null, "skipFile", INFO_GENERAL_DESCRIPTION_SKIPPED_FILE.get()); + public static StringArgument skippedImportFileArgument() throws ArgumentException { + return StringArgument.builder("skipFile") + .description(INFO_GENERAL_DESCRIPTION_SKIPPED_FILE.get()) + .valuePlaceholder(INFO_SKIP_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -685,10 +571,14 @@ public static StringArgument getSkippedImportFile() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getSampleData() throws ArgumentException { - return new IntegerArgument("sampleData".toLowerCase(), 'd', "sampleData", false, false, true, - INFO_NUM_ENTRIES_PLACEHOLDER.get(), 0, "sampleData", true, 0, false, 0, - INFO_SETUP_DESCRIPTION_SAMPLE_DATA.get()); + public static IntegerArgument sampleDataArgument() throws ArgumentException { + return IntegerArgument.builder("sampleData") + .shortIdentifier('d') + .description(INFO_SETUP_DESCRIPTION_SAMPLE_DATA.get()) + .lowerBound(0) + .defaultValue(0) + .valuePlaceholder(INFO_NUM_ENTRIES_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -699,10 +589,13 @@ public static IntegerArgument getSampleData() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getSASL() throws ArgumentException { - return new StringArgument("sasloption", OPTION_SHORT_SASLOPTION, OPTION_LONG_SASLOPTION, false, true, true, - INFO_SASL_OPTION_PLACEHOLDER.get(), null, OPTION_LONG_SASLOPTION, - INFO_LDAP_CONN_DESCRIPTION_SASLOPTIONS.get()); + public static StringArgument saslArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_SASLOPTION) + .shortIdentifier(OPTION_SHORT_SASLOPTION) + .description(INFO_LDAP_CONN_DESCRIPTION_SASLOPTIONS.get()) + .multiValued() + .valuePlaceholder(INFO_SASL_OPTION_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -713,42 +606,14 @@ public static StringArgument getSASL() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static MultiChoiceArgument getSearchScope() throws ArgumentException { - final MultiChoiceArgument searchScope = new MultiChoiceArgument<>( - OPTION_LONG_SEARCHSCOPE, OPTION_SHORT_SEARCHSCOPE, OPTION_LONG_SEARCHSCOPE, false, true, - INFO_SEARCH_SCOPE_PLACEHOLDER.get(), SearchScope.values(), false, - INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get()); - searchScope.setPropertyName(OPTION_LONG_SEARCHSCOPE); - searchScope.setDefaultValue(SearchScope.WHOLE_SUBTREE); - return searchScope; - } - - /** - * Returns the "serverRoot" string argument.
- * N.B : the 'R' short option is also used by rejectfile, restart. - * - * @return The "serverRoot" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getServerRoot() throws ArgumentException { - final StringArgument serverRoot = new StringArgument("serverRoot", OPTION_SHORT_SERVER_ROOT, - OPTION_LONG_SERVER_ROOT, false, false, true, INFO_SERVER_ROOT_DIR_PLACEHOLDER.get(), null, null, null); - serverRoot.setHidden(true); - return serverRoot; - } - - /** - * Returns the "servicestate" boolean argument.
- * N.B : the 's' short option is also used by searchScope, sourceldif, randomSeed, script-friendly. - * - * @return The "servicestate" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getServiceState() throws ArgumentException { - return new BooleanArgument("servicestate", 's', "serviceState", - INFO_CONFIGURE_WINDOWS_SERVICE_DESCRIPTION_STATE.get()); + public static MultiChoiceArgument searchScopeArgument() throws ArgumentException { + return MultiChoiceArgument.builder(OPTION_LONG_SEARCHSCOPE) + .shortIdentifier(OPTION_SHORT_SEARCHSCOPE) + .description(INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE.get()) + .allowedValues(SearchScope.values()) + .defaultValue(SearchScope.WHOLE_SUBTREE) + .valuePlaceholder(INFO_SEARCH_SCOPE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -759,11 +624,11 @@ public static BooleanArgument getServiceState() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getScriptFriendly() throws ArgumentException { - final BooleanArgument sf = new BooleanArgument("script-friendly", OPTION_SHORT_SCRIPT_FRIENDLY, - OPTION_LONG_SCRIPT_FRIENDLY, INFO_DESCRIPTION_SCRIPT_FRIENDLY.get()); - sf.setPropertyName(OPTION_LONG_SCRIPT_FRIENDLY); - return sf; + public static BooleanArgument scriptFriendlyArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_SCRIPT_FRIENDLY) + .shortIdentifier(OPTION_SHORT_SCRIPT_FRIENDLY) + .description(INFO_DESCRIPTION_SCRIPT_FRIENDLY.get()) + .buildArgument(); } /** @@ -775,10 +640,14 @@ public static BooleanArgument getScriptFriendly() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getLDAPPort(final int defaultLdapPort) throws ArgumentException { - return new IntegerArgument("ldapPort".toLowerCase(), OPTION_SHORT_PORT, "ldapPort", false, false, true, - INFO_PORT_PLACEHOLDER.get(), defaultLdapPort, "ldapPort", true, 1, true, 65535, - INFO_ARGUMENT_DESCRIPTION_LDAPPORT.get()); + public static IntegerArgument ldapPortArgument(final int defaultLdapPort) throws ArgumentException { + return IntegerArgument.builder("ldapPort") + .shortIdentifier(OPTION_SHORT_PORT) + .description(INFO_ARGUMENT_DESCRIPTION_LDAPPORT.get()) + .range(1, 65535) + .defaultValue(defaultLdapPort) + .valuePlaceholder(INFO_PORT_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -790,10 +659,13 @@ public static IntegerArgument getLDAPPort(final int defaultLdapPort) throws Argu * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getAdminLDAPPort(final int defaultAdminPort) throws ArgumentException { - return new IntegerArgument("adminConnectorPort".toLowerCase(), null, "adminConnectorPort", false, false, true, - INFO_PORT_PLACEHOLDER.get(), defaultAdminPort, "adminConnectorPort", true, 1, true, 65535, - INFO_ARGUMENT_DESCRIPTION_ADMINCONNECTORPORT.get()); + public static IntegerArgument adminLdapPortArgument(final int defaultAdminPort) throws ArgumentException { + return IntegerArgument.builder("adminConnectorPort") + .description(INFO_ARGUMENT_DESCRIPTION_ADMINCONNECTORPORT.get()) + .range(1, 65535) + .defaultValue(defaultAdminPort) + .valuePlaceholder(INFO_PORT_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -803,24 +675,10 @@ public static IntegerArgument getAdminLDAPPort(final int defaultAdminPort) throw * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getAdvancedMode() throws ArgumentException { - final BooleanArgument advanced = new BooleanArgument(OPTION_LONG_ADVANCED, null, OPTION_LONG_ADVANCED, - INFO_DESCRIPTION_ADVANCED.get()); - advanced.setPropertyName(OPTION_LONG_ADVANCED); - return advanced; - } - - /** - * Returns the "assertionfilter" string argument. - * - * @return The "assertionfilter" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getAssertionFilter() throws ArgumentException { - return new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false, false, true, - INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, OPTION_LONG_ASSERTION_FILE, - INFO_DESCRIPTION_ASSERTION_FILTER.get()); + public static BooleanArgument advancedModeArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_ADVANCED) + .description(INFO_DESCRIPTION_ADVANCED.get()) + .buildArgument(); } /** @@ -832,39 +690,28 @@ public static StringArgument getAssertionFilter() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getJMXPort(final int defaultJMXPort) throws ArgumentException { - return new IntegerArgument("jmxPort".toLowerCase(), 'x', "jmxPort", false, false, true, - INFO_JMXPORT_PLACEHOLDER.get(), defaultJMXPort, "jmxPort", true, 1, true, 65535, - INFO_ARGUMENT_DESCRIPTION_SKIPPORT.get()); + public static IntegerArgument jmxPortArgument(final int defaultJMXPort) throws ArgumentException { + return IntegerArgument.builder("jmxPort") + .shortIdentifier('x') + .description(INFO_ARGUMENT_DESCRIPTION_SKIPPORT.get()) + .range(1, 65535) + .defaultValue(defaultJMXPort) + .valuePlaceholder(INFO_JMXPORT_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "skip port check" boolean argument. + * Returns the "skipPortCheck" boolean argument. * - * @return The "getSkipPortCheck" argument. + * @return The "skipPortCheck" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getSkipPortCheck() throws ArgumentException { - final BooleanArgument skipPortCheck = new BooleanArgument("skipPortCheck".toLowerCase(), 'S', "skipPortCheck", - INFO_ARGUMENT_DESCRIPTION_SKIPPORT.get()); - skipPortCheck.setPropertyName("skipPortCheck"); - return skipPortCheck; - } - - /** - * Returns the "sourceldif" string argument.
- * N.B : the 's' short option is also used by searchScope, servicestate, randomSeed, script-friendly. - * - * @param description - * The description of this argument. - * @return The "sourceldif" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getSourceLDIF(final LocalizableMessage description) throws ArgumentException { - return new StringArgument("sourceldif", 's', "sourceLDIF", true, false, true, INFO_LDIFFILE_PLACEHOLDER.get(), - null, null, description); + public static BooleanArgument skipPortCheckArgument() throws ArgumentException { + return BooleanArgument.builder("skipPortCheck") + .shortIdentifier('S') + .description(INFO_ARGUMENT_DESCRIPTION_SKIPPORT.get()) + .buildArgument(); } /** @@ -874,37 +721,11 @@ public static StringArgument getSourceLDIF(final LocalizableMessage description) * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getStartTLS() throws ArgumentException { - final BooleanArgument useStartTLS = new BooleanArgument("startTLS", OPTION_SHORT_START_TLS, - OPTION_LONG_START_TLS, INFO_DESCRIPTION_START_TLS.get()); - useStartTLS.setPropertyName(OPTION_LONG_START_TLS); - return useStartTLS; - } - - /** - * Returns the "stopreason" string argument.
- * N.B : the 'r' short option is also used by useSASLExternal, remote. - * - * @return The "stopreason" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getStopReason() throws ArgumentException { - return new StringArgument("stopreason", 'r', "stopReason", false, false, true, - INFO_STOP_REASON_PLACEHOLDER.get(), null, "stopReason", INFO_DESCRIPTION_STOP_REASON.get()); - } - - /** - * Returns the "stopTime" string argument.
N.B : the 't' short option is also used by targetldif, timelimit, - * testonly, trustmanagerproviderdn, start(dateTime) - * - * @return The "stopTime" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static StringArgument getStopTime() throws ArgumentException { - return new StringArgument("stoptime", 't', "stopTime", false, false, true, INFO_STOP_TIME_PLACEHOLDER.get(), - null, "stopTime", INFO_DESCRIPTION_STOP_TIME.get()); + public static BooleanArgument startTLSArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_START_TLS) + .shortIdentifier(OPTION_SHORT_START_TLS) + .description(INFO_DESCRIPTION_START_TLS.get()) + .buildArgument(); } /** @@ -915,10 +736,13 @@ public static StringArgument getStopTime() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getRootDN() throws ArgumentException { - return new StringArgument(OPTION_LONG_ROOT_USER_DN.toLowerCase(), OPTION_SHORT_ROOT_USER_DN, - OPTION_LONG_ROOT_USER_DN, false, false, true, INFO_ROOT_USER_DN_PLACEHOLDER.get(), - "cn=Directory Manager", OPTION_LONG_ROOT_USER_DN, INFO_ARGUMENT_DESCRIPTION_ROOTDN.get()); + public static StringArgument rootDNArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_ROOT_USER_DN) + .shortIdentifier(OPTION_SHORT_ROOT_USER_DN) + .description(INFO_ARGUMENT_DESCRIPTION_ROOTDN.get()) + .defaultValue("cn=Directory Manager") + .valuePlaceholder(INFO_ROOT_USER_DN_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -928,10 +752,12 @@ public static StringArgument getRootDN() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getRootDNPwd() throws ArgumentException { - return new StringArgument("rootUserPassword".toLowerCase(), OPTION_SHORT_BINDPWD, "rootUserPassword", false, - false, true, INFO_ROOT_USER_PWD_PLACEHOLDER.get(), null, "rootUserPassword", - INFO_ROOT_USER_PWD_PLACEHOLDER.get()); + public static StringArgument rootDNPwdArgument() throws ArgumentException { + return StringArgument.builder("rootUserPassword") + .shortIdentifier(OPTION_SHORT_BINDPWD) + .description(INFO_ROOT_USER_PWD_PLACEHOLDER.get()) + .valuePlaceholder(INFO_ROOT_USER_PWD_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -941,10 +767,12 @@ public static StringArgument getRootDNPwd() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static FileBasedArgument getRootDNPwdFile() throws ArgumentException { - return new FileBasedArgument("rootUserPasswordFile".toLowerCase(), OPTION_SHORT_BINDPWD_FILE, - "rootUserPasswordFile", false, false, INFO_ROOT_USER_PWD_FILE_PLACEHOLDER.get(), null, - "rootUserPasswordFile", INFO_ARGUMENT_DESCRIPTION_ROOTPWFILE.get()); + public static FileBasedArgument rootDNPwdFileArgument() throws ArgumentException { + return FileBasedArgument.builder("rootUserPasswordFile") + .shortIdentifier(OPTION_SHORT_BINDPWD_FILE) + .description(INFO_ARGUMENT_DESCRIPTION_ROOTPWFILE.get()) + .valuePlaceholder(INFO_ROOT_USER_PWD_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -954,11 +782,11 @@ public static FileBasedArgument getRootDNPwdFile() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getEnableWindowsService() throws ArgumentException { - final BooleanArgument enableWindowsServiceArg = new BooleanArgument("enableWindowsService".toLowerCase(), 'e', - "enableWindowsService", INFO_ARGUMENT_DESCRIPTION_ENABLE_WINDOWS_SERVICE.get()); - enableWindowsServiceArg.setPropertyName("enableWindowsService"); - return enableWindowsServiceArg; + public static BooleanArgument enableWindowsServiceArgument() throws ArgumentException { + return BooleanArgument.builder("enableWindowsService") + .shortIdentifier('e') + .description(INFO_ARGUMENT_DESCRIPTION_ENABLE_WINDOWS_SERVICE.get()) + .buildArgument(); } /** @@ -969,9 +797,12 @@ public static BooleanArgument getEnableWindowsService() throws ArgumentException * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getEncoding() throws ArgumentException { - return new StringArgument("encoding", 'i', "encoding", false, false, true, INFO_ENCODING_PLACEHOLDER.get(), - null, "encoding", INFO_DESCRIPTION_ENCODING.get()); + public static StringArgument encodingArgument() throws ArgumentException { + return StringArgument.builder("encoding") + .shortIdentifier('i') + .description(INFO_DESCRIPTION_ENCODING.get()) + .valuePlaceholder(INFO_ENCODING_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -981,36 +812,11 @@ public static StringArgument getEncoding() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getDoNotStart() throws ArgumentException { - final BooleanArgument doNotStartArg = new BooleanArgument("doNotStart".toLowerCase(), 'O', "doNotStart", - INFO_SETUP_DESCRIPTION_DO_NOT_START.get()); - doNotStartArg.setPropertyName("doNotStart"); - return doNotStartArg; - } - - /** - * Returns the "defaultAdd" boolean argument. - *
N.B : the 'a' short option is also used by addbaseentry, defaultAdd. - * - * @return The "defaultAdd" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getDefaultAdd() throws ArgumentException { - return new BooleanArgument("defaultAdd", 'a', "defaultAdd", INFO_MODIFY_DESCRIPTION_DEFAULT_ADD.get()); - } - - /** - * Returns the "disableservice" boolean argument.
- * N.B : the 'd' short option is also used by backupdirectory, sampledata. - * - * @return The "disableservice" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getDisableService() throws ArgumentException { - return new BooleanArgument("disableservice", 'd', "disableService", - INFO_CONFIGURE_WINDOWS_SERVICE_DESCRIPTION_DISABLE.get()); + public static BooleanArgument doNotStartArgument() throws ArgumentException { + return BooleanArgument.builder("doNotStart") + .shortIdentifier('O') + .description(INFO_SETUP_DESCRIPTION_DO_NOT_START.get()) + .buildArgument(); } /** @@ -1020,9 +826,10 @@ public static BooleanArgument getDisableService() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getDisplayEquivalentCommand() throws ArgumentException { - return new BooleanArgument(OPTION_LONG_DISPLAY_EQUIVALENT, null, OPTION_LONG_DISPLAY_EQUIVALENT, - INFO_DESCRIPTION_DISPLAY_EQUIVALENT.get()); + public static BooleanArgument displayEquivalentCommandArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_DISPLAY_EQUIVALENT) + .description(INFO_DESCRIPTION_DISPLAY_EQUIVALENT.get()) + .buildArgument(); } /** @@ -1034,11 +841,12 @@ public static BooleanArgument getDisplayEquivalentCommand() throws ArgumentExcep * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getEquivalentCommandFile(final LocalizableMessage description) + public static StringArgument equivalentCommandFileArgument(final LocalizableMessage description) throws ArgumentException { - return new StringArgument(OPTION_LONG_EQUIVALENT_COMMAND_FILE_PATH, null, - OPTION_LONG_EQUIVALENT_COMMAND_FILE_PATH, false, false, true, INFO_PATH_PLACEHOLDER.get(), null, null, - description); + return StringArgument.builder(OPTION_LONG_EQUIVALENT_COMMAND_FILE_PATH) + .description(description) + .valuePlaceholder(INFO_PATH_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1050,9 +858,12 @@ public static StringArgument getEquivalentCommandFile(final LocalizableMessage d * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getFilename(final LocalizableMessage description) throws ArgumentException { - return new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME, false, false, true, - INFO_FILE_PLACEHOLDER.get(), null, OPTION_LONG_FILENAME, description); + public static StringArgument filenameArgument(final LocalizableMessage description) throws ArgumentException { + return StringArgument.builder(OPTION_LONG_FILENAME) + .shortIdentifier(OPTION_SHORT_FILENAME) + .description(description) + .valuePlaceholder(INFO_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1062,11 +873,11 @@ public static StringArgument getFilename(final LocalizableMessage description) t * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getEnableTLS() throws ArgumentException { - final BooleanArgument enableStartTLS = new BooleanArgument("enableStartTLS".toLowerCase(), - OPTION_SHORT_START_TLS, "enableStartTLS", INFO_SETUP_DESCRIPTION_ENABLE_STARTTLS.get()); - enableStartTLS.setPropertyName("enableStartTLS"); - return enableStartTLS; + public static BooleanArgument enableTLSArgument() throws ArgumentException { + return BooleanArgument.builder("enableStartTLS") + .shortIdentifier(OPTION_SHORT_START_TLS) + .description(INFO_SETUP_DESCRIPTION_ENABLE_STARTTLS.get()) + .buildArgument(); } /** @@ -1079,10 +890,14 @@ public static BooleanArgument getEnableTLS() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static IntegerArgument getLDAPSPort(final int defaultSecurePort) throws ArgumentException { - return new IntegerArgument("ldapsPort".toLowerCase(), OPTION_SHORT_USE_SSL, "ldapsPort", false, false, true, - INFO_PORT_PLACEHOLDER.get(), defaultSecurePort, "ldapsPort", true, 1, true, 65535, - INFO_ARGUMENT_DESCRIPTION_LDAPSPORT.get()); + public static IntegerArgument ldapsPortArgument(final int defaultSecurePort) throws ArgumentException { + return IntegerArgument.builder("ldapsPort") + .shortIdentifier(OPTION_SHORT_USE_SSL) + .description(INFO_ARGUMENT_DESCRIPTION_LDAPSPORT.get()) + .range(1, 65535) + .defaultValue(defaultSecurePort) + .valuePlaceholder(INFO_PORT_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1094,9 +909,13 @@ public static IntegerArgument getLDAPSPort(final int defaultSecurePort) throws A * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getLDIFFile(final LocalizableMessage description) throws ArgumentException { - return new StringArgument(OPTION_LONG_LDIF_FILE.toLowerCase(), OPTION_SHORT_LDIF_FILE, OPTION_LONG_LDIF_FILE, - false, true, true, INFO_LDIFFILE_PLACEHOLDER.get(), null, null, description); + public static StringArgument ldifFileArgument(final LocalizableMessage description) throws ArgumentException { + return StringArgument.builder(OPTION_LONG_LDIF_FILE) + .shortIdentifier(OPTION_SHORT_LDIF_FILE) + .description(description) + .multiValued() + .valuePlaceholder(INFO_LDIFFILE_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1106,11 +925,10 @@ public static StringArgument getLDIFFile(final LocalizableMessage description) t * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getGenerateSelfSigned() throws ArgumentException { - final BooleanArgument generateSelfSigned = new BooleanArgument("generateSelfSignedCertificate".toLowerCase(), - null, "generateSelfSignedCertificate", INFO_ARGUMENT_DESCRIPTION_USE_SELF_SIGNED_CERTIFICATE.get()); - generateSelfSigned.setPropertyName("generateSelfSignedCertificate"); - return generateSelfSigned; + public static BooleanArgument generateSelfSignedArgument() throws ArgumentException { + return BooleanArgument.builder("generateSelfSignedCertificate") + .description(INFO_ARGUMENT_DESCRIPTION_USE_SELF_SIGNED_CERTIFICATE.get()) + .buildArgument(); } /** @@ -1122,8 +940,8 @@ public static BooleanArgument getGenerateSelfSigned() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getHostName(final String defaultHostName) throws ArgumentException { - return getHostName(defaultHostName, null); + public static StringArgument hostNameArgument(final String defaultHostName) throws ArgumentException { + return hostNameArgument(defaultHostName, null); } /** @@ -1137,11 +955,14 @@ public static StringArgument getHostName(final String defaultHostName) throws Ar * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getHostName(final String defaultHostName, final LocalizableMessage description) + public static StringArgument hostNameArgument(final String defaultHostName, final LocalizableMessage description) throws ArgumentException { - return new StringArgument(OPTION_LONG_HOST.toLowerCase(), OPTION_SHORT_HOST, OPTION_LONG_HOST, false, false, - true, INFO_HOST_PLACEHOLDER.get(), defaultHostName, OPTION_LONG_HOST, description != null ? description - : INFO_ARGUMENT_DESCRIPTION_HOST_NAME.get()); + return StringArgument.builder(OPTION_LONG_HOST) + .shortIdentifier(OPTION_SHORT_HOST) + .description(description != null ? description : INFO_ARGUMENT_DESCRIPTION_HOST_NAME.get()) + .defaultValue(defaultHostName) + .valuePlaceholder(INFO_HOST_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1151,11 +972,10 @@ public static StringArgument getHostName(final String defaultHostName, final Loc * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getUsePKCS11Keystore() throws ArgumentException { - final BooleanArgument usePkcs11 = new BooleanArgument("usePkcs11Keystore".toLowerCase(), null, - "usePkcs11Keystore", INFO_ARGUMENT_DESCRIPTION_USE_PKCS11.get()); - usePkcs11.setPropertyName("usePkcs11Keystore"); - return usePkcs11; + public static BooleanArgument usePKCS11KeystoreArgument() throws ArgumentException { + return BooleanArgument.builder("usePkcs11Keystore") + .description(INFO_ARGUMENT_DESCRIPTION_USE_PKCS11.get()) + .buildArgument(); } /** @@ -1165,10 +985,11 @@ public static BooleanArgument getUsePKCS11Keystore() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getUseJavaKeyStore() throws ArgumentException { - return new StringArgument("useJavaKeystore".toLowerCase(), null, "useJavaKeystore", false, false, true, - INFO_KEYSTOREPATH_PLACEHOLDER.get(), null, "useJavaKeystore", - INFO_ARGUMENT_DESCRIPTION_USE_JAVAKEYSTORE.get()); + public static StringArgument useJavaKeyStoreArgument() throws ArgumentException { + return StringArgument.builder("useJavaKeystore") + .description(INFO_ARGUMENT_DESCRIPTION_USE_JAVAKEYSTORE.get()) + .valuePlaceholder(INFO_KEYSTOREPATH_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1178,9 +999,11 @@ public static StringArgument getUseJavaKeyStore() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getUseJCEKS() throws ArgumentException { - return new StringArgument("useJCEKS".toLowerCase(), null, "useJCEKS", false, false, true, - INFO_KEYSTOREPATH_PLACEHOLDER.get(), null, "useJCEKS", INFO_ARGUMENT_DESCRIPTION_USE_JCEKS.get()); + public static StringArgument useJCEKSArgument() throws ArgumentException { + return StringArgument.builder("useJCEKS") + .description(INFO_ARGUMENT_DESCRIPTION_USE_JCEKS.get()) + .valuePlaceholder(INFO_KEYSTOREPATH_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1190,25 +1013,11 @@ public static StringArgument getUseJCEKS() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getUsePKCS12KeyStore() throws ArgumentException { - return new StringArgument("usePkcs12keyStore".toLowerCase(), null, "usePkcs12keyStore", false, false, true, - INFO_KEYSTOREPATH_PLACEHOLDER.get(), null, "usePkcs12keyStore", - INFO_ARGUMENT_DESCRIPTION_USE_PKCS12.get()); - } - - /** - * Returns the "useSASLExternal" boolean argument.
- * N.B : the 'r' short option is also used by stopreason, remote. - * - * @return The "useSASLExternal" argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to create this argument. - */ - public static BooleanArgument getUseSASLExternal() throws ArgumentException { - final BooleanArgument useSASLExternal = new BooleanArgument("useSASLExternal", 'r', "useSASLExternal", - INFO_DESCRIPTION_USE_SASL_EXTERNAL.get()); - useSASLExternal.setPropertyName("useSASLExternal"); - return useSASLExternal; + public static StringArgument usePKCS12KeyStoreArgument() throws ArgumentException { + return StringArgument.builder("usePkcs12keyStore") + .description(INFO_ARGUMENT_DESCRIPTION_USE_PKCS12.get()) + .valuePlaceholder(INFO_KEYSTOREPATH_PLACEHOLDER.get()) + .buildArgument(); } /** @@ -1219,90 +1028,111 @@ public static BooleanArgument getUseSASLExternal() throws ArgumentException { * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static BooleanArgument getUseSSL() throws ArgumentException { - final BooleanArgument useSSL = new BooleanArgument("useSSL", OPTION_SHORT_USE_SSL, OPTION_LONG_USE_SSL, - INFO_DESCRIPTION_USE_SSL.get()); - useSSL.setPropertyName(OPTION_LONG_USE_SSL); - return useSSL; + public static BooleanArgument useSSLArgument() throws ArgumentException { + return BooleanArgument.builder(OPTION_LONG_USE_SSL) + .shortIdentifier(OPTION_SHORT_USE_SSL) + .description(INFO_DESCRIPTION_USE_SSL.get()) + .buildArgument(); } /** - * Returns the "keymanagerpath" string argument. + * Returns the "key store password" string argument. * - * @return The "keymanagerpath" argument. + * @return The "keyStorePassword" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getKeyManagerPath() throws ArgumentException { - return new StringArgument("keymanagerpath", 'm', "keyManagerPath", false, false, true, - INFO_KEY_MANAGER_PATH_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_KEYMANAGER_PATH.get()); + public static StringArgument keyStorePasswordArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_KEYSTORE_PWD) + .shortIdentifier(OPTION_SHORT_KEYSTORE_PWD) + .description(INFO_ARGUMENT_DESCRIPTION_KEYSTOREPASSWORD.get()) + .valuePlaceholder(INFO_KEYSTORE_PWD_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "keymanagerproviderdn" string argument. + * Returns the "key store password file" file argument. * - * @return The "keymanagerproviderdn" argument. + * @return The "keyStorePassword" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getKeyManagerProviderDN() throws ArgumentException { - return new StringArgument("keymanagerproviderdn", 'k', "keyManagerProviderDN", false, false, true, - INFO_KEY_MANAGER_PROVIDER_DN_PLACEHOLDER.get(), null, null, - INFO_DESCRIPTION_KEYMANAGER_PROVIDER_DN.get()); + public static FileBasedArgument keyStorePasswordFileArgument() throws ArgumentException { + return FileBasedArgument.builder(OPTION_LONG_KEYSTORE_PWD_FILE) + .shortIdentifier(OPTION_SHORT_KEYSTORE_PWD_FILE) + .description(INFO_ARGUMENT_DESCRIPTION_KEYSTOREPASSWORD_FILE.get()) + .valuePlaceholder(INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "key store password" string argument. + * Returns the "keyStorePath" string argument. * - * @return The "keyStorePassword" argument. + * @return The "keyStorePath" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getKeyStorePassword() throws ArgumentException { - return new StringArgument(OPTION_LONG_KEYSTORE_PWD.toLowerCase(), OPTION_SHORT_KEYSTORE_PWD, - OPTION_LONG_KEYSTORE_PWD, false, false, true, INFO_KEYSTORE_PWD_PLACEHOLDER.get(), null, - OPTION_LONG_KEYSTORE_PWD, INFO_ARGUMENT_DESCRIPTION_KEYSTOREPASSWORD.get()); + public static StringArgument keyStorePathArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_KEYSTOREPATH) + .shortIdentifier(OPTION_SHORT_KEYSTOREPATH) + .description(INFO_DESCRIPTION_KEYSTOREPATH.get()) + .valuePlaceholder(INFO_KEYSTOREPATH_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "key store password file" file argument. + * Returns the "key store password file" string argument. * * @return The "keyStorePassword" argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static FileBasedArgument getKeyStorePasswordFile() throws ArgumentException { - return new FileBasedArgument(OPTION_LONG_KEYSTORE_PWD_FILE.toLowerCase(), OPTION_SHORT_KEYSTORE_PWD_FILE, - OPTION_LONG_KEYSTORE_PWD_FILE, false, false, INFO_KEYSTORE_PWD_FILE_PLACEHOLDER.get(), null, - OPTION_LONG_KEYSTORE_PWD_FILE, INFO_ARGUMENT_DESCRIPTION_KEYSTOREPASSWORD_FILE.get()); + public static StringArgument certNickNameArgument() throws ArgumentException { + return StringArgument.builder(OPTION_LONG_CERT_NICKNAME) + .shortIdentifier(OPTION_SHORT_CERT_NICKNAME) + .description(INFO_ARGUMENT_DESCRIPTION_CERT_NICKNAME.get()) + .multiValued() + .valuePlaceholder(INFO_NICKNAME_PLACEHOLDER.get()) + .buildArgument(); } /** - * Returns the "keyStorePath" string argument. + * Returns the "admin uid" string argument with the provided description. * - * @return The "keyStorePath" argument. + * @param description + * The argument localizable description. + * @return The "admin uid" string argument with the provided description. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getKeyStorePath() throws ArgumentException { - final StringArgument ksPath = new StringArgument("keyStorePath", OPTION_SHORT_KEYSTOREPATH, - OPTION_LONG_KEYSTOREPATH, false, false, true, INFO_KEYSTOREPATH_PLACEHOLDER.get(), null, null, - INFO_DESCRIPTION_KEYSTOREPATH.get()); - ksPath.setPropertyName(OPTION_LONG_KEYSTOREPATH); - return ksPath; + public static StringArgument adminUid(final LocalizableMessage description) throws ArgumentException { + return adminUidArgument(false, description); } /** - * Returns the "key store password file" string argument. + * Returns the "admin uid" hidden string argument. * - * @return The "keyStorePassword" argument. + * @param description + * The argument localizable description. + * @return The "admin uid" hidden string argument. * @throws ArgumentException * If there is a problem with any of the parameters used to create this argument. */ - public static StringArgument getCertNickName() throws ArgumentException { - return new StringArgument(OPTION_LONG_CERT_NICKNAME.toLowerCase(), OPTION_SHORT_CERT_NICKNAME, - OPTION_LONG_CERT_NICKNAME, false, true, true, INFO_NICKNAME_PLACEHOLDER.get(), null, - OPTION_LONG_CERT_NICKNAME, INFO_ARGUMENT_DESCRIPTION_CERT_NICKNAME.get()); + public static StringArgument adminUidHiddenArgument(final LocalizableMessage description) + throws ArgumentException { + return adminUidArgument(true, description); } + private static StringArgument adminUidArgument(final boolean hidden, final LocalizableMessage description) + throws ArgumentException { + final StringArgument.Builder builder = StringArgument.builder(OPTION_LONG_ADMIN_UID) + .shortIdentifier('I') + .description(description) + .defaultValue(CliConstants.GLOBAL_ADMIN_UID) + .valuePlaceholder(INFO_ADMINUID_PLACEHOLDER.get()); + if (hidden) { + builder.hidden(); + } + return builder.buildArgument(); + } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java index 1f21cb89c..7a3c7c4ac 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConnectionFactoryProvider.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -30,10 +20,12 @@ import static com.forgerock.opendj.cli.CliConstants.DEFAULT_LDAP_PORT; import static com.forgerock.opendj.cli.CliMessages.*; import static com.forgerock.opendj.cli.Utils.getHostNameForLdapUrl; +import static com.forgerock.opendj.cli.Utils.throwIfArgumentsConflict; import static org.forgerock.opendj.ldap.LDAPConnectionFactory.AUTHN_BIND_REQUEST; import static org.forgerock.opendj.ldap.LDAPConnectionFactory.CONNECT_TIMEOUT; import static org.forgerock.opendj.ldap.LDAPConnectionFactory.SSL_CONTEXT; import static org.forgerock.opendj.ldap.LDAPConnectionFactory.SSL_USE_STARTTLS; +import static com.forgerock.opendj.cli.CommonArguments.*; import java.io.File; import java.io.FileInputStream; @@ -130,9 +122,6 @@ public final class ConnectionFactoryProvider { /** Whether to use the password policy control in the bind request. */ private final BooleanArgument usePasswordPolicyControlArg; - /** The port number to used to connect. */ - private int port = DEFAULT_LDAP_PORT; - /** The SSL context linked to this connection. */ private SSLContext sslContext; @@ -186,7 +175,7 @@ public ConnectionFactoryProvider(final ArgumentParser argumentParser, final boolean alwaysSSL) throws ArgumentException { this.app = app; - useSSLArg = CommonArguments.getUseSSL(); + useSSLArg = useSSLArgument(); if (!alwaysSSL) { argumentParser.addLdapConnectionArgument(useSSLArg); } else { @@ -194,7 +183,7 @@ public ConnectionFactoryProvider(final ArgumentParser argumentParser, useSSLArg.setPresent(true); } - useStartTLSArg = CommonArguments.getStartTLS(); + useStartTLSArg = startTLSArgument(); if (!alwaysSSL) { argumentParser.addLdapConnectionArgument(useStartTLSArg); } @@ -205,7 +194,7 @@ public ConnectionFactoryProvider(final ArgumentParser argumentParser, } catch (final Exception e) { defaultHostName = "Unknown (" + e + ")"; } - hostNameArg = CommonArguments.getHostName(defaultHostName); + hostNameArg = hostNameArgument(defaultHostName); argumentParser.addLdapConnectionArgument(hostNameArg); LocalizableMessage portDescription = INFO_DESCRIPTION_PORT.get(); @@ -213,56 +202,55 @@ public ConnectionFactoryProvider(final ArgumentParser argumentParser, portDescription = INFO_DESCRIPTION_ADMIN_PORT.get(); } - portArg = CommonArguments.getPort(defaultPort, portDescription); + portArg = portArgument(defaultPort, portDescription); argumentParser.addLdapConnectionArgument(portArg); - bindNameArg = CommonArguments.getBindDN(defaultBindDN); + bindNameArg = bindDNArgument(defaultBindDN); argumentParser.addLdapConnectionArgument(bindNameArg); - bindPasswordArg = CommonArguments.getBindPassword(); + bindPasswordArg = bindPasswordArgument(); argumentParser.addLdapConnectionArgument(bindPasswordArg); - bindPasswordFileArg = CommonArguments.getBindPasswordFile(); + bindPasswordFileArg = bindPasswordFileArgument(); argumentParser.addLdapConnectionArgument(bindPasswordFileArg); - saslOptionArg = CommonArguments.getSASL(); + saslOptionArg = saslArgument(); argumentParser.addLdapConnectionArgument(saslOptionArg); - trustAllArg = CommonArguments.getTrustAll(); + trustAllArg = trustAllArgument(); argumentParser.addLdapConnectionArgument(trustAllArg); - trustStorePathArg = CommonArguments.getTrustStorePath(); + trustStorePathArg = trustStorePathArgument(); argumentParser.addLdapConnectionArgument(trustStorePathArg); - trustStorePasswordArg = CommonArguments.getTrustStorePassword(); + trustStorePasswordArg = trustStorePasswordArgument(); argumentParser.addLdapConnectionArgument(trustStorePasswordArg); - trustStorePasswordFileArg = CommonArguments.getTrustStorePasswordFile(); + trustStorePasswordFileArg = trustStorePasswordFileArgument(); argumentParser.addLdapConnectionArgument(trustStorePasswordFileArg); - keyStorePathArg = CommonArguments.getKeyStorePath(); + keyStorePathArg = keyStorePathArgument(); argumentParser.addLdapConnectionArgument(keyStorePathArg); - keyStorePasswordArg = CommonArguments.getKeyStorePassword(); + keyStorePasswordArg = keyStorePasswordArgument(); argumentParser.addLdapConnectionArgument(keyStorePasswordArg); - keyStorePasswordFileArg = CommonArguments.getKeyStorePasswordFile(); + keyStorePasswordFileArg = keyStorePasswordFileArgument(); argumentParser.addLdapConnectionArgument(keyStorePasswordFileArg); - certNicknameArg = CommonArguments.getCertNickName(); + certNicknameArg = certNickNameArgument(); argumentParser.addLdapConnectionArgument(certNicknameArg); - reportAuthzIDArg = CommonArguments.getReportAuthzId(); + reportAuthzIDArg = reportAuthzIdArgument(); argumentParser.addArgument(reportAuthzIDArg); - connectTimeOut = CommonArguments.getConnectTimeOut(); + connectTimeOut = connectTimeOutHiddenArgument(); argumentParser.addArgument(connectTimeOut); usePasswordPolicyControlArg = - new BooleanArgument("usepwpolicycontrol", null, OPTION_LONG_USE_PW_POLICY_CTL, - INFO_DESCRIPTION_USE_PWP_CONTROL.get()); - usePasswordPolicyControlArg.setPropertyName(OPTION_LONG_USE_PW_POLICY_CTL); - argumentParser.addArgument(usePasswordPolicyControlArg); + BooleanArgument.builder(OPTION_LONG_USE_PW_POLICY_CTL) + .description(INFO_DESCRIPTION_USE_PWP_CONTROL.get()) + .buildAndAddToParser(argumentParser); } /** @@ -297,8 +285,7 @@ public String getHostname() throws ArgumentException { value = hostNameArg.getValue(); } else if (app.isInteractive()) { try { - value = app.readInput(INFO_DESCRIPTION_HOST.get(), - hostNameArg.getDefaultValue() == null ? value : hostNameArg.getDefaultValue()); + value = app.readInput(INFO_DESCRIPTION_HOST.get(), getHostNameDefaultValue(value)); app.println(); hostNameArg.addValue(value); hostNameArg.setPresent(true); @@ -306,12 +293,16 @@ public String getHostname() throws ArgumentException { throw new ArgumentException(ERR_ERROR_CANNOT_READ_HOST_NAME.get(), e); } } else { - return hostNameArg.getDefaultValue() == null ? value : hostNameArg.getDefaultValue(); + return getHostNameDefaultValue(value); } return getHostNameForLdapUrl(value); } + private String getHostNameDefaultValue(String fallbackValue) { + return hostNameArg.getDefaultValue() != null ? hostNameArg.getDefaultValue() : fallbackValue; + } + /** * Get the port which has to be used for the command. * @@ -324,6 +315,14 @@ public int getPort() { } catch (ArgumentException e) { return Integer.valueOf(portArg.getDefaultValue()); } + } else if (app.isInteractive()) { + final LocalizableMessage portMsg = + isAdminConnection ? INFO_DESCRIPTION_ADMIN_PORT.get() : INFO_DESCRIPTION_PORT.get(); + int value = app.askPort(portMsg, Integer.valueOf(portArg.getDefaultValue()), logger); + app.println(); + portArg.addValue(Integer.toString(value)); + portArg.setPresent(true); + return value; } return Integer.valueOf(portArg.getDefaultValue()); } @@ -376,32 +375,24 @@ public ConnectionFactory getUnauthenticatedConnectionFactory() throws ArgumentEx private ConnectionFactory getConnectionFactory(boolean usePreAuthentication) throws ArgumentException { if (connFactory == null) { - port = portArg.isPresent() ? portArg.getIntValue() : 0; - checkForConflictingArguments(); if (app.isInteractive()) { - if (!hostNameArg.isPresent() || port == 0 || !bindNameArg.isPresent() - || (!bindPasswordArg.isPresent() && !bindPasswordFileArg.isPresent())) { + boolean portIsMissing = !portArg.isPresent() || portArg.getIntValue() == 0; + boolean bindPwdIsMissing = !bindPasswordArg.isPresent() && !bindPasswordFileArg.isPresent(); + if (!hostNameArg.isPresent() || portIsMissing || !bindNameArg.isPresent() || bindPwdIsMissing) { app.printHeader(INFO_LDAP_CONN_HEADING_CONNECTION_PARAMETERS.get()); } if (!hostNameArg.isPresent()) { getHostname(); } - if (port == 0) { - LocalizableMessage portMsg; - if (isAdminConnection) { - portMsg = INFO_DESCRIPTION_ADMIN_PORT.get(); - } else { - portMsg = INFO_DESCRIPTION_PORT.get(); - } - port = app.askPort(portMsg, Integer.valueOf(portArg.getDefaultValue()), logger); - app.println(); + if (portIsMissing) { + getPort(); } if (!bindNameArg.isPresent()) { getBindName(); } - if (!bindPasswordArg.isPresent() && !bindPasswordFileArg.isPresent()) { + if (bindPwdIsMissing) { getPassword(); } } @@ -444,7 +435,7 @@ private ConnectionFactory getConnectionFactory(boolean usePreAuthentication) thr if (usePreAuthentication) { options.set(AUTHN_BIND_REQUEST, getBindRequest()); } - connFactory = new LDAPConnectionFactory(hostNameArg.getValue(), port, options); + connFactory = new LDAPConnectionFactory(hostNameArg.getValue(), portArg.getIntValue(), options); } return connFactory; } @@ -457,45 +448,12 @@ private ConnectionFactory getConnectionFactory(boolean usePreAuthentication) thr * an argument exception is thrown. */ private void checkForConflictingArguments() throws ArgumentException { - // Couldn't have at the same time bindPassword and bindPasswordFile - if (bindPasswordArg.isPresent() && bindPasswordFileArg.isPresent()) { - final LocalizableMessage message = - ERR_TOOL_CONFLICTING_ARGS.get(bindPasswordArg.getLongIdentifier(), - bindPasswordFileArg.getLongIdentifier()); - throw new ArgumentException(message); - } - - /* - * Couldn't have at the same time trustAll and trustStore related arg - */ - if (trustAllArg.isPresent() && trustStorePathArg.isPresent()) { - final LocalizableMessage message = - ERR_TOOL_CONFLICTING_ARGS.get(trustAllArg.getLongIdentifier(), - trustStorePathArg.getLongIdentifier()); - throw new ArgumentException(message); - } - if (trustAllArg.isPresent() && trustStorePasswordArg.isPresent()) { - final LocalizableMessage message = - ERR_TOOL_CONFLICTING_ARGS.get(trustAllArg.getLongIdentifier(), - trustStorePasswordArg.getLongIdentifier()); - throw new ArgumentException(message); - } - if (trustAllArg.isPresent() && trustStorePasswordFileArg.isPresent()) { - final LocalizableMessage message = - ERR_TOOL_CONFLICTING_ARGS.get(trustAllArg.getLongIdentifier(), - trustStorePasswordFileArg.getLongIdentifier()); - throw new ArgumentException(message); - } - - /* - * Couldn't have at the same time trustStorePasswordArg and trustStorePasswordFileArg - */ - if (trustStorePasswordArg.isPresent() && trustStorePasswordFileArg.isPresent()) { - final LocalizableMessage message = - ERR_TOOL_CONFLICTING_ARGS.get(trustStorePasswordArg.getLongIdentifier(), - trustStorePasswordFileArg.getLongIdentifier()); - throw new ArgumentException(message); - } + throwIfArgumentsConflict(bindPasswordArg, bindPasswordFileArg); + throwIfArgumentsConflict(trustAllArg, trustStorePathArg); + throwIfArgumentsConflict(trustAllArg, trustStorePasswordArg); + throwIfArgumentsConflict(trustAllArg, trustStorePasswordFileArg); + throwIfArgumentsConflict(trustStorePasswordArg, trustStorePasswordFileArg); + throwIfArgumentsConflict(useStartTLSArg, useSSLArg); if (trustStorePathArg.isPresent()) { // Check that the path exists and is readable @@ -514,14 +472,6 @@ private void checkForConflictingArguments() throws ArgumentException { throw new ArgumentException(message); } } - - // Couldn't have at the same time startTLSArg and useSSLArg - if (useStartTLSArg.isPresent() && useSSLArg.isPresent()) { - final LocalizableMessage message = - ERR_TOOL_CONFLICTING_ARGS.get(useStartTLSArg.getLongIdentifier(), useSSLArg - .getLongIdentifier()); - throw new ArgumentException(message); - } } /** @@ -539,13 +489,7 @@ private boolean canReadPath(final String path) { } private String getAuthID(final String mech) throws ArgumentException { - String value = null; - for (final String s : saslOptionArg.getValues()) { - if (s.startsWith(SASL_PROPERTY_AUTHID)) { - value = parseSASLOptionValue(s); - break; - } - } + String value = getAuthID(); if (value == null && bindNameArg.isPresent()) { value = "dn: " + bindNameArg.getValue(); } @@ -561,21 +505,17 @@ private String getAuthID(final String mech) throws ArgumentException { } } if (value == null) { - final LocalizableMessage message = ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(mech); - throw new ArgumentException(message); + throw new ArgumentException(ERR_LDAPAUTH_SASL_AUTHID_REQUIRED.get(mech)); } return value; } + private String getAuthID() throws ArgumentException { + return getSaslProperty(SASL_PROPERTY_AUTHID); + } + private String getAuthzID() throws ArgumentException { - String value = null; - for (final String s : saslOptionArg.getValues()) { - if (s.startsWith(SASL_PROPERTY_AUTHZID)) { - value = parseSASLOptionValue(s); - break; - } - } - return value; + return getSaslProperty(SASL_PROPERTY_AUTHZID); } /** @@ -621,13 +561,7 @@ public String getBindName() throws ArgumentException { */ public BindRequest getBindRequest() throws ArgumentException { if (bindRequest == null) { - String mech = null; - for (final String s : saslOptionArg.getValues()) { - if (s.startsWith(SASL_PROPERTY_MECH)) { - mech = parseSASLOptionValue(s); - break; - } - } + String mech = getMechanism(); if (mech == null) { if (bindNameArg.isPresent() || bindPasswordFileArg.isPresent() @@ -682,21 +616,30 @@ public BindRequest getBindRequest() throws ArgumentException { return bindRequest; } - /** {@inheritDoc} */ - @Override - public String toString() { - return connFactory.toString(); + private String getMechanism() throws ArgumentException { + return getSaslProperty(SASL_PROPERTY_MECH); } private String getKDC() throws ArgumentException { - String value = null; + return getSaslProperty(SASL_PROPERTY_KDC); + } + + private String getRealm() throws ArgumentException { + return getSaslProperty(SASL_PROPERTY_REALM); + } + + private String getSaslProperty(String propertyName) throws ArgumentException { for (final String s : saslOptionArg.getValues()) { - if (s.startsWith(SASL_PROPERTY_KDC)) { - value = parseSASLOptionValue(s); - break; + if (s.startsWith(propertyName)) { + return parseSASLOptionValue(s); } } - return value; + return null; + } + + @Override + public String toString() { + return connFactory.toString(); } /** @@ -733,10 +676,10 @@ public X509KeyManager getKeyManager(String keyStoreFile) throws KeyStoreExceptio keyStorePIN = keyStorePass.toCharArray(); } - final FileInputStream fos = new FileInputStream(keyStoreFile); final KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType()); - keystore.load(fos, keyStorePIN); - fos.close(); + try (final FileInputStream fos = new FileInputStream(keyStoreFile)) { + keystore.load(fos, keyStorePIN); + } return new ApplicationKeyManager(keystore, keyStorePIN); } @@ -807,17 +750,6 @@ public char[] getPassword() throws ArgumentException { return value; } - private String getRealm() throws ArgumentException { - String value = null; - for (final String s : saslOptionArg.getValues()) { - if (s.startsWith(SASL_PROPERTY_REALM)) { - value = parseSASLOptionValue(s); - break; - } - } - return value; - } - /** * Retrieves a TrustManager object that may be used for * interactions requiring access to a trust manager. @@ -865,7 +797,6 @@ private String getTrustStore() { * * @return The PIN that should be used to access the trust store, can be null. */ - private char[] getTrustStorePIN() { String pwd; if (trustStorePasswordArg.isPresent()) { @@ -880,11 +811,9 @@ private char[] getTrustStorePIN() { private String parseSASLOptionValue(final String option) throws ArgumentException { final int equalPos = option.indexOf('='); - if (equalPos <= 0) { - final LocalizableMessage message = ERR_LDAP_CONN_CANNOT_PARSE_SASL_OPTION.get(option); - throw new ArgumentException(message); + if (equalPos == -1) { + throw new ArgumentException(ERR_LDAP_CONN_CANNOT_PARSE_SASL_OPTION.get(option)); } - return option.substring(equalPos + 1, option.length()); } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java old mode 100755 new mode 100644 index 6457971a4..3e22ef74f --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ConsoleApplication.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008-2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS - * Portions copyright 2011 Nemanja Lukić + * Copyright 2008-2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. + * Portions copyright 2011 Nemanja Lukić */ package com.forgerock.opendj.cli; @@ -566,35 +556,11 @@ public final String readLineOfInput(final LocalizableMessage prompt) throws Clie * If the port could not be retrieved for some reason. */ public final int readPort(LocalizableMessage prompt, final int defaultValue) throws ClientException { - final ValidationCallback callback = new ValidationCallback() { - @Override - public Integer validate(ConsoleApplication app, String input) throws ClientException { - final String ninput = input.trim(); - if (ninput.length() == 0) { - return defaultValue; - } - - try { - int i = Integer.parseInt(ninput); - if (i < 1 || i > 65535) { - throw new NumberFormatException(); - } - return i; - } catch (NumberFormatException e) { - // Try again... - app.println(); - app.println(ERR_BAD_PORT_NUMBER.get(ninput)); - app.println(); - return null; - } - } - - }; if (defaultValue != -1) { prompt = INFO_PROMPT_SINGLE_DEFAULT.get(prompt, defaultValue); } - return readValidatedInput(prompt, callback, CONFIRMATION_MAX_TRIES); + return readValidatedInput(prompt, Utils.portValidationCallback(defaultValue), CONFIRMATION_MAX_TRIES); } /** diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocDescriptionSupplement.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocDescriptionSupplement.java index 09562e6f4..43bdfbdb4 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocDescriptionSupplement.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocDescriptionSupplement.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -38,13 +28,5 @@ public interface DocDescriptionSupplement { * @return The supplement to the description for use in generated reference documentation, * or LocalizableMessage.EMPTY if there is no supplement. */ - public LocalizableMessage getDocDescriptionSupplement(); - - /** - * Sets a supplement to the description intended for use in generated reference documentation. - * - * @param docDescriptionSupplement The supplement to the description - * for use in generated reference documentation. - */ - public void setDocDescriptionSupplement(final LocalizableMessage docDescriptionSupplement); + LocalizableMessage getDocDescriptionSupplement(); } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocGenerationHelper.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocGenerationHelper.java index a60d99aa1..b8f410ab0 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocGenerationHelper.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/DocGenerationHelper.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -77,16 +67,13 @@ public static void applyTemplate(StringBuilder builder, final String template, f configuration = getConfiguration(); // FreeMarker takes the data and a Writer to process the template. - ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); - Writer writer = new OutputStreamWriter(outputStream); - try { + try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + Writer writer = new OutputStreamWriter(outputStream)) { Template configurationTemplate = configuration.getTemplate(template); configurationTemplate.process(map, writer); builder.append(outputStream.toString()); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); - } finally { - org.forgerock.util.Utils.closeSilently(writer, outputStream); } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/FileBasedArgument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/FileBasedArgument.java index fd96b583f..7a8d96252 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/FileBasedArgument.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/FileBasedArgument.java @@ -1,41 +1,32 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; import static com.forgerock.opendj.cli.CliMessages.*; import static com.forgerock.opendj.util.StaticUtils.getExceptionMessage; -import static org.forgerock.util.Utils.closeSilently; import java.io.BufferedReader; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileReader; +import java.io.IOException; import java.util.LinkedHashMap; +import java.util.Map; -import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; /** @@ -44,7 +35,7 @@ * command line, it will be treated as the path to the file containing the * actual value rather than the value itself.
*
- * Note that if if no filename is provided on the command line but a default + * Note that if no filename is provided on the command line but a default * value is specified programmatically or if the default value is read from a * specified property, then that default value will be taken as the actual value * rather than a filename.
@@ -54,85 +45,41 @@ * multiple lines, then only the first line will be read. */ public final class FileBasedArgument extends Argument { - /** The mapping between filenames specified and the first lines read from those files. */ - private final LinkedHashMap namesToValues = new LinkedHashMap<>(); /** - * Creates a new file-based argument with the provided information. + * Returns a builder which can be used for incrementally constructing a new + * {@link FileBasedArgument}. * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param isMultiValued - * Indicates whether this argument may be specified more than - * once to provide multiple values. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param defaultValue - * The default value that should be used for this argument if - * none is provided in a properties file or on the command line. - * This may be null if there is no generic default. - * @param propertyName - * The name of the property in a property file that may be used - * to override the default value but will be overridden by a - * command-line argument. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. + * The generic long identifier that will be used to refer to this argument. + * @return A builder to continue building the {@link FileBasedArgument}. */ - public FileBasedArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean isMultiValued, - final LocalizableMessage valuePlaceholder, final String defaultValue, - final String propertyName, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, true, - valuePlaceholder, defaultValue, propertyName, description); + public static Builder builder(final String longIdentifier) { + return new Builder(longIdentifier); } - /** - * Creates a new file-based argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - public FileBasedArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, - final LocalizableMessage valuePlaceholder, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, false, true, valuePlaceholder, - null, null, description); + /** A fluent API for incrementally constructing {@link FileBasedArgument}. */ + public static final class Builder extends ArgumentBuilder { + private Builder(final String longIdentifier) { + super(longIdentifier); + } + + @Override + Builder getThis() { + return this; + } + + @Override + public FileBasedArgument buildArgument() throws ArgumentException { + return new FileBasedArgument(this); + } + } + + /** The mapping between filenames specified and the first lines read from those files. */ + private final Map namesToValues = new LinkedHashMap<>(); + + private FileBasedArgument(final Builder builder) throws ArgumentException { + super(builder); } /** @@ -162,7 +109,7 @@ public void addValue(final String valueString) { * @return A map between the filenames specified on the command line and the * first lines read from those files. */ - public LinkedHashMap getNameToValueMap() { + public Map getNameToValueMap() { return namesToValues; } @@ -186,41 +133,30 @@ public boolean valueIsAcceptable(final String valueString, try { valueFile = new File(valueString); if (!valueFile.exists()) { - invalidReason.append(ERR_FILEARG_NO_SUCH_FILE.get(valueString, getName())); + invalidReason.append(ERR_FILEARG_NO_SUCH_FILE.get(valueString, longIdentifier)); return false; } } catch (final Exception e) { - invalidReason.append(ERR_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE.get(valueString, - getName(), getExceptionMessage(e))); - return false; - } - - // Open the file for reading. - BufferedReader reader; - try { - reader = new BufferedReader(new FileReader(valueFile)); - } catch (final Exception e) { - invalidReason.append(ERR_FILEARG_CANNOT_OPEN_FILE.get(valueString, getName(), - getExceptionMessage(e))); + invalidReason.append(ERR_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE.get( + valueString, longIdentifier, getExceptionMessage(e))); return false; } - // Read the first line and close the file. + // Open the file, read the first line and close the file. String line; - try { + try (BufferedReader reader = new BufferedReader(new FileReader(valueFile))) { line = reader.readLine(); - } catch (final Exception e) { - invalidReason.append(ERR_FILEARG_CANNOT_READ_FILE.get(valueString, getName(), - getExceptionMessage(e))); + } catch (final FileNotFoundException e) { + invalidReason.append(ERR_FILEARG_CANNOT_OPEN_FILE.get(valueString, longIdentifier, getExceptionMessage(e))); + return false; + } catch (final IOException e) { + invalidReason.append(ERR_FILEARG_CANNOT_READ_FILE.get(valueString, longIdentifier, getExceptionMessage(e))); return false; - } finally { - closeSilently(reader); } // If the line read is null, then that means the file was empty. if (line == null) { - - invalidReason.append(ERR_FILEARG_EMPTY_FILE.get(valueString, getName())); + invalidReason.append(ERR_FILEARG_EMPTY_FILE.get(valueString, longIdentifier)); return false; } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/HelpCallback.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/HelpCallback.java index 05659ceaf..ba118443e 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/HelpCallback.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/HelpCallback.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java index 90e41a0d9..a17cb1258 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/IntegerArgument.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -36,285 +26,84 @@ * potentially only those in a given range. */ public final class IntegerArgument extends Argument { - /** Indicates whether a lower bound will be enforced for this argument. */ - private final boolean hasLowerBound; - - /** - * Indicates whether an upper bound will be enforced for this - * argument. - */ - private final boolean hasUpperBound; - - /** The lower bound that will be enforced for this argument. */ - private final int lowerBound; - - /** The upper bound that will be enforced for this argument. */ - private final int upperBound; /** - * Creates a new integer argument with the provided information. + * Returns a builder which can be used for incrementally constructing a new + * {@link IntegerArgument}. * * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param isMultiValued - * Indicates whether this argument may be specified more than - * once to provide multiple values. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param defaultValue - * The default value that should be used for this argument if - * none is provided in a properties file or on the command line. - * This may be null if there is no generic default. - * @param propertyName - * The name of the property in a property file that may be used - * to override the default value but will be overridden by a - * command-line argument. - * @param hasLowerBound - * Indicates whether a lower bound should be enforced for values - * of this argument. - * @param lowerBound - * The lower bound that should be enforced for values of this - * argument. - * @param hasUpperBound - * Indicates whether an upperbound should be enforced for values - * of this argument. - * @param upperBound - * The upper bound that should be enforced for values of this - * argument. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. + * The generic name that will be used to refer to this argument. + * @return A builder to continue building the {@link IntegerArgument}. */ - public IntegerArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean isMultiValued, - final boolean needsValue, final LocalizableMessage valuePlaceholder, - final int defaultValue, final String propertyName, final boolean hasLowerBound, - final int lowerBound, final boolean hasUpperBound, final int upperBound, - final LocalizableMessage description) throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue, - valuePlaceholder, String.valueOf(defaultValue), propertyName, description); + public static Builder builder(final String name) { + return new Builder(name); + } - this.hasLowerBound = hasLowerBound; - this.hasUpperBound = hasUpperBound; - this.lowerBound = lowerBound; - this.upperBound = upperBound; + /** A fluent API for incrementally constructing {@link IntegerArgument}. */ + public static final class Builder extends ArgumentBuilder { + private int lowerBound = Integer.MIN_VALUE; + private int upperBound = Integer.MAX_VALUE; - if (hasLowerBound && hasUpperBound && (lowerBound > upperBound)) { - final LocalizableMessage message = - ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND.get(name, lowerBound, upperBound); - throw new ArgumentException(message); + private Builder(final String name) { + super(name); } - } - /** - * Creates a new integer argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param isMultiValued - * Indicates whether this argument may be specified more than - * once to provide multiple values. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param defaultValue - * The default value that should be used for this argument if - * none is provided in a properties file or on the command line. - * This may be null if there is no generic default. - * @param propertyName - * The name of the property in a property file that may be used - * to override the default value but will be overridden by a - * command-line argument. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - public IntegerArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean isMultiValued, - final boolean needsValue, final LocalizableMessage valuePlaceholder, - final int defaultValue, final String propertyName, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue, - valuePlaceholder, String.valueOf(defaultValue), propertyName, description); + @Override + Builder getThis() { + return this; + } - hasLowerBound = false; - hasUpperBound = false; - lowerBound = Integer.MIN_VALUE; - upperBound = Integer.MAX_VALUE; + /** + * Sets the lower bound of this {@link IntegerArgument}. + * + * @param lowerBound + * The lower bound value. + * @return This builder. + */ + public Builder lowerBound(final int lowerBound) { + this.lowerBound = lowerBound; + return getThis(); + } + + /** + * Sets the range of this {@link IntegerArgument}. + * + * @param lowerBound + * The range lower bound value. + * @param upperBound + * The range upper bound value. + * @return This builder. + */ + public Builder range(final int lowerBound, final int upperBound) { + this.lowerBound = lowerBound; + this.upperBound = upperBound; + return getThis(); + } + + @Override + public IntegerArgument buildArgument() throws ArgumentException { + return new IntegerArgument(this, lowerBound, upperBound); + } } - /** - * Creates a new integer argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param hasLowerBound - * Indicates whether a lower bound should be enforced for values - * of this argument. - * @param lowerBound - * The lower bound that should be enforced for values of this - * argument. - * @param hasUpperBound - * Indicates whether an upperbound should be enforced for values - * of this argument. - * @param upperBound - * The upper bound that should be enforced for values of this - * argument. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - public IntegerArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean needsValue, - final LocalizableMessage valuePlaceholder, final boolean hasLowerBound, - final int lowerBound, final boolean hasUpperBound, final int upperBound, - final LocalizableMessage description) throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue, - valuePlaceholder, null, null, description); + /** The lower bound that will be enforced for this argument. */ + private final int lowerBound; + /** The upper bound that will be enforced for this argument. */ + private final int upperBound; - this.hasLowerBound = hasLowerBound; - this.hasUpperBound = hasUpperBound; + private IntegerArgument(final Builder builder, final int lowerBound, final int upperBound) + throws ArgumentException { + super(builder); this.lowerBound = lowerBound; this.upperBound = upperBound; - if (hasLowerBound && hasUpperBound && (lowerBound > upperBound)) { + if (lowerBound > upperBound) { final LocalizableMessage message = - ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND.get(name, lowerBound, upperBound); + ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND.get(builder.longIdentifier, lowerBound, upperBound); throw new ArgumentException(message); } } - /** - * Creates a new integer argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - public IntegerArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean needsValue, - final LocalizableMessage valuePlaceholder, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue, - valuePlaceholder, null, null, description); - - hasLowerBound = false; - hasUpperBound = false; - lowerBound = Integer.MIN_VALUE; - upperBound = Integer.MAX_VALUE; - } - - /** - * Retrieves the lower bound that may be enforced for values of this - * argument. - * - * @return The lower bound that may be enforced for values of this argument. - */ - public int getLowerBound() { - return lowerBound; - } - - /** - * Retrieves the upper bound that may be enforced for values of this - * argument. - * - * @return The upper bound that may be enforced for values of this argument. - */ - public int getUpperBound() { - return upperBound; - } - - /** - * Indicates whether a lower bound should be enforced for values of this - * argument. - * - * @return true if a lower bound should be enforced for values - * of this argument, or false if not. - */ - public boolean hasLowerBound() { - return hasLowerBound; - } - - /** - * Indicates whether a upper bound should be enforced for values of this - * argument. - * - * @return true if a upper bound should be enforced for values - * of this argument, or false if not. - */ - public boolean hasUpperBound() { - return hasUpperBound; - } - /** * Indicates whether the provided value is acceptable for use in this * argument. @@ -328,35 +117,23 @@ public boolean hasUpperBound() { * false if it is not. */ @Override - public boolean valueIsAcceptable(final String valueString, - final LocalizableMessageBuilder invalidReason) { - // First, the value must be decodable as an integer. - int intValue; + public boolean valueIsAcceptable(final String valueString, final LocalizableMessageBuilder invalidReason) { try { - intValue = Integer.parseInt(valueString); - } catch (final Exception e) { - invalidReason.append(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, getPropertyName())); + final int intValue = Integer.parseInt(valueString); + if (intValue < lowerBound) { + invalidReason.append(ERR_INTARG_VALUE_BELOW_LOWER_BOUND.get(longIdentifier, intValue, lowerBound)); + return false; + } + + if (intValue > upperBound) { + invalidReason.append(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get(longIdentifier, intValue, upperBound)); + return false; + } + + return true; + } catch (final NumberFormatException e) { + invalidReason.append(ERR_ARG_CANNOT_DECODE_AS_INT.get(valueString, longIdentifier)); return false; } - - // If there is a lower bound, then the value must be greater than or - // equal to it. - if (hasLowerBound && (intValue < lowerBound)) { - invalidReason.append(ERR_INTARG_VALUE_BELOW_LOWER_BOUND.get(getPropertyName(), intValue, - lowerBound)); - return false; - } - - // If there is an upper bound, then the value must be less than or - // equal to it. - if (hasUpperBound && (intValue > upperBound)) { - - invalidReason.append(ERR_INTARG_VALUE_ABOVE_UPPER_BOUND.get(getPropertyName(), intValue, - upperBound)); - return false; - } - - // At this point, the value should be acceptable. - return true; } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Menu.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Menu.java index abd62b2c7..ec75b8204 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Menu.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Menu.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuBuilder.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuBuilder.java index cdec9a48d..07b3ce77e 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuBuilder.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuBuilder.java @@ -1,32 +1,23 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2007-2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2007-2008 Sun Microsystems, Inc. + * 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; @@ -68,7 +59,7 @@ public CompositeCallback(Collection> callbacks) { this.callbacks = callbacks; } - /** {@inheritDoc} */ + @Override public MenuResult invoke(ConsoleApplication app) throws ClientException { List values = new ArrayList<>(); for (MenuCallback callback : callbacks) { @@ -145,12 +136,13 @@ private MenuImpl(ConsoleApplication app, LocalizableMessage title, LocalizableMe this.nMaxTries = nMaxTries; } - /** {@inheritDoc} */ + @Override public MenuResult run() throws ClientException { // The validation call-back which will be used to determine the // action call-back. ValidationCallback> validator = new ValidationCallback>() { + @Override public MenuCallback validate(ConsoleApplication app, String input) { String ninput = input.trim(); @@ -287,7 +279,7 @@ private ResultCallback(MenuResult result) { this.result = result; } - /** {@inheritDoc} */ + @Override public MenuResult invoke(ConsoleApplication app) throws ClientException { return result; } @@ -420,6 +412,7 @@ public void addCharOption(LocalizableMessage c, LocalizableMessage description, public void addHelpOption(final HelpCallback callback) { MenuCallback wrapper = new MenuCallback() { + @Override public MenuResult invoke(ConsoleApplication app) throws ClientException { app.println(); callback.display(app); diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuCallback.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuCallback.java index a7bc29d19..ba46c5ddd 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuCallback.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuCallback.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuResult.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuResult.java index 42fc7eee4..97efc142f 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuResult.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MenuResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2015 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiChoiceArgument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiChoiceArgument.java index e33bea4dd..7dd713c0b 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiChoiceArgument.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiChoiceArgument.java @@ -1,171 +1,108 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; import static com.forgerock.opendj.cli.CliMessages.ERR_MCARG_VALUE_NOT_ALLOWED; +import java.util.Arrays; import java.util.Collection; +import java.util.LinkedList; +import java.util.List; -import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; /** * This class defines an argument type that will only accept one or more of a * specific set of string values. * - * @param + * @param * The type of values returned by this argument. */ -public final class MultiChoiceArgument extends Argument { - /** - * Indicates whether argument values should be treated in a - * case-sensitive manner. - */ - private final boolean caseSensitive; - - /** The set of values that will be allowed for use with this argument. */ - private final Collection allowedValues; +public final class MultiChoiceArgument extends Argument { /** - * Creates a new string argument with the provided information. + * Returns a builder which can be used for incrementally constructing a new + * {@link MultiChoiceArgument}. * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. + * @param + * The type of values returned by this argument. * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param isMultiValued - * Indicates whether this argument may be specified more than - * once to provide multiple values. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param defaultValue - * The default value that should be used for this argument if - * none is provided in a properties file or on the command line. - * This may be null if there is no generic default. - * @param propertyName - * The name of the property in a property file that may be used - * to override the default value but will be overridden by a - * command-line argument. - * @param allowedValues - * The set of values that are allowed for use for this argument. - * If they are not to be treated in a case-sensitive value then - * they should all be formatted in lowercase. - * @param caseSensitive - * Indicates whether the set of allowed values should be treated - * in a case-sensitive manner. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. + * The generic long identifier that will be used to refer to this argument. + * @return A builder to continue building the {@link MultiChoiceArgument}. */ - public MultiChoiceArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean isMultiValued, - final boolean needsValue, final LocalizableMessage valuePlaceholder, - final String defaultValue, final String propertyName, - final Collection allowedValues, final boolean caseSensitive, - final LocalizableMessage description) throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue, - valuePlaceholder, defaultValue, propertyName, description); - - this.allowedValues = allowedValues; - this.caseSensitive = caseSensitive; + public static Builder builder(final String longIdentifier) { + return new Builder<>(longIdentifier); } - /** - * Creates a new string argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param allowedValues - * The set of values that are allowed for use for this argument. - * If they are not to be treated in a case-sensitive value then - * they should all be formatted in lowercase. - * @param caseSensitive - * Indicates whether the set of allowed values should be treated - * in a case-sensitive manner. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - public MultiChoiceArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean needsValue, - final LocalizableMessage valuePlaceholder, final Collection allowedValues, - final boolean caseSensitive, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue, - valuePlaceholder, null, null, description); + /** A fluent API for incrementally constructing {@link MultiChoiceArgument}. */ + public static final class Builder extends ArgumentBuilder, V, MultiChoiceArgument> { + private final List allowedValues = new LinkedList<>(); - this.allowedValues = allowedValues; - this.caseSensitive = caseSensitive; + private Builder(final String longIdentifier) { + super(longIdentifier); + } + + @Override + Builder getThis() { + return this; + } + + /** + * Specifies the set of values that are allowed for the {@link MultiChoiceArgument}. + * + * @param allowedValues + * The {@link MultiChoiceArgument} allowed values. + * @return This builder. + */ + public Builder allowedValues(final Collection allowedValues) { + this.allowedValues.addAll(allowedValues); + return getThis(); + } + + /** + * Specifies the set of values that are allowed for the {@link MultiChoiceArgument}. + * + * @param allowedValues + * The {@link MultiChoiceArgument} allowed values. + * @return This builder. + */ + @SuppressWarnings("unchecked") + public final Builder allowedValues(final V... allowedValues) { + this.allowedValues.addAll(Arrays.asList(allowedValues)); + return getThis(); + } + + @Override + public MultiChoiceArgument buildArgument() throws ArgumentException { + return new MultiChoiceArgument<>(this, allowedValues); + } } - /** - * Retrieves the set of allowed values for this argument. The contents of - * this set must not be altered by the caller. - * - * @return The set of allowed values for this argument. - */ - public Collection getAllowedValues() { - return allowedValues; + /** The set of values that will be allowed for use with this argument. */ + private final Collection allowedValues; + + private MultiChoiceArgument(final Builder builder, final Collection allowedValues) + throws ArgumentException { + super(builder); + this.allowedValues = allowedValues; } /** - * Retrieves the string vale for this argument. If it has multiple values, + * Retrieves the string value for this argument. If it has multiple values, * then the first will be returned. If it does not have any values, then the * default value will be returned. * @@ -174,43 +111,17 @@ public Collection getAllowedValues() { * @throws ArgumentException * The value cannot be parsed. */ - public T getTypedValue() throws ArgumentException { + public V getTypedValue() throws ArgumentException { final String v = super.getValue(); if (v == null) { return null; } - for (final T o : allowedValues) { - if ((caseSensitive && o.toString().equals(v)) || o.toString().equalsIgnoreCase(v)) { - return o; + for (final V allowedValue : allowedValues) { + if (allowedValue.toString().equalsIgnoreCase(v)) { + return allowedValue; } } - // TODO: Some message - throw new ArgumentException(null); - } - - /** - * Indicates whether the set of allowed values for this argument should be - * treated in a case-sensitive manner. - * - * @return true if the values are to be treated in a - * case-sensitive manner, or false if not. - */ - public boolean isCaseSensitive() { - return caseSensitive; - } - - /** - * Specifies the default value that will be used for this argument if it is - * not specified on the command line and it is not set from a properties - * file. - * - * @param defaultValue - * The default value that will be used for this argument if it is - * not specified on the command line and it is not set from a - * properties file. - */ - public void setDefaultValue(final T defaultValue) { - super.setDefaultValue(defaultValue.toString()); + throw new IllegalStateException("This MultiChoiceArgument value is not part of the allowed values."); } /** @@ -226,15 +137,13 @@ public void setDefaultValue(final T defaultValue) { * false if it is not. */ @Override - public boolean valueIsAcceptable(final String valueString, - final LocalizableMessageBuilder invalidReason) { - for (final T o : allowedValues) { - if ((caseSensitive && o.toString().equals(valueString)) - || o.toString().equalsIgnoreCase(valueString)) { + public boolean valueIsAcceptable(final String valueString, final LocalizableMessageBuilder invalidReason) { + for (final V allowedValue : allowedValues) { + if (allowedValue.toString().equalsIgnoreCase(valueString)) { return true; } } - invalidReason.append(ERR_MCARG_VALUE_NOT_ALLOWED.get(getName(), valueString)); + invalidReason.append(ERR_MCARG_VALUE_NOT_ALLOWED.get(longIdentifier, valueString)); return false; } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiColumnPrinter.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiColumnPrinter.java index 53bba32b8..a1ece9ad2 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiColumnPrinter.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/MultiColumnPrinter.java @@ -1,462 +1,519 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; -import java.util.Arrays; +import static com.forgerock.opendj.cli.Utils.repeat; + +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Collections; import java.util.Iterator; import java.util.List; -import java.util.Vector; +import java.util.Locale; + +import org.forgerock.util.Reject; /** - * Utility class for printing aligned columns of text. - *

- * This class allows you to specify: - *

    - *
  • The number of columns in the output. This will determine the dimension of - * the string arrays passed to add(String[]) or addTitle(String[]). - *
  • spacing/gap between columns - *
  • character to use for title border (null means no border) - *
  • column alignment. Only LEFT/CENTER is supported for now. - *
- *

- * Example usage: + * Utility class for printing columns of data. + *

+ * This printer can be used to print data in formatted table or in csv format. + *

+ * Regarding the formatting table feature, this class allows you to specify for each {@link Column}s: + *

    + *
  • A unique identifier
  • + *
  • The column title which will be printed by a call to {@link MultiColumnPrinter#printTitleLine()}
  • + *
  • The size (if a cell's data is bigger than the predefined size, then the data will not be truncated, + * i.e. it will overflow)
  • + *
  • The number of digits to keep (for {@link Double} data)
  • + *
+ *

+ * Code to write data is independent of the {@link MultiColumnPrinter} configuration: + *

+ * void printData(final MultiColumnPrinter printer) {
+ *     String[][] myData = new String[][] {
+ *         new String[]{"U.S.A", "34.2", "40.8", ".us"},
+ *         new String[]{"United Kingdom", "261.1", "31.6", ".uk"},
+ *         new String[]{"France", "98.8", "30.1", ".fr"}
+ *     };
  *
- * 
- * MyPrinter mp = new MyPrinter(3, 2, "-");
- * String oneRow[] = new String[3];
- * oneRow[0] = "User Name";
- * oneRow[1] = "Email Address";
- * oneRow[2] = "Phone Number";
- * mp.addTitle(oneRow);
- * oneRow[0] = "Bob";
- * oneRow[1] = "bob@foo.com";
- * oneRow[2] = "123-4567";
- * mp.add(oneRow);
- * oneRow[0] = "John";
- * oneRow[1] = "john@foo.com";
- * oneRow[2] = "456-7890";
- * mp.add(oneRow);
- * mp.print();
- * 
- *

- * The above would print: - *

- * - *

- *  --------------------------------------
- *  User Name  Email Address  Phone Number
- *  --------------------------------------
- *  Bob        bob@foo.com    123-4567
- *  John       john@foo.com   456-7890
- * 
- *

- * This class also supports multi-row titles and having title strings spanning - * multiple columns. Example usage: - * - *

- * TestPrinter tp = new TestPrinter(4, 2, "-");
- * String oneRow[] = new String[4];
- * int[] span = new int[4];
- * span[0] = 2; // spans 2 columns
- * span[1] = 0; // spans 0 columns
- * span[2] = 2; // spans 2 columns
- * span[3] = 0; // spans 0 columns
- * tp.setTitleAlign(CENTER);
- * oneRow[0] = "Name";
- * oneRow[1] = "";
- * oneRow[2] = "Contact";
- * oneRow[3] = "";
- * tp.addTitle(oneRow, span);
- * oneRow[0] = "First";
- * oneRow[1] = "Last";
- * oneRow[2] = "Email";
- * oneRow[3] = "Phone";
- * tp.addTitle(oneRow);
- * oneRow[0] = "Bob";
- * oneRow[1] = "Jones";
- * oneRow[2] = "bob@foo.com";
- * oneRow[3] = "123-4567";
- * tp.add(oneRow);
- * oneRow[0] = "John";
- * oneRow[1] = "Doe";
- * oneRow[2] = "john@foo.com";
- * oneRow[3] = "456-7890";
- * tp.add(oneRow);
- * tp.println();
- * 
- *

- * The above would print: - *

- * - *

- *      ------------------------------------
- *          Name             Contact
- *      First  Last      Email       Phone
- *      ------------------------------------
- *      Bob    Jones  bob@foo.com   123-4567
- *      John   Doe    john@foo.com  456-7890
- * 
+ * int i; + * for (String[] countryData : myData) { + * i = 0; + * for (final MultiColumnPrinter.Column column : printer.getColumns()) { + * printer.printData(countryData[i++]); + * } + * } + * } + *
+ *

+ * The following code sample presents how to create a {@link MultiColumnPrinter} to write CSV data: + *

+ * final List columns = new ArrayList<>();
+ * columns.add(MultiColumnPrinter.column("CountryNameColumnId", "country_name", 0));
+ * columns.add(MultiColumnPrinter.column("populationDensityId", "population_density", 1));
+ * columns.add(MultiColumnPrinter.column("GiniId", "gini", 1));
+ * columns.add(MultiColumnPrinter.column("internetTLDId", "internet_tld", 0));
+ * MultiColumnPrinter myCsvPrinter = MultiColumnPrinter.builder(System.out, columns)
+ *                                                     .columnSeparator(",")
+ *                                                     .build();
+ * printData(myCsvPrinter);
+ * 
+ *

+ * The code above would print: + *

+ * country_name,population_density,gini,internet_tld
+ * U.S.A,34.2,40.8,.us
+ * United Kingdom,261.1,31.6,.uk
+ * France,98.8,30.1,.fr
+ * 
+ *

+ * The following code sample presents how to configure a {@link MultiColumnPrinter} + * to print the same data on console with some title headers. + *

+ *     final List columns = new ArrayList<>();
+ *     columns.add(MultiColumnPrinter.separatorColumn());
+ *     columns.add(MultiColumnPrinter.column("CountryNameColumnId", "Country Name", 15, 0));
+ *     columns.add(MultiColumnPrinter.column("populationDensityId", "Density", 10, 1));
+ *     columns.add(MultiColumnPrinter.separatorColumn());
+ *     columns.add(MultiColumnPrinter.column("GiniID", "GINI", 5, 1));
+ *     columns.add(MultiColumnPrinter.column("internetTLDID", "TLD", 5, 0));
+ *     columns.add(MultiColumnPrinter.separatorColumn());
+ *     MultiColumnPrinter myPrinter = MultiColumnPrinter.builder(System.out, columns)
+ *                                                      .format(true)
+ *                                                      .columnSeparator("  ")
+ *                                                      .titleAlignment(MultiColumnPrinter.Alignment.CENTER)
+ *                                                      .build();
+ *     myPrinter.printDashedLine();
+ *     myPrinter.printTitleSection("General Information", 2);
+ *     myPrinter.printTitleSection("Data", 2);
+ *     myPrinter.printTitleLine();
+ *     myPrinter.printDashedLine();
+ *     printData(myPrinter);
+ *     myPrinter.printDashedLine();
+ * 
+ *

+ * The code above would print: + *

+ * --------------------------------------------------
+ * |       General Information     |       Data     |
+ * |     Country Name     Density  |   GINI    TLD  |
+ * --------------------------------------------------
+ * |            U.S.A        34.2  |   40.8    .us  |
+ * |   United Kingdom       261.1  |   31.6    .uk  |
+ * |           France        98.8  |   30.1    .fr  |
+ * --------------------------------------------------
+ * 
*/ public final class MultiColumnPrinter { - /** Left ID. */ - public static final int LEFT = 0; - /** Center ID. */ - public static final int CENTER = 1; - /** Right ID. */ - public static final int RIGHT = 2; - - private int numCol = 2; - private int gap = 4; - - private int align = CENTER; - private int titleAlign = CENTER; - - private String border; - private final List titleTable = new Vector<>(); - private final List titleSpanTable = new Vector<>(); - private final int[] curLength; + /** The data alignment. */ + public enum Alignment { + /** Data will be left-aligned. */ + LEFT, + /** Data will be centered. */ + CENTER, + /** Data will be right-aligned. */ + RIGHT + } - private final ConsoleApplication app; + private static final String SEPARATOR_ID = "separator"; + private static int separatorIdNumber; /** - * Creates a sorted new MultiColumnPrinter class using LEFT alignment and - * with no title border. + * Returns a new separator {@link Column}. + *

+ * This kind of {@link Column} can be used to separate data sections. * - * @param numCol - * number of columns - * @param gap - * gap between each column - * @param app - * the console application to use for outputting data + * @return A new separator {@link Column}. */ - public MultiColumnPrinter(final int numCol, final int gap, final ConsoleApplication app) { - this(numCol, gap, null, LEFT, app); + public static Column separatorColumn() { + return new Column(SEPARATOR_ID + separatorIdNumber++, "", 1, 0); } /** - * Creates a sorted new MultiColumnPrinter class using LEFT alignment. + * Creates a new {@link Column} with the provided arguments. * - * @param numCol - * number of columns - * @param gap - * gap between each column - * @param border - * character used to frame the titles - * @param app - * the console application to use for outputting data + * @param id + * The column identifier. + * @param title + * The column title. + * @param doublePrecision + * The double precision used to print {@link Double} data for this column. + * See {@link MultiColumnPrinter#printData(Double)}. + * @return + * A new Column with the provided arguments. */ - public MultiColumnPrinter(final int numCol, final int gap, final String border, - final ConsoleApplication app) { - this(numCol, gap, border, LEFT, app); + public static Column column(final String id, final String title, final int doublePrecision) { + return new Column(id, title, 1, doublePrecision); } /** - * Creates a new MultiColumnPrinter class. + * Creates a new Column with the provided arguments. * - * @param numCol - * number of columns - * @param gap - * gap between each column - * @param border - * character used to frame the titles - * @param align - * type of alignment within columns - * @param app - * the console application to use for outputting data + * @param id + * The column identifier. + * @param title + * The column title. + * @param width + * The column width. + * This information will only be used if the associated + * {@link MultiColumnPrinter} is configured to apply formatting. + * See {@link Builder#format(boolean)}. + * @param doublePrecision + * The double precision to use to print data for this column. + * @return + * A new Column with the provided arguments. */ - public MultiColumnPrinter(final int numCol, final int gap, final String border, final int align, - final ConsoleApplication app) { - curLength = new int[numCol]; + public static Column column(final String id, final String title, final int width, final int doublePrecision) { + return new Column(id, title, Math.max(width, title.length()), doublePrecision); + } - this.numCol = numCol; - this.gap = gap; - this.border = border; - this.align = align; - this.titleAlign = LEFT; + /** + * This class describes a Column of data used in the {@link MultiColumnPrinter}. + *

+ * A column consists in the following fields: + *

    + *
  • An identifier for the associated data. + *
  • A title which is printed when {@link MultiColumnPrinter#printTitleLine()} is called. + *
  • A width which is the max width for this column's data. + * This information will only be used if the associated {@link MultiColumnPrinter} + * is configure to apply formatting.See {@link Builder#format(boolean)}. + *
  • A double precision which is the number of decimal to print for numeric data. + * See {@link MultiColumnPrinter#printData(Double)}. + *
+ */ + public static final class Column { + private final String id; + private final String title; + private final int width; + private final int doublePrecision; + + private Column(final String id, final String title, final int width, final int doublePrecision) { + this.id = id; + this.title = title; + this.width = Math.max(width, title.length()); + this.doublePrecision = doublePrecision; + } - this.app = app; + /** + * Returns this {@link Column} identifier. + * + * @return This {@link Column} identifier. + */ + public String getId() { + return id; + } } /** - * Adds to the row of strings to be used as the title for the table. + * Creates a new {@link Builder} to build a {@link MultiColumnPrinter}. * - * @param row - * Array of strings to print in one row of title. + * @param stream + * The {@link PrintStream} to use to print data. + * @param columns + * The {@link List} of {@link Column} data to print. + * @return + * A new {@link Builder} to build a {@link MultiColumnPrinter}. */ - public void addTitle(final String[] row) { - if (row == null) { - return; + public static Builder builder(final PrintStream stream, final List columns) { + return new Builder(stream, columns); + } + + /** A fluent API for incrementally constructing {@link MultiColumnPrinter}. */ + public static final class Builder { + private final PrintStream stream; + private final List columns; + + private Alignment titleAlignment = Alignment.RIGHT; + private String columnSeparator = " "; + private boolean format; + + private Builder(final PrintStream stream, final List columns) { + Reject.ifNull(stream); + this.stream = stream; + this.columns = columns; } - final int[] span = new int[row.length]; - for (int i = 0; i < row.length; i++) { - span[i] = 1; + /** + * Sets whether the {@link MultiColumnPrinter} needs to apply formatting. + *
+ * Default value is {@code false}. + * + * @param format + * {@code true} if the {@link MultiColumnPrinter} needs to apply formatting. + * @return This builder. + */ + public Builder format(final boolean format) { + this.format = format; + return this; } - addTitle(row, span); + /** + * Sets the alignment for title elements which will be printed by the {@link MultiColumnPrinter}. + *

+ * This is used only if the printer is configured to + * apply formatting, see {@link Builder#format(boolean)}. + *
+ * Default value is {@link Alignment#RIGHT}. + * + * @param titleAlignment + * The title alignment. + * @return This builder. + */ + public Builder titleAlignment(final Alignment titleAlignment) { + this.titleAlignment = titleAlignment; + return this; + } + + /** + * Sets the sequence to use to separate column. + *

+ * Default value is {@code " "}. + * + * @param separator + * The sequence {@link String}. + * @return This builder. + */ + public Builder columnSeparator(final String separator) { + this.columnSeparator = separator; + return this; + } + + /** + * Creates a new {@link MultiColumnPrinter} as configured in this {@link Builder}. + * + * @return A new {@link MultiColumnPrinter} as configured in this {@link Builder}. + */ + public MultiColumnPrinter build() { + return new MultiColumnPrinter(this); + } + } + + private final PrintStream stream; + private final List columns; + private final boolean format; + private final Alignment titleAlignment; + private final String columnSeparator; + + private List printableColumns; + private final int lineLength; + private Iterator columnIterator; + private Column currentColumn; + + private MultiColumnPrinter(final Builder builder) { + this.stream = builder.stream; + this.columns = Collections.unmodifiableList(builder.columns); + this.format = builder.format; + this.columnSeparator = builder.columnSeparator; + this.titleAlignment = builder.titleAlignment; + this.lineLength = computeLineLength(); + resetIterator(); + computePrintableColumns(); + } + + /** Prints a dashed line. */ + public void printDashedLine() { + startNewLineIfNeeded(); + for (int i = 0; i < lineLength; i++) { + stream.print('-'); + } + stream.println(); } /** - * Adds to the row of strings to be used as the title for the table. Also - * allows for certain title strings to span multiple columns The span - * parameter is an array of integers which indicate how many columns the - * corresponding title string will occupy. For a row that is 4 columns - * wide, it is possible to have some title strings in a row to 'span' - * multiple columns: - *

- * - *

-     * ------------------------------------
-     *     Name             Contact
-     * First  Last      Email       Phone
-     * ------------------------------------
-     * Bob    Jones  bob@foo.com   123-4567
-     * John   Doe    john@foo.com  456-7890
-     * 
- * - * In the example above, the title row has a string 'Name' that spans 2 - * columns. The string 'Contact' also spans 2 columns. The above is done - * by passing in to addTitle() an array that contains: + * Formats and prints the provided text data. + * Merge the provided text over the provided number of column. + *

+ * Separator columns between merged columns will not be printed. * - *

-     * span[0] = 2; // spans 2 columns
-     * span[1] = 0; // spans 0 columns, ignore
-     * span[2] = 2; // spans 2 columns
-     * span[3] = 0; // spans 0 columns, ignore
-     * 
- *

- * A span value of 1 is the default. The method addTitle(String[] row) - * basically does: - * - *

-     * int[] span = new int[row.length];
-     * for (int i = 0; i < row.length; i++) {
-     *     span[i] = 1;
-     * }
-     * addTitle(row, span);
-     * 
- * - * @param row - * Array of strings to print in one row of title. - * @param span - * Array of integers that reflect the number of columns the - * corresponding title string will occupy. + * @param data + * The section title to print. + * @param rowSpan + * Specifies the number of rows a cell should span. */ - public void addTitle(final String[] row, final int[] span) { - // Need to create a new instance of it, otherwise the new values - // will always overwrite the old values. - titleTable.add(Arrays.copyOf(row, row.length)); - titleSpanTable.add(span); + public void printTitleSection(final String data, final int rowSpan) { + consumeSeparatorColumn(); + int lengthToPad = 0; + int nbColumnMerged = 0; + + while (columnIterator.hasNext() && nbColumnMerged < rowSpan) { + lengthToPad += currentColumn.width + columnSeparator.length(); + if (!isSeparatorColumn(currentColumn)) { + nbColumnMerged++; + } + currentColumn = columnIterator.next(); + } + stream.print(align(data, titleAlignment, lengthToPad)); + consumeSeparatorColumn(); + if (!columnIterator.hasNext()) { + nextLine(); + } + } + + /** Prints a line with all column title and separator. */ + public void printTitleLine() { + startNewLineIfNeeded(); + passFirstSeparatorColumn(); + for (final Column column : this.printableColumns) { + printCell(column.title, Alignment.RIGHT); + } } /** - * Clears title strings. + * Prints the provided {@link Double} value on the current column. + *

+ * If this {@link MultiColumnPrinter} is configured to apply formatting, + * the provided value will be truncated according to the decimal + * precision set in the corresponding {@link Column}. + *
+ * See {@link MultiColumnPrinter#column(String, String, int, int)} for more details. + * + * @param value + * The double value to print. */ - public void clearTitle() { - titleTable.clear(); - titleSpanTable.clear(); + public void printData(final Double value) { + passFirstSeparatorColumn(); + printData(value.isNaN() ? "-" + : String.format(Locale.ENGLISH, "%." + currentColumn.doublePrecision + "f", value)); } /** - * Adds one row of text to output. + * Prints the provided text data on the current column. * - * @param row - * Array of strings to print in one row. + * @param data + * The text data to print. */ - public void printRow(final String... row) { - for (int i = 0; i < numCol; i++) { - if (titleAlign == RIGHT) { - final int spaceBefore = curLength[i] - row[i].length(); - printSpaces(spaceBefore); - app.getOutputStream().print(row[i]); - if (i < numCol - 1) { - printSpaces(gap); - } - } else if (align == CENTER) { - int space1, space2; - space1 = (curLength[i] - row[i].length()) / 2; - space2 = curLength[i] - row[i].length() - space1; - - printSpaces(space1); - app.getOutputStream().print(row[i]); - printSpaces(space2); - if (i < numCol - 1) { - printSpaces(gap); - } - } else { - app.getOutputStream().print(row[i]); - if (i < numCol - 1) { - printSpaces(curLength[i] - row[i].length() + gap); - } - } - } - app.getOutputStream().println(""); + public void printData(final String data) { + passFirstSeparatorColumn(); + printCell(data, Alignment.RIGHT); } /** - * Prints the table title. + * Returns the data {@link Column} list of this {@link MultiColumnPrinter}. + *

+ * Separator columns are filtered out. + * + * @return The {@link Column} list of this {@link MultiColumnPrinter}. */ - public void printTitle() { - // Get the longest string for each column and store in curLength[] - - // Scan through title rows - Iterator spanEnum = titleSpanTable.iterator(); - for (String[] row : titleTable) { - final int[] curSpan = spanEnum.next(); - - for (int i = 0; i < numCol; i++) { - // None of the fields should be null, but if it - // happens to be so, replace it with "-". - if (row[i] == null) { - row[i] = "-"; - } - - int len = row[i].length(); - - /* - * If a title string spans multiple columns, then the space it - * occupies in each column is at most len/span (since we have - * gap to take into account as well). - */ - final int span = curSpan[i]; - int rem = 0; - if (span > 1) { - rem = len % span; - len = len / span; - } - - if (curLength[i] < len) { - curLength[i] = len; - - if ((span > 1) && ((i + span) <= numCol)) { - for (int j = i + 1; j < (i + span); ++j) { - curLength[j] = len; - } - - /* - * Add remainder to last column in span to avoid - * round-off errors. - */ - curLength[(i + span) - 1] += rem; - } - } - } + public List getColumns() { + return printableColumns; + } + + private void printCell(final String data, final Alignment alignment) { + String toPrint = format ? align(data, alignment, currentColumn.width) : data; + if (columnIterator.hasNext()) { + toPrint += columnSeparator; } + stream.print(toPrint); + nextLineOnEOLOrNextColumn(); + } - printBorder(); - - spanEnum = titleSpanTable.iterator(); - for (String[] row : titleTable) { - final int[] curSpan = spanEnum.next(); - - for (int i = 0; i < numCol; i++) { - int availableSpace = 0; - final int span = curSpan[i]; - - if (span == 0) { - continue; - } - - availableSpace = curLength[i]; - - if ((span > 1) && ((i + span) <= numCol)) { - for (int j = i + 1; j < (i + span); ++j) { - availableSpace += gap; - availableSpace += curLength[j]; - } - } - - if (titleAlign == RIGHT) { - final int spaceBefore = availableSpace - row[i].length(); - printSpaces(spaceBefore); - app.getOutputStream().print(row[i]); - if (i < numCol - 1) { - printSpaces(gap); - } - } else if (titleAlign == CENTER) { - int spaceBefore, spaceAfter; - spaceBefore = (availableSpace - row[i].length()) / 2; - spaceAfter = availableSpace - row[i].length() - spaceBefore; - - printSpaces(spaceBefore); - app.getOutputStream().print(row[i]); - printSpaces(spaceAfter); - if (i < numCol - 1) { - printSpaces(gap); - } - } else { - app.getOutputStream().print(row[i]); - if (i < numCol - 1) { - printSpaces(availableSpace - row[i].length() + gap); - } - } + /** Provided the provided string data according to the provided width and the provided alignment. */ + private String align(final String data, final Alignment alignment, final int width) { + final String rawData = data.trim(); + final int padding = width - rawData.length(); - } - app.getOutputStream().println(""); + if (padding <= 0) { + return rawData; + } + + switch (alignment) { + case RIGHT: + return pad(padding, rawData, 0); + case LEFT: + return pad(0, rawData, padding); + case CENTER: + final int paddingBefore = padding / 2; + return pad(paddingBefore, rawData, padding - paddingBefore); + default: + return ""; } - printBorder(); } - /** - * Set alignment for title strings. - * - * @param titleAlign - * The alignment which should be one of {@code LEFT}, - * {@code RIGHT}, or {@code CENTER}. - */ - public void setTitleAlign(final int titleAlign) { - this.titleAlign = titleAlign; + private String pad(final int leftPad, final String s, final int rightPad) { + return new StringBuilder().append(repeat(' ', leftPad)) + .append(s) + .append(repeat(' ', rightPad)) + .toString(); } - private void printBorder() { - if (border == null) { - return; + private void passFirstSeparatorColumn() { + if (cursorOnLineStart()) { + consumeSeparatorColumn(); } + } - // For the value in each column - for (int i = 0; i < numCol; i++) { - for (int j = 0; j < curLength[i]; j++) { - app.getOutputStream().print(border); - } + private void consumeSeparatorColumn() { + if (isSeparatorColumn(currentColumn)) { + stream.print('|' + columnSeparator); + nextLineOnEOLOrNextColumn(); + } + } + + private void startNewLineIfNeeded() { + if (!cursorOnLineStart()) { + nextLine(); } + } + + private void nextLineOnEOLOrNextColumn() { + if (columnIterator.hasNext()) { + currentColumn = columnIterator.next(); + consumeSeparatorColumn(); + } else { + nextLine(); + } + } + + private void nextLine() { + stream.println(); + resetIterator(); + } + + private void resetIterator() { + columnIterator = columns.iterator(); + currentColumn = columnIterator.next(); + } + + private boolean cursorOnLineStart() { + return currentColumn == columns.get(0); + } + + private boolean isSeparatorColumn(final Column column) { + return column.id.startsWith(SEPARATOR_ID); + } + + private void computePrintableColumns() { + printableColumns = new ArrayList<>(columns); + final Iterator it = printableColumns.iterator(); - // For the gap between each column - for (int i = 0; i < numCol - 1; i++) { - for (int j = 0; j < gap; j++) { - app.getOutputStream().print(border); + while (it.hasNext()) { + if (isSeparatorColumn(it.next())) { + it.remove(); } } - app.getOutputStream().println(""); } - private void printSpaces(final int count) { - for (int i = 0; i < count; ++i) { - app.getOutputStream().print(" "); + private int computeLineLength() { + int lineLength = 0; + final int separatorLength = this.columnSeparator.length(); + for (final Column column : this.columns) { + lineLength += column.width + separatorLength; } + return lineLength - separatorLength; } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java index a7d4a7319..217e8496f 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/PromptingTrustManager.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008-2010 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2008-2010 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -54,9 +44,7 @@ * 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()), @@ -64,7 +52,6 @@ private static enum TrustOption { CERTIFICATE_DETAILS(4, INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS.get()); private Integer choice; - private LocalizableMessage msg; /** @@ -152,11 +139,8 @@ public PromptingTrustManager(final ConsoleApplication app, final String accepted if (!onDiskTrustStorePath.exists()) { onDiskTrustStore.load(null, null); } else { - final FileInputStream fos = new FileInputStream(onDiskTrustStorePath); - try { + try (final FileInputStream fos = new FileInputStream(onDiskTrustStorePath)) { onDiskTrustStore.load(fos, DEFAULT_PASSWORD); - } finally { - fos.close(); } } final TrustManagerFactory tmf = @@ -212,7 +196,7 @@ public PromptingTrustManager(final ConsoleApplication app, final X509TrustManage this(app, DEFAULT_PATH, sourceTrustManager); } - /** {@inheritDoc} */ + @Override public void checkClientTrusted(final X509Certificate[] x509Certificates, final String s) throws CertificateException { try { @@ -234,7 +218,7 @@ public void checkClientTrusted(final X509Certificate[] x509Certificates, final S } } - /** {@inheritDoc} */ + @Override public void checkServerTrusted(final X509Certificate[] x509Certificates, final String s) throws CertificateException { try { @@ -256,7 +240,7 @@ public void checkServerTrusted(final X509Certificate[] x509Certificates, final S } } - /** {@inheritDoc} */ + @Override public X509Certificate[] getAcceptedIssuers() { if (nestedTrustManager != null) { return nestedTrustManager.getAcceptedIssuers(); @@ -295,9 +279,9 @@ private void acceptCertificate(final X509Certificate[] chain, final boolean perm if (!truststoreFile.exists()) { createFile(truststoreFile); } - final FileOutputStream fos = new FileOutputStream(truststoreFile); - onDiskTrustStore.store(fos, DEFAULT_PASSWORD); - fos.close(); + try (final FileOutputStream fos = new FileOutputStream(truststoreFile)) { + onDiskTrustStore.store(fos, DEFAULT_PASSWORD); + } } catch (final Exception e) { LOG.warn(LocalizableMessage.raw("Error saving store to disk: " + e)); } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java index 5dc1a8d0d..b654eee1d 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ReturnCode.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2015 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/StringArgument.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/StringArgument.java index 7c5fb6d0c..0919be448 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/StringArgument.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/StringArgument.java @@ -1,135 +1,60 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; -import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizableMessageBuilder; -/** - * This class defines an argument type that will accept any string value. - */ +/** This class defines an argument type that will accept any string value. */ public final class StringArgument extends Argument { /** - * Creates a new string argument with the provided information. + * Returns a builder which can be used for incrementally constructing a new + * {@link StringArgument}. * * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param isMultiValued - * Indicates whether this argument may be specified more than - * once to provide multiple values. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param defaultValue - * The default value that should be used for this argument if - * none is provided in a properties file or on the command line. - * This may be null if there is no generic default. - * @param propertyName - * The name of the property in a property file that may be used - * to override the default value but will be overridden by a - * command-line argument. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. + * The generic name that will be used to refer to this argument. + * @return A builder to continue building the {@link StringArgument}. */ - public StringArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean isMultiValued, - final boolean needsValue, final LocalizableMessage valuePlaceholder, - final String defaultValue, final String propertyName, - final LocalizableMessage description) throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, isMultiValued, needsValue, - valuePlaceholder, defaultValue, propertyName, description); + public static Builder builder(final String name) { + return new Builder(name); } - /** - * Creates a new string argument with the provided information. - * - * @param name - * The generic name that should be used to refer to this - * argument. - * @param shortIdentifier - * The single-character identifier for this argument, or - * null if there is none. - * @param longIdentifier - * The long identifier for this argument, or null if - * there is none. - * @param isRequired - * Indicates whether this argument must be specified on the - * command line. - * @param needsValue - * Indicates whether this argument requires a value. - * @param valuePlaceholder - * The placeholder for the argument value that will be displayed - * in usage information, or null if this argument - * does not require a value. - * @param description - * LocalizableMessage for the description of this argument. - * @throws ArgumentException - * If there is a problem with any of the parameters used to - * create this argument. - */ - public StringArgument(final String name, final Character shortIdentifier, - final String longIdentifier, final boolean isRequired, final boolean needsValue, - final LocalizableMessage valuePlaceholder, final LocalizableMessage description) - throws ArgumentException { - super(name, shortIdentifier, longIdentifier, isRequired, false, needsValue, - valuePlaceholder, null, null, description); + /** A fluent API for incrementally constructing {@link StringArgument}. */ + public static final class Builder extends ArgumentBuilder { + private Builder(final String name) { + super(name); + } + + @Override + Builder getThis() { + return this; + } + + @Override + public StringArgument buildArgument() throws ArgumentException { + return new StringArgument(this); + } + } + + private StringArgument(final Builder builder) throws ArgumentException { + super(builder); } - /** - * Indicates whether the provided value is acceptable for use in this - * argument. - * - * @param valueString - * The value for which to make the determination. - * @param invalidReason - * A buffer into which the invalid reason may be written if the - * value is not acceptable. - * @return true if the value is acceptable, or - * false if it is not. - */ @Override - public boolean valueIsAcceptable(final String valueString, - final LocalizableMessageBuilder invalidReason) { + public boolean valueIsAcceptable(final String valueString, final LocalizableMessageBuilder invalidReason) { // All values will be acceptable for this argument. return true; } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommand.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommand.java index c26ba9fa8..e6d3c82d3 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommand.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommand.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS. + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -69,10 +59,7 @@ public class SubCommand implements DocDescriptionSupplement { /** 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; /** @@ -166,12 +153,17 @@ public LocalizableMessage getDescription() { */ private LocalizableMessage docDescriptionSupplement; - /** {@inheritDoc} */ + @Override public LocalizableMessage getDocDescriptionSupplement() { return docDescriptionSupplement != null ? docDescriptionSupplement : LocalizableMessage.EMPTY; } - /** {@inheritDoc} */ + /** + * Sets a supplement to the description intended for use in generated reference documentation. + * + * @param docDescriptionSupplement + * The supplement to the description for use in generated reference documentation. + */ public void setDocDescriptionSupplement(final LocalizableMessage docDescriptionSupplement) { this.docDescriptionSupplement = docDescriptionSupplement; } @@ -208,20 +200,15 @@ public Argument getArgument(String longID) { } /** - * Retrieves the subcommand argument with the specified name. + * Retrieves the subcommand argument with the specified long identifier. * - * @param name - * The name of the argument to retrieve. - * @return The subcommand argument with the specified name, or null if there is no such argument. + * @param longIdentifier + * The long identifier of the argument to retrieve. + * @return The subcommand argument with the specified long identifier, + * or null if there is no such argument. */ - public Argument getArgumentForName(String name) { - for (Argument a : arguments) { - if (a.getName().equals(name)) { - return a; - } - } - - return null; + public Argument getArgumentForLongIdentifier(final String longIdentifier) { + return longIDMap.get(parser.longArgumentsCaseSensitive() ? longIdentifier : toLowerCase(longIdentifier)); } /** @@ -234,53 +221,40 @@ public Argument getArgumentForName(String name) { * associated with this subcommand. */ public void addArgument(Argument argument) throws ArgumentException { - String argumentName = argument.getName(); - for (Argument a : arguments) { - if (argumentName.equals(a.getName())) { - LocalizableMessage message = ERR_ARG_SUBCOMMAND_DUPLICATE_ARGUMENT_NAME.get(name, argumentName); - throw new ArgumentException(message); - } + final String argumentLongID = argument.getLongIdentifier(); + if (getArgumentForLongIdentifier(argumentLongID) != null) { + throw new ArgumentException(ERR_ARG_SUBCOMMAND_DUPLICATE_ARGUMENT_NAME.get(name, argumentLongID)); } - if (parser.hasGlobalArgument(argumentName)) { - LocalizableMessage message = ERR_ARG_SUBCOMMAND_ARGUMENT_GLOBAL_CONFLICT.get(argumentName, name); - throw new ArgumentException(message); + if (parser.hasGlobalArgument(argumentLongID)) { + throw new ArgumentException(ERR_ARG_SUBCOMMAND_ARGUMENT_GLOBAL_CONFLICT.get(argumentLongID, name)); } Character shortID = argument.getShortIdentifier(); if (shortID != null) { if (shortIDMap.containsKey(shortID)) { - LocalizableMessage message = ERR_ARG_SUBCOMMAND_DUPLICATE_SHORT_ID.get(argumentName, name, - String.valueOf(shortID), shortIDMap.get(shortID).getName()); - throw new ArgumentException(message); + throw new ArgumentException(ERR_ARG_SUBCOMMAND_DUPLICATE_SHORT_ID.get( + argumentLongID, name, String.valueOf(shortID), shortIDMap.get(shortID).getLongIdentifier())); } Argument arg = parser.getGlobalArgumentForShortID(shortID); if (arg != null) { - LocalizableMessage message = ERR_ARG_SUBCOMMAND_ARGUMENT_SHORT_ID_GLOBAL_CONFLICT.get(argumentName, - name, String.valueOf(shortID), arg.getName()); - throw new ArgumentException(message); + throw new ArgumentException(ERR_ARG_SUBCOMMAND_ARGUMENT_SHORT_ID_GLOBAL_CONFLICT.get( + argumentLongID, name, String.valueOf(shortID), arg.getLongIdentifier())); } } String longID = argument.getLongIdentifier(); - if (longID != null) { - if (!parser.longArgumentsCaseSensitive()) { - longID = toLowerCase(longID); - } - + if (!parser.longArgumentsCaseSensitive()) { + longID = toLowerCase(longID); if (longIDMap.containsKey(longID)) { - LocalizableMessage message = ERR_ARG_SUBCOMMAND_DUPLICATE_LONG_ID.get(argumentName, name, - argument.getLongIdentifier(), longIDMap.get(longID).getName()); - throw new ArgumentException(message); + throw new ArgumentException(ERR_ARG_SUBCOMMAND_DUPLICATE_LONG_ID.get(argumentLongID, name)); } + } - Argument arg = parser.getGlobalArgumentForLongID(longID); - if (arg != null) { - LocalizableMessage message = ERR_ARG_SUBCOMMAND_ARGUMENT_LONG_ID_GLOBAL_CONFLICT.get(argumentName, - name, argument.getLongIdentifier(), arg.getName()); - throw new ArgumentException(message); - } + Argument arg = parser.getGlobalArgumentForLongID(longID); + if (arg != null) { + throw new ArgumentException(ERR_ARG_SUBCOMMAND_ARGUMENT_LONG_ID_GLOBAL_CONFLICT.get(argumentLongID, name)); } arguments.add(argument); @@ -365,7 +339,6 @@ public void setHidden(boolean isHidden) { this.isHidden = isHidden; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder sb = new StringBuilder(); diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java index 56788b033..f2a5440e1 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -99,15 +89,6 @@ public SubCommandArgumentParser(String mainClassName, LocalizableMessage toolDes super(mainClassName, toolDescription, longArgumentsCaseSensitive); } - /** - * Retrieves the list of all global arguments that have been defined for this argument parser. - * - * @return The list of all global arguments that have been defined for this argument parser. - */ - public List getGlobalArgumentList() { - return globalArgumentList; - } - /** * Indicates whether this argument parser contains a global argument with the specified name. * @@ -119,38 +100,6 @@ public boolean hasGlobalArgument(String argumentName) { return globalArgumentMap.containsKey(argumentName); } - /** - * Retrieves the global argument with the specified name. - * - * @param name - * The name of the global argument to retrieve. - * @return The global argument with the specified name, or null if there is no such argument. - */ - public Argument getGlobalArgument(String name) { - return globalArgumentMap.get(name); - } - - /** - * Retrieves the set of global arguments mapped by the short identifier that may be used to reference them. Note - * that arguments that do not have a short identifier will not be present in this list. - * - * @return The set of global arguments mapped by the short identifier that may be used to reference them. - */ - public Map getGlobalArgumentsByShortID() { - return globalShortIDMap; - } - - /** - * Indicates whether this argument parser has a global argument with the specified short ID. - * - * @param shortID - * The short ID character for which to make the determination. - * @return true if a global argument exists with the specified short ID, or false if not. - */ - public boolean hasGlobalArgumentWithShortID(Character shortID) { - return globalShortIDMap.containsKey(shortID); - } - /** * Retrieves the global argument with the specified short identifier. * @@ -163,27 +112,6 @@ public Argument getGlobalArgumentForShortID(Character shortID) { return globalShortIDMap.get(shortID); } - /** - * Retrieves the set of global arguments mapped by the long identifier that may be used to reference them. Note that - * arguments that do not have a long identifier will not be present in this list. - * - * @return The set of global arguments mapped by the long identifier that may be used to reference them. - */ - public Map getGlobalArgumentsByLongID() { - return globalLongIDMap; - } - - /** - * Indicates whether this argument parser has a global argument with the specified long ID. - * - * @param longID - * The long ID string for which to make the determination. - * @return true if a global argument exists with the specified long ID, or false if not. - */ - public boolean hasGlobalArgumentWithLongID(String longID) { - return globalLongIDMap.containsKey(longID); - } - /** * Retrieves the global argument with the specified long identifier. * @@ -196,15 +124,6 @@ public Argument getGlobalArgumentForLongID(String longID) { return globalLongIDMap.get(longID); } - /** - * Retrieves the set of subcommands defined for this argument parser, referenced by subcommand name. - * - * @return The set of subcommands defined for this argument parser, referenced by subcommand name. - */ - public SortedMap getSubCommands() { - return subCommands; - } - /** * Indicates whether this argument parser has a subcommand with the specified name. * @@ -278,58 +197,44 @@ public void addLdapConnectionArgument(final Argument argument) throws ArgumentEx * defined. */ public void addGlobalArgument(Argument argument, ArgumentGroup group) throws ArgumentException { - String argumentName = argument.getName(); - if (globalArgumentMap.containsKey(argumentName)) { - throw new ArgumentException(ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_NAME.get(argumentName)); + String longID = argument.getLongIdentifier(); + if (globalArgumentMap.containsKey(longID)) { + throw new ArgumentException(ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_NAME.get(longID)); } for (SubCommand s : subCommands.values()) { - if (s.getArgumentForName(argumentName) != null) { + if (s.getArgumentForLongIdentifier(longID) != null) { throw new ArgumentException(ERR_SUBCMDPARSER_GLOBAL_ARG_NAME_SUBCMD_CONFLICT.get( - argumentName, s.getName())); + longID, s.getName())); } } Character shortID = argument.getShortIdentifier(); if (shortID != null) { if (globalShortIDMap.containsKey(shortID)) { - String name = globalShortIDMap.get(shortID).getName(); - + String conflictingLongID = globalShortIDMap.get(shortID).getLongIdentifier(); throw new ArgumentException(ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_SHORT_ID.get( - shortID, argumentName, name)); + shortID, longID, conflictingLongID)); } for (SubCommand s : subCommands.values()) { if (s.getArgument(shortID) != null) { - String cmdName = s.getName(); - String name = s.getArgument(shortID).getName(); - + String conflictingLongID = s.getArgument(shortID).getLongIdentifier(); throw new ArgumentException(ERR_SUBCMDPARSER_GLOBAL_ARG_SHORT_ID_CONFLICT.get( - shortID, argumentName, name, cmdName)); + shortID, longID, conflictingLongID, s.getName())); } } } - String longID = argument.getLongIdentifier(); - if (longID != null) { - if (!longArgumentsCaseSensitive()) { - longID = toLowerCase(longID); - } - + if (!longArgumentsCaseSensitive()) { + longID = toLowerCase(longID); if (globalLongIDMap.containsKey(longID)) { - String name = globalLongIDMap.get(longID).getName(); - - throw new ArgumentException(ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_LONG_ID.get( - argument.getLongIdentifier(), argumentName, name)); + throw new ArgumentException(ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_LONG_ID.get(longID)); } + } - for (SubCommand s : subCommands.values()) { - if (s.getArgument(longID) != null) { - String cmdName = s.getName(); - String name = s.getArgument(longID).getName(); - - throw new ArgumentException(ERR_SUBCMDPARSER_GLOBAL_ARG_LONG_ID_CONFLICT.get( - argument.getLongIdentifier(), argumentName, name, cmdName)); - } + for (SubCommand s : subCommands.values()) { + if (s.getArgument(longID) != null) { + throw new ArgumentException(ERR_SUBCMDPARSER_GLOBAL_ARG_LONG_ID_CONFLICT.get(longID, s.getName())); } } @@ -350,33 +255,6 @@ public void addGlobalArgument(Argument argument, ArgumentGroup group) throws Arg argumentGroups.add(group); } - /** - * Removes the provided argument from the set of global arguments handled by this parser. - * - * @param argument - * The argument to be removed. - */ - protected void removeGlobalArgument(Argument argument) { - String argumentName = argument.getName(); - globalArgumentMap.remove(argumentName); - - Character shortID = argument.getShortIdentifier(); - if (shortID != null) { - globalShortIDMap.remove(shortID); - } - - String longID = argument.getLongIdentifier(); - if (longID != null) { - if (!longArgumentsCaseSensitive()) { - longID = toLowerCase(longID); - } - - globalLongIDMap.remove(longID); - } - - globalArgumentList.remove(argument); - } - /** * Sets the provided argument as one which will automatically trigger the output of full usage information if it is * provided on the command line and no further argument validation will be performed. @@ -445,7 +323,6 @@ public void setUsageHandler(SubCommandUsageHandler subCommandUsageHandler) { */ @Override public void parseArguments(String[] rawArguments, Properties argumentProperties) throws ArgumentException { - setRawArguments(rawArguments); this.subCommand = null; final ArrayList trailingArguments = getTrailingArguments(); trailingArguments.clear(); @@ -1242,11 +1119,6 @@ private void setSubCommandOptionsInfo(Map map, SubCommand subCom if (a.isHidden()) { continue; } - // Return a generic FQDN for localhost as the default hostname - // in reference documentation. - if (isHostNameArgument(a)) { - a.setDefaultValue("localhost.localdomain"); - } Map option = new HashMap<>(); String optionSynopsis = getOptionSynopsis(a); @@ -1261,7 +1133,8 @@ private void setSubCommandOptionsInfo(Map map, SubCommand subCom // Let this build its own arbitrarily formatted additional info. info.put("usage", subCommandUsageHandler.getArgumentAdditionalInfo(subCommand, a, nameOption)); } else { - String defaultValue = a.getDefaultValue(); + // Return a generic FQDN for localhost as the default hostname in reference documentation. + final String defaultValue = isHostNameArgument(a) ? "localhost.localdomain" : a.getDefaultValue(); info.put("default", defaultValue != null ? REF_DEFAULT.get(defaultValue) : null); // If there is a supplement to the description for this argument, @@ -1338,4 +1211,9 @@ private void appendSubCommandReference(StringBuilder builder, map.put("subcommands", commands); applyTemplate(builder, "dscfgReference.ftl", map); } + + @Override + public void replaceArgument(final Argument argument) { + replaceArgumentInCollections(globalLongIDMap, globalShortIDMap, globalArgumentList, argument); + } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandUsageHandler.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandUsageHandler.java index 8a7bf893d..ff34872a6 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandUsageHandler.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandUsageHandler.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TabSeparatedTablePrinter.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TabSeparatedTablePrinter.java index 68b2275b0..ed425320b 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TabSeparatedTablePrinter.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TabSeparatedTablePrinter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -39,10 +29,7 @@ * a single space. */ public final class TabSeparatedTablePrinter extends TablePrinter { - - /** - * Table serializer implementation. - */ + /** Table serializer implementation. */ private final class Serializer extends TableSerializer { /** * Counts the number of separators that should be output the next time a non-empty cell is displayed. The tab @@ -55,7 +42,6 @@ private Serializer() { // No implementation required. } - /** {@inheritDoc} */ @Override public void addCell(String s) { // Avoid printing tab separators for trailing empty cells. @@ -72,7 +58,6 @@ public void addCell(String s) { writer.print(s.replaceAll("[\\t\\n\\r]", " ")); } - /** {@inheritDoc} */ @Override public void addHeading(String s) { if (displayHeadings) { @@ -80,7 +65,6 @@ public void addHeading(String s) { } } - /** {@inheritDoc} */ @Override public void endHeader() { if (displayHeadings) { @@ -88,25 +72,21 @@ public void endHeader() { } } - /** {@inheritDoc} */ @Override public void endRow() { writer.println(); } - /** {@inheritDoc} */ @Override public void endTable() { writer.flush(); } - /** {@inheritDoc} */ @Override public void startHeader() { requiredSeparators = 0; } - /** {@inheritDoc} */ @Override public void startRow() { requiredSeparators = 0; @@ -150,10 +130,8 @@ public void setDisplayHeadings(boolean displayHeadings) { this.displayHeadings = displayHeadings; } - /** {@inheritDoc} */ @Override protected TableSerializer getSerializer() { return new Serializer(); } - } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableBuilder.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableBuilder.java index 11b1a333a..984b49ef8 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableBuilder.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableBuilder.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -266,7 +256,7 @@ public void print(TablePrinter printer) { List> sortedRows = new ArrayList<>(rows); Comparator> comparator = new Comparator>() { - + @Override public int compare(List row1, List row2) { for (int i = 0; i < sortKeys.size(); i++) { String cell1 = row1.get(sortKeys.get(i)); @@ -281,7 +271,6 @@ public int compare(List row1, List row2) { // Both rows are equal. return 0; } - }; Collections.sort(sortedRows, comparator); diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TablePrinter.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TablePrinter.java index b54cd4cca..13fef0e73 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TablePrinter.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TablePrinter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableSerializer.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableSerializer.java index 384672595..430233d01 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableSerializer.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TableSerializer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TextTablePrinter.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TextTablePrinter.java index 78b3833f4..f7fce40cb 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/TextTablePrinter.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/TextTablePrinter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2007-2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2007-2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -42,12 +32,8 @@ * Tables have configurable column widths, padding, and column separators. */ public final class TextTablePrinter extends TablePrinter { - - /** - * Table serializer implementation. - */ + /** Table serializer implementation. */ private final class Serializer extends TableSerializer { - /**The real column widths taking into account size constraints but not including padding or separators.*/ private final List columnWidths = new ArrayList<>(); @@ -71,20 +57,17 @@ private Serializer() { this.indentPadding = builder.toString(); } - /** {@inheritDoc} */ @Override public void addCell(String s) { currentRow.add(s); } - /** {@inheritDoc} */ @Override public void addColumn(int width) { columnWidths.add(width); totalColumns++; } - /** {@inheritDoc} */ @Override public void addHeading(String s) { if (displayHeadings) { @@ -92,7 +75,6 @@ public void addHeading(String s) { } } - /** {@inheritDoc} */ @Override public void endHeader() { if (displayHeadings) { @@ -133,7 +115,6 @@ public void endHeader() { } } - /** {@inheritDoc} */ @Override public void endRow() { boolean isRemainingText; @@ -158,7 +139,6 @@ public void endRow() { endIndex = width; head = contents.substring(0, endIndex); tail = contents.substring(endIndex); - } else { head = contents.substring(0, endIndex); tail = contents.substring(endIndex + 1); @@ -204,24 +184,20 @@ public void endRow() { // Output the line. writer.println(builder.toString()); - } while (isRemainingText); } - /** {@inheritDoc} */ @Override public void endTable() { writer.flush(); } - /** {@inheritDoc} */ @Override public void startHeader() { determineColumnWidths(); currentRow.clear(); } - /** {@inheritDoc} */ @Override public void startRow() { currentRow.clear(); @@ -312,10 +288,7 @@ private void determineColumnWidths() { /** The number of characters the table should be indented. */ private int indentWidth; - /** - * The character which should be used to separate the table - * heading row from the rows beneath. - */ + /** The character which should be used to separate the table heading row from the rows beneath. */ private char headingSeparator = DEFAULT_HEADING_SEPARATOR; /** The column where the heading separator should begin. */ @@ -327,10 +300,7 @@ private void determineColumnWidths() { */ private int padding = DEFAULT_PADDING; - /** - * Total permitted width for the table which expandable columns - * can use up. - */ + /** Total permitted width for the table which expandable columns can use up. */ private int totalWidth = MAX_LINE_WIDTH; /** The output destination. */ @@ -472,7 +442,6 @@ public void setTotalWidth(int totalWidth) { this.totalWidth = totalWidth; } - /** {@inheritDoc} */ @Override protected TableSerializer getSerializer() { return new Serializer(); diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolRefDocContainer.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolRefDocContainer.java index 08676d850..8a6f35d6f 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolRefDocContainer.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolRefDocContainer.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java new file mode 100644 index 000000000..cbb713e14 --- /dev/null +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ToolVersionHandler.java @@ -0,0 +1,83 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2015-2016 ForgeRock AS. + */ +package com.forgerock.opendj.cli; + +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Enumeration; +import java.util.jar.Attributes; +import java.util.jar.Manifest; + +/** Class that prints the version of the SDK to System.out. */ +public final class ToolVersionHandler implements VersionHandler { + + /** + * Returns a {@link VersionHandler} which should be used by OpenDJ SDK tools. + *

+ * The printed version and SCM revision will be the one of the opendj-core module. + * @return A {@link VersionHandler} which should be used by OpenDJ SDK tools. + */ + public static VersionHandler newSdkVersionHandler() { + return newToolVersionHandler("opendj-core"); + } + + /** + * Returns a {@link VersionHandler} which should be used to print version and SCM revision of a module. + *

+ * The printed version and SCM revision will be read from the module MANIFEST.MF‌ file. + * @param moduleName + * Name of the module which uniquely identify the URL of the MANIFEST‌.MF file. + * @return A {@link VersionHandler} which should be used by OpenDJ SDK tools. + */ + public static VersionHandler newToolVersionHandler(final String moduleName) { + return new ToolVersionHandler(moduleName); + } + + private final String moduleName; + + private ToolVersionHandler(final String moduleName) { + this.moduleName = moduleName; + } + + @Override + public void printVersion() { + System.out.println(getVersion()); + } + + @Override + public String toString() { + return getClass().getSimpleName() + "(" + getVersion() + ")"; + } + + private String getVersion() { + try { + final Enumeration manifests = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF"); + while (manifests.hasMoreElements()) { + final URL manifestUrl = manifests.nextElement(); + if (manifestUrl.toString().contains(moduleName)) { + try (InputStream manifestStream = manifestUrl.openStream()) { + final Attributes attrs = new Manifest(manifestStream).getMainAttributes(); + return attrs.getValue("Bundle-Version") + " (revision " + attrs.getValue("SCM-Revision") + ")"; + } + } + } + return null; + } catch (IOException e) { + throw new RuntimeException("IOException while determining opendj tool version", e); + } + } +} diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java index 28cafe9dc..0bff591bd 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/Utils.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -40,6 +30,8 @@ import java.net.UnknownHostException; import java.security.GeneralSecurityException; import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Collection; import java.util.Date; import java.util.StringTokenizer; import java.util.TimeZone; @@ -161,13 +153,10 @@ public static int filterExitCode(final int exitCode) { * If a problem occurs while trying to read the specified file. */ public static byte[] readBytesFromFile(final String filePath) throws IOException { - byte[] val = null; - FileInputStream fis = null; - try { - final File file = new File(filePath); - fis = new FileInputStream(file); - final long length = file.length(); - val = new byte[(int) length]; + final File file = new File(filePath); + final long length = file.length(); + try (FileInputStream fis = new FileInputStream(file)) { + byte[] val = new byte[(int) length]; // Read in the bytes int offset = 0; int numRead = 0; @@ -182,10 +171,6 @@ public static byte[] readBytesFromFile(final String filePath) throws IOException } return val; - } finally { - if (fis != null) { - fis.close(); - } } } @@ -626,4 +611,130 @@ public static void printWrappedText(final PrintStream stream, final String messa public static void printWrappedText(final PrintStream stream, final LocalizableMessage message) { printWrappedText(stream, message != null ? message.toString() : null); } + + /** + * Repeats the given {@link char} n times. + * + * @param charToRepeat + * The {@link char} to repeat. + * @param length + * The repetition count. + * @return The given {@link char} n times. + */ + public static String repeat(final char charToRepeat, final int length) { + final char[] str = new char[length]; + Arrays.fill(str, charToRepeat); + return new String(str); + } + + /** + * Return a {@link ValidationCallback} which can be used to validate a port number. + * + * @param defaultPort + * The default value to suggest to the user. + * @return a {@link ValidationCallback} which can be used to validate a port number. + */ + public static ValidationCallback portValidationCallback(final int defaultPort) { + return new ValidationCallback() { + @Override + public Integer validate(ConsoleApplication app, String rawInput) throws ClientException { + final String input = rawInput.trim(); + if (input.length() == 0) { + return defaultPort; + } + + try { + int i = Integer.parseInt(input); + if (i < 1 || i > 65535) { + throw new NumberFormatException(); + } + return i; + } catch (NumberFormatException e) { + // Try again... + app.println(); + app.println(ERR_BAD_PORT_NUMBER.get(input)); + app.println(); + return null; + } + } + }; + } + + /** + * Throws an {@link ArgumentException} if both provided {@link Argument} are presents in the command line arguments. + * + * @param arg1 + * The first {@link Argument} which should not be present if {@literal arg2} is. + * @param arg2 + * The second {@link Argument} which should not be present if {@literal arg1} is. + * @throws ArgumentException + * If both provided {@link Argument} are presents in the command line arguments + */ + public static void throwIfArgumentsConflict(final Argument arg1, final Argument arg2) throws ArgumentException { + if (argsConflicts(arg1, arg2)) { + throw new ArgumentException(conflictingArgsErrorMessage(arg1, arg2)); + } + } + + /** + * Adds a {@link LocalizableMessage} to the provided {@link Collection} + * if both provided {@link Argument} are presents in the command line arguments. + * + * @param errors + * The {@link Collection} to use to add the conflict error (if occurs). + * @param arg1 + * The first {@link Argument} which should not be present if {@literal arg2} is. + * @param arg2 + * The second {@link Argument} which should not be present if {@literal arg1} is. + */ + public static void addErrorMessageIfArgumentsConflict( + final Collection errors, final Argument arg1, final Argument arg2) { + if (argsConflicts(arg1, arg2)) { + errors.add(conflictingArgsErrorMessage(arg1, arg2)); + } + } + + /** + * Return {@code true} if provided {@link Argument} are presents in the command line arguments. + *

+ * If so, adds a {@link LocalizableMessage} to the provided {@link LocalizableMessageBuilder}. + * + * @param builder + * The {@link LocalizableMessageBuilder} to use to write the conflict error (if occurs). + * @param arg1 + * The first {@link Argument} which should not be present if {@literal arg2} is. + * @param arg2 + * The second {@link Argument} which should not be present if {@literal arg1} is. + * @return {@code true} if provided {@link Argument} are presents in the command line arguments. + */ + public static boolean appendErrorMessageIfArgumentsConflict( + final LocalizableMessageBuilder builder, final Argument arg1, final Argument arg2) { + if (argsConflicts(arg1, arg2)) { + if (builder.length() > 0) { + builder.append(LINE_SEPARATOR); + } + builder.append(conflictingArgsErrorMessage(arg1, arg2)); + return true; + } + return false; + } + + private static boolean argsConflicts(final Argument arg1, final Argument arg2) { + return arg1.isPresent() && arg2.isPresent(); + } + + /** + * Returns a {@link LocalizableMessage} which explains to the user + * that provided {@link Argument}s can not be used together on the command line. + * + * @param arg1 + * The first {@link Argument} which conflicts with {@literal arg2}. + * @param arg2 + * The second {@link Argument} which conflicts with {@literal arg1}. + * @return A {@link LocalizableMessage} which explains to the user that arguments + * can not be used together on the command line. + */ + public static LocalizableMessage conflictingArgsErrorMessage(final Argument arg1, final Argument arg2) { + return ERR_TOOL_CONFLICTING_ARGS.get(arg1.getLongIdentifier(), arg2.getLongIdentifier()); + } } diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ValidationCallback.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ValidationCallback.java index da888119a..6220950f6 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ValidationCallback.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ValidationCallback.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/VersionHandler.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/VersionHandler.java index e31166c9a..6cc220fa8 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/VersionHandler.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/VersionHandler.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/package-info.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/package-info.java index a6ff22aeb..c8e38fa2b 100644 --- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/package-info.java +++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/package-info.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014 ForgeRock AS. */ /** * Classes implementing the OpenDJ CLI shared APIs. diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties old mode 100755 new mode 100644 index 956028e9b..9b3c3527d --- a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli.properties @@ -1,34 +1,18 @@ # -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2014-2015 ForgeRock AS. -# -# -# CLI messages -# -ERR_ARG_NO_IDENTIFIER=The %s argument does not have either a \ - single-character or a long identifier that may be used to specify it. At \ - least one of these must be specified for each argument +# Copyright 2014-2016 ForgeRock AS. + ERR_ARG_NO_VALUE_PLACEHOLDER=The %s argument is configured to take \ a value but no value placeholder has been defined for it ERR_ARG_NO_INT_VALUE=The %s argument does not have any value that \ @@ -37,18 +21,6 @@ ERR_ARG_CANNOT_DECODE_AS_INT=The provided value "%s" for the %s \ argument cannot be decoded as an integer ERR_ARG_INT_MULTIPLE_VALUES=The %s argument has multiple values and \ therefore cannot be decoded as a single integer value -ERR_ARG_NO_DOUBLE_VALUE=The %s argument does not have any value that \ - may be retrieved as a double -ERR_ARG_CANNOT_DECODE_AS_DOUBLE=The provided value "%s" for the %s \ - argument cannot be decoded as a double -ERR_ARG_DOUBLE_MULTIPLE_VALUES=The %s argument has multiple values and \ - therefore cannot be decoded as a single double value -ERR_ARG_NO_BOOLEAN_VALUE=The %s argument does not have any value \ - that may be retrieved as a Boolean -ERR_ARG_CANNOT_DECODE_AS_BOOLEAN=The provided value "%s" for the %s \ - argument cannot be decoded as a Boolean -ERR_ARG_BOOLEAN_MULTIPLE_VALUES=The %s argument has multiple values \ - and therefore cannot be decoded as a single Boolean value ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND=The %s argument \ configuration is invalid because the lower bound of %d is greater than the \ upper bound of %d @@ -75,8 +47,7 @@ ERR_ARGPARSER_DUPLICATE_SHORT_ID=Cannot add argument %s to the \ argument list because its short identifier -%s conflicts with the %s argument \ that has already been defined ERR_ARGPARSER_DUPLICATE_LONG_ID=Cannot add argument %s to the \ - argument list because its long identifier --%s conflicts with the %s argument \ - that has already been defined + argument list because there is already one defined with the same identifier ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE=An error occurred while \ attempting to read the contents of the argument properties file %s: %s ERR_ARGPARSER_TOO_MANY_TRAILING_ARGS=The provided set of \ @@ -123,21 +94,8 @@ INFO_TIME_IN_HOURS_MINUTES_SECONDS=%d hours, %d minutes, %d seconds INFO_TIME_IN_DAYS_HOURS_MINUTES_SECONDS=%d days, %d hours, %d minutes, %d \ seconds INFO_SUBCMDPARSER_WHERE_OPTIONS_INCLUDE=Command options: -ERR_MENU_BAD_CHOICE_SINGLE=Invalid response. Please enter a valid \ -menu option -INFO_MENU_PROMPT_SINGLE=Enter choice: INFO_MENU_PROMPT_RETURN_TO_CONTINUE=Press RETURN to continue ERR_CONSOLE_INPUT_ERROR=The response could not be read from the console due to the following error: %s -INFO_LDAP_CONN_PROMPT_SECURITY_SERVER_CERTIFICATE=Server Certificate: -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE=%s -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION=Do you trust this server certificate? -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_NO=No -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_SESSION=Yes, for this session only -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_ALWAYS=Yes, also add it to a truststore -INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS=View certificate details -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN=User DN : %s -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY=Validity : From '%s'%n To '%s' -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER=Issuer : %s INFO_PROMPT_SINGLE_DEFAULT=%s [%s]: INFO_ARGPARSER_USAGE_JAVA_CLASSNAME=Usage: java %s {options} INFO_ARGPARSER_USAGE_JAVA_SCRIPTNAME=Usage: %s {options} @@ -160,19 +118,6 @@ INFO_SUBCMDPARSER_GLOBAL_HEADING=The global options are: # # Tools messages # -ERR_CANNOT_INITIALIZE_ARGS=An unexpected error occurred while \ - attempting to initialize the command-line arguments: %s -ERR_ERROR_PARSING_ARGS=An error occurred while parsing the \ - command-line arguments: %s -INFO_PROCESSING_OPERATION=Processing %s request for %s -INFO_OPERATION_FAILED=%s operation failed -INFO_OPERATION_SUCCESSFUL=%s operation successful for DN %s -INFO_PROCESSING_COMPARE_OPERATION=Comparing type %s with value %s in \ - entry %s -INFO_COMPARE_OPERATION_RESULT_FALSE=Compare operation returned false for \ - entry %s -INFO_COMPARE_OPERATION_RESULT_TRUE=Compare operation returned true for \ - entry %s INFO_DESCRIPTION_TRUSTALL=Trust all server SSL certificates INFO_DESCRIPTION_BINDDN=DN to use to bind to the server INFO_DESCRIPTION_BINDPASSWORD=Password to use to bind to \ @@ -184,7 +129,6 @@ INFO_DESCRIPTION_ENCODING=Use the specified character set for \ INFO_DESCRIPTION_VERBOSE=Use verbose mode INFO_DESCRIPTION_KEYSTOREPATH=Certificate key store path INFO_DESCRIPTION_TRUSTSTOREPATH=Certificate trust store path -INFO_DESCRIPTION_KEYSTOREPASSWORD=Certificate key store PIN INFO_DESCRIPTION_HOST=Directory server hostname or IP address INFO_DESCRIPTION_PORT=Directory server port number INFO_DESCRIPTION_SHOWUSAGE=Display this usage information @@ -199,205 +143,25 @@ INFO_DESCRIPTION_PROXYAUTHZID=Use the proxied authorization \ control with the given authorization ID INFO_DESCRIPTION_RESTART=Attempt to automatically restart the \ server once it has stopped -INFO_DESCRIPTION_STOP_REASON=Reason the server is being stopped or \ - restarted -INFO_CHECK_STOPPABILITY=Used to determine whether the server can \ - be stopped or not and the mode to be used to stop it -INFO_DESCRIPTION_WINDOWS_NET_STOP=Used by the window service code \ - to inform that stop-ds is being called from the window services after a call \ - to net stop -INFO_DESCRIPTION_STOP_TIME=Indicates the date/time at which the \ - shutdown operation will begin as a server task expressed in format \ - YYYYMMDDhhmmssZ for UTC time or YYYYMMDDhhmmss for local time. A value of \ - '0' will cause the shutdown to be scheduled for \ - immediate execution. When this option is specified the operation will be \ - scheduled to start at the specified time after which this utility will exit \ - immediately -INFO_DESCRIPTION_BACKUP_ALL=Back up all backends in the server -INFO_MODIFY_DESCRIPTION_DEFAULT_ADD=Treat records with no changetype as \ - add operations -INFO_SEARCH_DESCRIPTION_BASEDN=Search base DN -INFO_SEARCH_DESCRIPTION_SIZE_LIMIT=Maximum number of entries to return \ - from the search -INFO_SEARCH_DESCRIPTION_TIME_LIMIT=Maximum length of time in seconds to \ - allow for the search INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE=Search scope ('base', 'one', 'sub', \ or 'subordinate') -INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY=Alias dereference policy \ - ('never', 'always', 'search', or 'find') ERR_LDAPAUTH_UNSUPPORTED_SASL_MECHANISM=The requested SASL mechanism \ "%s" is not supported by this client ERR_LDAPAUTH_SASL_AUTHID_REQUIRED=The "authid" SASL property is \ required for use with the %s mechanism INFO_DESCRIPTION_VERSION=LDAP protocol version number -ERR_DESCRIPTION_INVALID_VERSION=Invalid LDAP version number '%s'. \ - Allowed values are 2 and 3 -ERR_SEARCH_NO_FILTERS=No filters specified for the search request -INFO_DESCRIPTION_DONT_WRAP=Do not wrap long lines INFO_DESCRIPTION_NOOP=Show what would be done but do not perform any \ operation -INFO_DESCRIPTION_TYPES_ONLY=Only retrieve attribute names but not their \ - values -INFO_DESCRIPTION_ASSERTION_FILTER=Use the LDAP assertion control with the \ - provided filter -ERR_LDAP_ASSERTION_INVALID_FILTER=The search filter provided for the \ - LDAP assertion control was invalid: %s -INFO_DESCRIPTION_PREREAD_ATTRS=Use the LDAP ReadEntry pre-read control -INFO_DESCRIPTION_POSTREAD_ATTRS=Use the LDAP ReadEntry post-read control -INFO_LDAPMODIFY_PREREAD_ENTRY=Target entry before the operation: -INFO_LDAPMODIFY_POSTREAD_ENTRY=Target entry after the operation: -INFO_DESCRIPTION_PROXY_AUTHZID=Use the proxied authorization control with \ - the given authorization ID -INFO_DESCRIPTION_PSEARCH_INFO=Use the persistent search control -ERR_PSEARCH_MISSING_DESCRIPTOR=The request to use the persistent \ - search control did not include a descriptor that indicates the options to use \ - with that control -ERR_PSEARCH_DOESNT_START_WITH_PS=The persistent search descriptor %s \ - did not start with the required 'ps' string -ERR_PSEARCH_INVALID_CHANGE_TYPE=The provided change type value %s is \ - invalid. The recognized change types are add, delete, modify, modifydn, and \ - any -ERR_PSEARCH_INVALID_CHANGESONLY=The provided changesOnly value %s is \ - invalid. Allowed values are 1 to only return matching entries that have \ - changed since the beginning of the search, or 0 to also include existing \ - entries that match the search criteria -ERR_PSEARCH_INVALID_RETURN_ECS=The provided returnECs value %s is \ - invalid. Allowed values are 1 to request that the entry change notification \ - control be included in updated entries, or 0 to exclude the control from \ - matching entries INFO_DESCRIPTION_REPORT_AUTHZID=Use the authorization identity control -INFO_BIND_AUTHZID_RETURNED=# Bound with authorization ID %s -INFO_SEARCH_DESCRIPTION_FILENAME=File containing a list of search filter \ - strings -INFO_DESCRIPTION_MATCHED_VALUES_FILTER=Use the LDAP matched values \ - control with the provided filter -ERR_LDAP_MATCHEDVALUES_INVALID_FILTER=The provided matched values \ - filter was invalid: %s -ERR_LDIF_FILE_CANNOT_OPEN_FOR_READ=An error occurred while \ - attempting to open the LDIF file %s for reading: %s -ERR_LDIF_FILE_CANNOT_OPEN_FOR_WRITE=An error occurred while \ - attempting to open the LDIF file %s for writing: %s -ERR_LDIF_FILE_READ_ERROR=An error occurred while attempting to read \ - the contents of LDIF file %s: %s -INFO_BIND_PASSWORD_EXPIRED=# Your password has expired -INFO_BIND_PASSWORD_EXPIRING=# Your password will expire in %s -INFO_BIND_ACCOUNT_LOCKED=# Your account has been locked -INFO_BIND_MUST_CHANGE_PASSWORD=# You must change your password before any \ - other operations will be allowed -INFO_BIND_GRACE_LOGINS_REMAINING=# You have %d grace logins remaining INFO_DESCRIPTION_USE_PWP_CONTROL=Use the password policy request control -INFO_LDAPPWMOD_DESCRIPTION_AUTHZID=Authorization ID for the \ - user entry whose password should be changed -INFO_LDAPPWMOD_DESCRIPTION_NEWPW=New password to provide \ - for the target user -INFO_LDAPPWMOD_DESCRIPTION_NEWPWFILE=Path to a file \ - containing the new password to provide for the target user -INFO_LDAPPWMOD_DESCRIPTION_CURRENTPW=Current password for \ - the target user -INFO_LDAPPWMOD_DESCRIPTION_CURRENTPWFILE=Path to a file \ - containing the current password for the target user -ERR_LDAPPWMOD_CONFLICTING_ARGS=The %s and %s arguments may not be \ - provided together -ERR_LDAPPWMOD_FAILED=The LDAP password modify operation failed: \ - %d (%s) -ERR_LDAPPWMOD_FAILURE_ERROR_MESSAGE=Error Message: %s -ERR_LDAPPWMOD_FAILURE_MATCHED_DN=Matched DN: %s -INFO_LDAPPWMOD_SUCCESSFUL=The LDAP password modify operation was \ - successful -INFO_LDAPPWMOD_ADDITIONAL_INFO=Additional Info: %s -INFO_LDAPPWMOD_GENERATED_PASSWORD=Generated Password: %s -INFO_COMPARE_CANNOT_BASE64_DECODE_ASSERTION_VALUE=The assertion value was \ - indicated to be base64-encoded, but an error occurred while trying to decode \ - the value -INFO_COMPARE_CANNOT_READ_ASSERTION_VALUE_FROM_FILE=Unable to read the \ - assertion value from the specified file: %s -ERR_LDAPCOMPARE_NO_DNS=No entry DNs provided for the compare \ - operation -INFO_LDAPCOMPARE_TOOL_DESCRIPTION=This utility can be used to perform \ - LDAP compare operations in the Directory Server -INFO_LDAPMODIFY_TOOL_DESCRIPTION=This utility can be used to perform LDAP \ - modify, add, delete, and modify DN operations in the Directory Server -INFO_LDAPPWMOD_TOOL_DESCRIPTION=This utility can be used to perform LDAP \ - password modify operations in the Directory Server -INFO_LDAPSEARCH_TOOL_DESCRIPTION=This utility can be used to perform LDAP \ - search operations in the Directory Server ERR_TOOL_CONFLICTING_ARGS=You may not provide both the --%s and \ the --%s arguments -ERR_LDAPCOMPARE_NO_ATTR=No attribute was specified to use as the \ - target for the comparison -ERR_LDAPCOMPARE_INVALID_ATTR_STRING=Invalid attribute string '%s'. \ - The attribute string must be in one of the following forms: \ - 'attribute:value', 'attribute::base64value', or 'attribute: ERR_CANNOT_READ_TRUSTSTORE=Cannot access trust store '%s'. Verify \ that the provided trust store exists and that you have read access rights to it ERR_CANNOT_READ_KEYSTORE=Cannot access key store '%s'. Verify \ that the provided key store exists and that you have read access rights to it INFO_DESCRIPTION_ADMIN_PORT=Directory server administration port number INFO_DESCRIPTION_ADMIN_BINDDN=Administrator user bind DN -ERR_LDAPCOMPARE_ERROR_READING_FILE=An error occurred reading file \ - '%s'. Check that the file exists and that you have read access rights to \ - it. Details: %s -ERR_LDAPCOMPARE_FILENAME_AND_DNS=Both entry DNs and a file name \ - were provided for the compare operation. These arguments are not compatible INFO_ERROR_EMPTY_RESPONSE=ERROR: a response must be provided in order to continue -ERR_DECODE_CONTROL_FAILURE=# %s -INFO_SEARCHRATE_TOOL_DESCRIPTION=This utility can be used to measure \ - search throughput and response time of a directory service using \ - user-defined searches.\n\n\ - Example:\n\n\ \ searchrate -p 1389 -D "cn=directory manager" -w password \\\n\ - \ \ \ \ -F -c 4 -t 4 -b "dc=example,dc=com" -g "rand(0,2000)" "(uid=user.%%d)" -INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN=Base DN format string. -INFO_MODRATE_TOOL_DESCRIPTION=This utility can be used to measure \ - modify throughput and response time of a directory service using \ - user-defined modifications.\n\n\ - Example:\n\n\ \ modrate -p 1389 -D "cn=directory manager" -w password \\\n\ - \ \ \ \ -F -c 4 -t 4 -b "uid=user.%%d,ou=people,dc=example,dc=com" \\\n\ - \ \ \ \ -g "rand(0,2000)" -g "randstr(16)" 'description:%%2$s' -INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN=Target entry DN format string -INFO_AUTHRATE_TOOL_DESCRIPTION=This utility can be used to measure \ - bind throughput and response time of a directory service using \ - user-defined bind or search-then-bind operations.\n\nFormat strings may be \ - used in the bind DN option as well as the authid and authzid SASL bind \ - options. A search operation may be used to retrieve the bind DN by \ - specifying the base DN and a filter. The retrieved entry DN will be appended \ - as the last argument in the argument list when evaluating format strings.\n\n\ - Example (bind only):\n\n\ \ authrate -p 1389 -D "uid=user.%%d,ou=people,dc=example,dc=com" \\\n\ - \ \ \ \ -w password -f -c 10 -g "rand(0,2000)"\n\n\ - Example (search then bind):\n\n\ \ authrate -p 1389 -D '%%2$s' -w password -f -c 10 \\\n\ - \ \ \ \ -b "ou=people,dc=example,dc=com" -s one -g "rand(0,2000)" "(uid=user.%%d)" -INFO_OUTPUT_LDIF_FILE_PLACEHOLDER={file} -INFO_LDIFMODIFY_DESCRIPTION_OUTPUT_FILENAME=Write updated entries to %s \ - instead of stdout -INFO_LDIFDIFF_DESCRIPTION_OUTPUT_FILENAME=Write differences to %s \ - instead of stdout -INFO_LDIFSEARCH_DESCRIPTION_OUTPUT_FILENAME=Write search results to %s \ - instead of stdout -ERR_LDIFMODIFY_MULTIPLE_USES_OF_STDIN=Unable to use stdin for both the source \ - LDIF and changes LDIF -ERR_LDIFDIFF_MULTIPLE_USES_OF_STDIN=Unable to use stdin for both the source \ - LDIF and target LDIF -ERR_LDIFMODIFY_PATCH_FAILED=The changes could not be applied for the following \ - reason: %s -ERR_LDIFDIFF_DIFF_FAILED=The differences could not be computed for the following \ - reason: %s -ERR_LDIFSEARCH_FAILED=The search could not be performed for the following \ - reason: %s -INFO_LDIFMODIFY_TOOL_DESCRIPTION=This utility can be used to apply a set of \ - modify, add, and delete operations to entries contained in an LDIF file -INFO_LDIFDIFF_TOOL_DESCRIPTION=This utility can be used to compare two LDIF \ - files and report the differences in LDIF format -INFO_LDIFSEARCH_TOOL_DESCRIPTION=This utility can be used to perform search \ - operations against entries contained in an LDIF file # # MakeLDIF tool # -INFO_MAKELDIF_TOOL_DESCRIPTION=This utility can be used to generate LDIF \ - data based on a definition in a template file -INFO_CONSTANT_PLACEHOLDER={name=value} -INFO_SEED_PLACEHOLDER={seed} -INFO_BATCH_FILE_PATH_PLACEHOLDER={batchFilePath} -INFO_MAKELDIF_DESCRIPTION_CONSTANT=A constant that overrides the value \ - set in the template file -INFO_MAKELDIF_DESCRIPTION_LDIF=The path to the LDIF file to be written -INFO_MAKELDIF_DESCRIPTION_SEED=The seed to use to initialize the random \ - number generator -INFO_MAKELDIF_DESCRIPTION_HELP=Show this usage information -INFO_MAKELDIF_DESCRIPTION_RESOURCE_PATH=Path to look for \ - MakeLDIF resources (e.g., data files) -ERR_MAKELDIF_NO_SUCH_RESOURCE_DIRECTORY=The specified resource \ - directory %s could not be found -INFO_MAKELDIF_PROCESSED_N_ENTRIES=Processed %d entries -INFO_MAKELDIF_PROCESSING_COMPLETE=LDIF processing complete. %d entries \ - written -ERR_MAKELDIF_EXCEPTION_DURING_PARSE=An error occurred while \ - parsing template file : %s -ERR_MAKELDIF_UNABLE_TO_CREATE_LDIF=An error occurred while \ - attempting to open LDIF file %s for writing: %s -ERR_MAKELDIF_ERROR_WRITING_LDIF=An error occurred while writing data \ - to LDIF file %s: %s -ERR_MAKELDIF_EXCEPTION_DURING_PROCESSING=An error occurred while \ - processing : %s -ERR_CONSTANT_ARG_CANNOT_DECODE=Unable to parse a constant argument, \ - expecting name=value but got %s INFO_DESCRIPTION_QUIET=Use quiet mode INFO_DESCRIPTION_NO_PROMPT=Use non-interactive mode. If data in \ the command is missing, the user is not prompted and the tool will fail @@ -568,8 +221,6 @@ INFO_OPTION_ACCEPT_LICENSE=Automatically accepts the product license \ # # Setup messages # -INFO_SETUP_TITLE=OPENDJ3 Setup tool -INFO_SETUP_DESCRIPTION=This utility can be used to setup the Directory Server INFO_ARGUMENT_DESCRIPTION_CLI=Use the command line install. \ If not specified the graphical interface will be launched. The rest of the \ options (excluding help and version) will only be taken into account if this \ @@ -579,9 +230,6 @@ INFO_ARGUMENT_DESCRIPTION_BASEDN=Base DN for user \ using this option multiple times INFO_ARGUMENT_DESCRIPTION_ADDBASE=Indicates whether to create the base \ entry in the Directory Server database -INFO_ARGUMENT_DESCRIPTION_IMPORTLDIF=Path to an LDIF file \ - containing data that should be added to the Directory Server database. \ - Multiple LDIF files may be provided by using this option multiple times INFO_LDIFFILE_PLACEHOLDER={ldifFile} INFO_REJECT_FILE_PLACEHOLDER={rejectFile} INFO_SKIP_FILE_PLACEHOLDER={skipFile} @@ -589,7 +237,6 @@ INFO_JMXPORT_PLACEHOLDER={jmxPort} INFO_ROOT_USER_DN_PLACEHOLDER={rootUserDN} INFO_ROOT_USER_PWD_PLACEHOLDER={rootUserPassword} INFO_ROOT_USER_PWD_FILE_PLACEHOLDER={rootUserPasswordFile} -INFO_HOST_PLACEHOLDER={host} INFO_TIMEOUT_PLACEHOLDER={timeout} INFO_GENERAL_DESCRIPTION_REJECTED_FILE=Write rejected entries to the \ specified file @@ -601,14 +248,10 @@ INFO_ARGUMENT_DESCRIPTION_LDAPPORT=Port on which the \ Directory Server should listen for LDAP communication INFO_ARGUMENT_DESCRIPTION_ADMINCONNECTORPORT=Port on which the \ Administration Connector should listen for communication -INFO_ARGUMENT_DESCRIPTION_JMXPORT=Port on which the \ - Directory Server should listen for JMX communication INFO_ARGUMENT_DESCRIPTION_SKIPPORT=Skip the check to determine whether \ the specified ports are usable INFO_ARGUMENT_DESCRIPTION_ROOTDN=DN for the initial root \ user for the Directory Server -INFO_ARGUMENT_DESCRIPTION_ROOTPW=Password for the initial \ - root user for the Directory Server INFO_ARGUMENT_DESCRIPTION_ROOTPWFILE=Path to a file \ containing the password for the initial root user for the Directory Server INFO_ARGUMENT_DESCRIPTION_ENABLE_WINDOWS_SERVICE=Enable the server to run \ @@ -634,8 +277,6 @@ INFO_ARGUMENT_DESCRIPTION_USE_JCEKS=Path of a JCEKS containing a \ INFO_ARGUMENT_DESCRIPTION_USE_PKCS12=Path of a PKCS#12 key \ store containing the certificate that the server should use when accepting \ SSL-based connections or performing StartTLS negotiation -INFO_ARGUMENT_CERT_OPTION_JCEKS=Use an existing certificate located on a \ - JCEKS key store INFO_ARGUMENT_DESCRIPTION_CERT_NICKNAME=Nickname of the \ certificate that the server should use when accepting SSL-based \ connections or performing StartTLS negotiation @@ -663,11 +304,11 @@ ERR_ARG_SUBCOMMAND_DUPLICATE_SHORT_ID=Argument %s for subcommand %s \ ERR_ARG_SUBCOMMAND_ARGUMENT_SHORT_ID_GLOBAL_CONFLICT=Argument %s \ for subcommand %s has a short ID -%s that conflicts with that of global \ argument %s -ERR_ARG_SUBCOMMAND_DUPLICATE_LONG_ID=Argument %s for subcommand %s \ - has a long identifier --%s that conflicts with that of argument %s -ERR_ARG_SUBCOMMAND_ARGUMENT_LONG_ID_GLOBAL_CONFLICT=Argument %s for \ - subcommand %s has a long ID --%s that conflicts with that of global argument \ - %s +ERR_ARG_SUBCOMMAND_DUPLICATE_LONG_ID=Failed to add Argument %s for subcommand %s \ + because there is already an argument with the same identifier for this subcommand +ERR_ARG_SUBCOMMAND_ARGUMENT_LONG_ID_GLOBAL_CONFLICT=Failed to add Argument %s for \ + subcommand %s because there is already a global argument defined with the \ + same long identifier ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_NAME=There is already another \ global argument named "%s" ERR_SUBCMDPARSER_GLOBAL_ARG_NAME_SUBCMD_CONFLICT=The argument name \ @@ -678,13 +319,11 @@ ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_SHORT_ID=Short ID -%s for \ ERR_SUBCMDPARSER_GLOBAL_ARG_SHORT_ID_CONFLICT=Short ID -%s for \ global argument %s conflicts with the short ID for the %s argument associated \ with subcommand %s -ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_LONG_ID=Long ID --%s for \ - global argument %s conflicts with the long ID of another global argument %s -ERR_SUBCMDPARSER_GLOBAL_ARG_LONG_ID_CONFLICT=Long ID --%s for \ - global argument %s conflicts with the long ID for the %s argument associated \ - with subcommand %s -ERR_SUBCMDPARSER_CANNOT_READ_PROPERTIES_FILE=An error occurred \ - while attempting to read the contents of the argument properties file %s: %s +ERR_SUBCMDPARSER_DUPLICATE_GLOBAL_ARG_LONG_ID=Failed to add global argument \ + %s because there is already one defined with the same long identifier +ERR_SUBCMDPARSER_GLOBAL_ARG_LONG_ID_CONFLICT=Failed to add argument %s to \ + subcommand %s because there is already one argument with the same long identifier \ + associated to this subcommand. ERR_SUBCMDPARSER_LONG_ARG_WITHOUT_NAME=The provided command-line \ argument %s does not contain an argument name ERR_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_LONG_ID=The provided \ @@ -718,46 +357,11 @@ ERR_SUBCMDPARSER_CANT_MIX_ARGS_WITH_VALUES=The provided argument \ the same block as at least one other argument that does not require a value ERR_SUBCMDPARSER_INVALID_ARGUMENT=The provided argument "%s" is \ not recognized -ERR_SUBCMDPARSER_NO_VALUE_FOR_REQUIRED_ARG=The argument %s is \ - required to have a value but none was provided in the argument list and no \ - default value is available -ERR_ARGUMENT_NO_BASE_DN_SPECIFIED=You have specified \ - not to create a base DN. If no base DN is to be created you cannot specify \ - argument '%s' -ERR_PORT_ALREADY_SPECIFIED=ERROR: You have specified \ - the value %s for different ports -ERR_SEVERAL_CERTIFICATE_TYPE_SPECIFIED=You have \ - specified several certificate types to be used. Only one certificate type \ - is allowed -ERR_CERTIFICATE_REQUIRED_FOR_SSL_OR_STARTTLS=You have \ - chosen to enable SSL or StartTLS. You must specify which type of certificate \ - you want the server to use -ERR_TWO_CONFLICTING_ARGUMENTS=ERROR: You may not \ - provide both the %s and the %s arguments at the same time -ERR_NO_KEYSTORE_PASSWORD=You must provide the PIN of the \ - keystore to retrieve the certificate to be used by the server. You can use \ - {%s} or {%s} -ERR_SSL_OR_STARTTLS_REQUIRED=You have specified to use a \ - certificate as server certificate. You must enable SSL (using option {%s}) \ - or Start TLS (using option %s) -ERR_NO_ROOT_PASSWORD=ERROR: No password was provided \ - for the initial root user. When performing a non-interactive installation, \ - this must be provided using either the %s or the %s argument -INFO_BACKUPDB_DESCRIPTION_BACKEND_ID=Backend ID for the backend to \ - archive -INFO_BACKUPDB_DESCRIPTION_BACKUP_ALL=Back up all backends in the server -INFO_SETUP_SUBCOMMAND_CREATE_DIRECTORY_SERVER=Can be used with global arguments \ -to setup a directory server -INFO_SETUP_SUBCOMMAND_CREATE_PROXY=Can be used with global arguments \ -to setup a proxy ERR_INCOMPATIBLE_JAVA_VERSION=The minimum Java version required is %s.%n%n\ The detected version is %s.%nThe binary detected is %s%n%nPlease set \ OPENDJ_JAVA_HOME to the root of a compatible Java installation or edit the \ java.properties file and then run the dsjavaproperties script to specify the \ java version to be used. -INFO_INSTANCE_DIRECTORY=Instance Directory: %s -INFO_INSTALLATION_DIRECTORY=Installation Directory: %s -ERR_INVALID_LOG_FILE=Invalid log file %s INFO_DESCRIPTION_CONNECTION_TIMEOUT=Maximum length of time (in \ milliseconds) that can be taken to establish a connection. Use '0' to \ specify no time out @@ -805,14 +409,6 @@ INFO_CANNOT_CONNECT_TO_REMOTE_GENERIC=Could not connect to %s. Check that the \ server is running and that the provided credentials are valid.%nError \ details:%n%s ERR_CONFIRMATION_TRIES_LIMIT_REACHED=Confirmation tries limit reached (%d) -INFO_ADMINISTRATOR_UID_PROMPT=Global Administrator User ID -INFO_ADMINISTRATOR_PWD_PROMPT=Global Administrator Password: -INFO_ADMINISTRATOR_PWD_CONFIRM_PROMPT=Confirm Password: -ERR_ADMINISTRATOR_PWD_DO_NOT_MATCH=The provided passwords do not match. -ERR_BAD_INTEGER=Invalid integer number "%s". Please enter a valid integer -INFO_DESCRIPTION_BATCH=Reads from standard input a set of commands to be executed -INFO_DESCRIPTION_BATCH_FILE_PATH=Path to a batch file containing \ -a set of commands to be executed INFO_DESCRIPTION_DISPLAY_EQUIVALENT=Display the equivalent \ non-interactive argument in the standard output when this command is run in \ interactive mode @@ -825,103 +421,16 @@ INFO_DESCRIPTION_CONFIG_CLASS=The fully-qualified name of the Java class \ will be used INFO_DESCRIPTION_CONFIG_FILE=Path to the Directory Server \ configuration file -INFO_DESCRIPTION_BACKUP_ID=Use the provided identifier for the \ - backup -INFO_DESCRIPTION_BACKUP_DIR=Path to the target directory for the \ - backup file(s) -INFO_DESCRIPTION_KEYMANAGER_PROVIDER_DN=DN of the \ - key manager provider to use for SSL and/or StartTLS -INFO_DESCRIPTION_TRUSTMANAGER_PROVIDER_DN=DN of \ - the trust manager provider to use for SSL and/or StartTLS -INFO_DESCRIPTION_KEYMANAGER_PATH=Path of the \ - key store to be used by the key manager provider -INFO_CONFIGURE_WINDOWS_SERVICE_DESCRIPTION_DISABLE=Disables the server as \ - a Windows service and stops the server -INFO_CONFIGURE_WINDOWS_SERVICE_DESCRIPTION_STATE=Provides information \ - about the state of the server as a Windows service -INFO_CONFIGURE_WINDOWS_SERVICE_DESCRIPTION_CLEANUP=Allows to disable the \ - server service and to clean up the windows registry information associated \ - with the provided service name -INFO_COMPARE_DESCRIPTION_FILENAME=File containing the DNs of the entries \ - to compare -INFO_DESCRIPTION_USE_SASL_EXTERNAL=Use the SASL EXTERNAL authentication \ - mechanism -INFO_DELETE_DESCRIPTION_FILENAME=File containing the DNs of the entries \ - to delete -INFO_DESCRIPTION_TIME_LIMIT=Maximum length of \ - time (in seconds) to spend processing -INFO_DESCRIPTION_IMPORTLDIF=Path to an LDIF file \ - containing data that should be added to the Directory Server database. \ - Multiple LDIF files may be provided by using this option multiple times INFO_LDAPAUTH_PASSWORD_PROMPT=Password for user '%s': -INFO_DESCRIPTION_ADMIN_UID=User ID of the Global Administrator \ - to use to bind to the server # # Uninstall messages # -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_ALL=Remove all components of \ - the server (this option is not compatible with the rest of remove options) -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_SERVER_LIBRARIES=Remove Server Libraries \ - and Administrative Tools -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_DATABASES=Remove database contents -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_LOG_FILES=Remove log files -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_CONFIGURATION_FILES=Remove configuration \ - files -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_BACKUP_FILES=Remove backup files -INFO_UNINSTALLDS_DESCRIPTION_REMOVE_LDIF_FILES=Remove LDIF files -INFO_DESCRIPTION_REFERENCED_HOST=The name of this host (or IP address) as \ - it is referenced in remote servers for replication -INFO_UNINSTALLDS_DESCRIPTION_FORCE=Specifies whether the uninstall should \ - continue if there is an error updating references to this server in remote \ - server instances or not. This option can only be used with the %s no \ - prompt option. # # Connection messages # -ERR_FAILED_TO_CONNECT=Unable to connect to the server at "%s" on port %s -ERR_SIMPLE_BIND_NOT_SUPPORTED=Unable to authenticate using simple \ -authentication -ERR_FAILED_TO_CONNECT_WRONG_PORT=Unable to connect to the \ - server at %s on port %s. Check this port is an administration port -ERR_CANNOT_BIND_TO_PRIVILEGED_PORT=ERROR: Unable to \ - bind to port %d. This port may already be in use, or you may not have \ - permission to bind to it. On UNIX-based operating systems, non-root users \ - may not be allowed to bind to ports 1 through 1024 -ERR_CANNOT_BIND_TO_PORT=ERROR: Unable to bind to port \ - %d. This port may already be in use, or you may not have permission to bind \ - to it -ERR_FAILED_TO_CONNECT_NOT_TRUSTED=Unable to connect to the \ - server at %s on port %s. In non-interactive mode, if the trustStore related parameters are not used, \ - you must use the '--trustAll' option for remote connections INFO_EXCEPTION_OUT_OF_MEMORY_DETAILS=Not enough memory to perform the \ operation. Details: %s INFO_EXCEPTION_DETAILS=Details: %s -INFO_LDAP_CONN_PROMPT_SECURITY_LDAP=LDAP -INFO_LDAP_CONN_PROMPT_SECURITY_USE_SSL=LDAP with SSL -INFO_LDAP_CONN_PROMPT_SECURITY_USE_START_TLS=LDAP with StartTLS -INFO_LDAP_CONN_PROMPT_SECURITY_USE_TRUST_ALL=Automatically \ - trust -INFO_LDAP_CONN_PROMPT_SECURITY_TRUSTSTORE_PATH=Truststore path: -INFO_LDAP_CONN_PROMPT_SECURITY_TRUSTSTORE_PASSWORD=Password for \ - truststore '%s': -INFO_LDAP_CONN_PROMPT_SECURITY_KEYSTORE_PATH=Keystore path: -INFO_LDAP_CONN_PROMPT_SECURITY_KEYSTORE_PASSWORD=Password for keystore \ - '%s': -INFO_LDAP_CONN_HEADING_CONNECTION_PARAMETERS=>>>> Specify OpenDJ LDAP \ - connection parameters -ERR_LDAP_CONN_BAD_HOST_NAME=The hostname "%s" could not be \ - resolved. Please check you have provided the correct address -ERR_LDAP_CONN_BAD_PORT_NUMBER=Invalid port number "%s". Please \ - enter a valid port number between 1 and 65535 -INFO_LDAP_CONN_PROMPT_HOST_NAME=Directory server hostname or IP address \ - [%s]: -INFO_LDAP_CONN_PROMPT_SECURITY_USE_SECURE_CTX=How do you want to connect? -INFO_LDAP_CONN_PROMPT_SECURITY_PROTOCOL_DEFAULT_CHOICE=%d -ERR_LDAP_CONN_PROMPT_SECURITY_INVALID_FILE_PATH=The provided path \ - is not valid -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_METHOD=How do you want to trust the server certificate? -INFO_LDAP_CONN_PROMPT_SECURITY_TRUSTSTORE=Use a truststore -INFO_LDAP_CONN_PROMPT_SECURITY_MANUAL_CHECK=Manually validate INFO_LDAP_CONN_PROMPT_SECURITY_SERVER_CERTIFICATE=Server Certificate: INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE=%s INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION=Do you trust this server certificate? @@ -932,38 +441,6 @@ INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS=View certificate details INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN=User DN : %s INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY=Validity : From '%s'%n To '%s' INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER=Issuer : %s -INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_ALIASES=Which certificate do you want to use? -INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_ALIAS=%s (%s) -INFO_LDAP_CONN_PROMPT_ADMINISTRATOR_UID=Global Administrator User ID [%s]: -INFO_LDAP_CONN_GLOBAL_ADMINISTRATOR_OR_BINDDN_PROMPT=Global Administrator \ - User ID, or bind DN if no Global Administrator is defined [%s]: -INFO_LDAP_CONN_PROMPT_PORT_NUMBER=Directory server port number [%d]: -INFO_LDAP_CONN_PROMPT_BIND_DN=Administrator user bind DN [%s]: -INFO_ADMIN_CONN_PROMPT_PORT_NUMBER=Directory server administration port number [%d]: -INFO_ERROR_CONNECTING_TO_LOCAL=An error occurred connecting to the server -INFO_CERTIFICATE_NOT_TRUSTED_TEXT_CLI=The Certificate presented by the server \ - %s:%s could not be trusted.\nPossible reasons for this error:\n\ - -The Certificate Authority that issued the certificate is not recognized (this \ - is the case of the self-signed certificates).\n-The server's certificate is \ - incomplete due to a misconfiguration.\n-The server's certificate has \ - expired.\n-There is a time difference between the server machine clock and \ - the local machine clock.\nBefore accepting this certificate, you should \ - examine the server's certificate carefully. -INFO_CERTIFICATE_NAME_MISMATCH_TEXT_CLI=The Certificate presented by the server \ - %s:%s could not be trusted.\nThere is a name mismatch between the name of \ - the server (%s) and the subject DN of the certificate. This could be caused \ - because you are connected to a server pretending to be %s:%s.\n\ - Before accepting this certificate, you should examine the server's \ - certificate carefully. -ERR_ERROR_CANNOT_READ_CONNECTION_PARAMETERS=The connection \ - parameters could not be read due to the following error: %s -ERR_ERROR_NO_ADMIN_PASSWORD=No password was specified for \ - administrator "%s" -ERR_ERROR_BIND_PASSWORD_NONINTERACTIVE=The LDAP bind \ - password was not specified and cannot be read interactively -ERR_ERROR_INCOMPATIBLE_PROPERTY_MOD=The property \ - modification "%s" is incompatible with another modification to the same \ - property INFO_LDAP_CONN_HEADING_CONNECTION_PARAMETERS=>>>> Specify OpenDJ LDAP \ connection parameters ERR_ERROR_CANNOT_READ_PASSWORD=Unable to read password @@ -979,8 +456,8 @@ REF_TITLE_SUBCOMMANDS=Subcommands REF_INTRO_SUBCOMMANDS=The %s command supports the following subcommands: REF_PART_TITLE_SUBCOMMANDS=%s Subcommands Reference REF_PART_INTRO_SUBCOMMANDS=This section covers %s subcommands. -REF_SHORT_DESC_UNINSTALL=remove OpenDJ directory server software -REF_DEFAULT_BACKEND_TYPE=Depends on the distribution +REF_DEFAULT_BACKEND_TYPE=Default: je for standard edition, \ + pdb for OEM edition. # Supplements to descriptions for generated reference documentation. SUPPLEMENT_DESCRIPTION_CONTROLS= diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ca_ES.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ca_ES.properties new file mode 100644 index 000000000..c3458b9dc --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ca_ES.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=ERROR: Potser nou heu introdu\u00eft ambd\u00f3s arguments %s i %s al mateix cop diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_de.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_de.properties new file mode 100644 index 000000000..cc8cb1b42 --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_de.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=Sie haben m\u00f6glicherweise nicht beide Argumente --%s und --%s angegeben diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_es.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_es.properties new file mode 100644 index 000000000..f019d986d --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_es.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=No se pueden proporcionar los argumentos --%s y --%s conjuntamente diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_fr.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_fr.properties new file mode 100644 index 000000000..9e9c37c11 --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_fr.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=Vous ne pouvez pas utiliser \u00e0 la fois les arguments --%s et --%s diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ja.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ja.properties new file mode 100644 index 000000000..e7cb5c8dc --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ja.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=--%s \u5f15\u6570\u3068 --%s \u5f15\u6570\u306e\u4e21\u65b9\u306f\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093 diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ko.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ko.properties new file mode 100644 index 000000000..1bf6f3518 --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_ko.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=--%s \uc778\uc218\uc640 --%s \uc778\uc218\ub97c \ubaa8\ub450 \uc81c\uacf5\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_pl.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_pl.properties new file mode 100644 index 000000000..c0cc2e533 --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_pl.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=B\u0141\u0104D\: Nie mo\u017cesz poda\u0107 obydwu arument\u00f3w %s i %s w tym samym czasie diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_zh_CN.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_zh_CN.properties new file mode 100644 index 000000000..573ed952f --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_zh_CN.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=\u4e0d\u80fd\u540c\u65f6\u63d0\u4f9b --%s \u548c --%s \u53c2\u6570 diff --git a/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_zh_TW.properties b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_zh_TW.properties new file mode 100644 index 000000000..47851740a --- /dev/null +++ b/opendj-cli/src/main/resources/com/forgerock/opendj/cli/cli_zh_TW.properties @@ -0,0 +1,17 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. +# + +ERR_TOOL_CONFLICTING_ARGS=\u60a8\u7121\u6cd5\u540c\u6642\u63d0\u4f9b --%s \u8207 --%s \u5f15\u6578 diff --git a/opendj-cli/src/main/resources/templates/dscfgAppendProps.ftl b/opendj-cli/src/main/resources/templates/dscfgAppendProps.ftl index da914fafc..4d20a023e 100644 --- a/opendj-cli/src/main/resources/templates/dscfgAppendProps.ftl +++ b/opendj-cli/src/main/resources/templates/dscfgAppendProps.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> ${title} diff --git a/opendj-cli/src/main/resources/templates/dscfgListItem.ftl b/opendj-cli/src/main/resources/templates/dscfgListItem.ftl index 9b49a1c34..d4836c232 100644 --- a/opendj-cli/src/main/resources/templates/dscfgListItem.ftl +++ b/opendj-cli/src/main/resources/templates/dscfgListItem.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> diff --git a/opendj-cli/src/main/resources/templates/dscfgListSubtypes.ftl b/opendj-cli/src/main/resources/templates/dscfgListSubtypes.ftl index 7aa96b181..5789cbc05 100644 --- a/opendj-cli/src/main/resources/templates/dscfgListSubtypes.ftl +++ b/opendj-cli/src/main/resources/templates/dscfgListSubtypes.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> diff --git a/opendj-cli/src/main/resources/templates/dscfgReference.ftl b/opendj-cli/src/main/resources/templates/dscfgReference.ftl index 236ca4e3d..860b8faa3 100644 --- a/opendj-cli/src/main/resources/templates/dscfgReference.ftl +++ b/opendj-cli/src/main/resources/templates/dscfgReference.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> ${marker} ${term} diff --git a/opendj-cli/src/main/resources/templates/dscfgVariableList.ftl b/opendj-cli/src/main/resources/templates/dscfgVariableList.ftl index 584b75421..79cf12a78 100644 --- a/opendj-cli/src/main/resources/templates/dscfgVariableList.ftl +++ b/opendj-cli/src/main/resources/templates/dscfgVariableList.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> diff --git a/opendj-cli/src/main/resources/templates/optionsRefSect1.ftl b/opendj-cli/src/main/resources/templates/optionsRefSect1.ftl index 23bb099cd..a07cc9bd4 100644 --- a/opendj-cli/src/main/resources/templates/optionsRefSect1.ftl +++ b/opendj-cli/src/main/resources/templates/optionsRefSect1.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> ${title} diff --git a/opendj-cli/src/main/resources/templates/refEntry.ftl b/opendj-cli/src/main/resources/templates/refEntry.ftl index b0c853f78..fcc32bbf8 100644 --- a/opendj-cli/src/main/resources/templates/refEntry.ftl +++ b/opendj-cli/src/main/resources/templates/refEntry.ftl @@ -1,54 +1,33 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> ${title} diff --git a/opendj-cli/src/main/resources/templates/refSect2.ftl b/opendj-cli/src/main/resources/templates/refSect2.ftl index 69c0ebb1a..4dcba4ea7 100644 --- a/opendj-cli/src/main/resources/templates/refSect2.ftl +++ b/opendj-cli/src/main/resources/templates/refSect2.ftl @@ -1,28 +1,17 @@ <#-- - # CDDL HEADER START + # The contents of this file are subject to the terms of the Common Development and + # Distribution License (the License). You may not use this file except in compliance with the + # License. # - # The contents of this file are subject to the terms of the - # Common Development and Distribution License, Version 1.0 only - # (the "License"). You may not use this file except in compliance - # with the License. + # You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + # specific language governing permission and limitations under the License. # - # You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - # or http://forgerock.org/license/CDDLv1.0.html. - # See the License for the specific language governing permissions - # and limitations under the License. - # - # When distributing Covered Code, include this CDDL HEADER in each - # file and include the License file at legal-notices/CDDLv1_0.txt. - # If applicable, add the following below this CDDL HEADER, - # with the fields enclosed by brackets "[]" replaced - # with your own identifying information: - # - # Portions Copyright [yyyy] [name of copyright owner] - # - # CDDL HEADER END - # - # Copyright 2015 ForgeRock AS. + # When distributing Covered Software, include this CDDL Header Notice in each file and include + # the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + # Header, with the fields enclosed by brackets [] replaced by your own identifying + # information: "Portions Copyright [year] [name of copyright owner]". # + # Copyright 2015 ForgeRock AS. #--> ${name} diff --git a/opendj-cli/src/test/java/com/forgerock/opendj/cli/CliTestCase.java b/opendj-cli/src/test/java/com/forgerock/opendj/cli/CliTestCase.java index 5690873d2..376e4994c 100644 --- a/opendj-cli/src/test/java/com/forgerock/opendj/cli/CliTestCase.java +++ b/opendj-cli/src/test/java/com/forgerock/opendj/cli/CliTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/test/java/com/forgerock/opendj/cli/ConsoleApplicationTestCase.java b/opendj-cli/src/test/java/com/forgerock/opendj/cli/ConsoleApplicationTestCase.java index 601b9ce73..1f537e285 100644 --- a/opendj-cli/src/test/java/com/forgerock/opendj/cli/ConsoleApplicationTestCase.java +++ b/opendj-cli/src/test/java/com/forgerock/opendj/cli/ConsoleApplicationTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.cli; @@ -36,19 +26,14 @@ import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; -/** - * Unit tests for the console application class. - */ +/** Unit tests for the console application class. */ @SuppressWarnings("javadoc") public class ConsoleApplicationTestCase extends CliTestCase { - final LocalizableMessage msg = LocalizableMessage.raw("Language is the source of misunderstandings."); final LocalizableMessage msg2 = LocalizableMessage .raw("If somebody wants a sheep, that is a proof that one exists."); - /** - * For test purposes only. - */ + /** For test purposes only. */ private static class MockConsoleApplication extends ConsoleApplication { private static ByteArrayOutputStream out; private static ByteArrayOutputStream err; @@ -76,19 +61,16 @@ public String getErr() throws UnsupportedEncodingException { return err.toString("UTF-8"); } - /** {@inheritDoc} */ @Override public boolean isVerbose() { return verbose; } - /** {@inheritDoc} */ @Override public boolean isInteractive() { return interactive; } - /** {@inheritDoc} */ @Override public boolean isQuiet() { return quiet; diff --git a/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandArgumentParserTestCase.java b/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandArgumentParserTestCase.java index cd343e07c..863fa2bda 100644 --- a/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandArgumentParserTestCase.java +++ b/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandArgumentParserTestCase.java @@ -1,33 +1,21 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * 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.List; @@ -61,9 +49,9 @@ public final class TestSubCommandArgumentParserTestCase extends CliTestCase { public void setup() throws Exception { parser = new SubCommandArgumentParser(getClass().getName(), LocalizableMessage.raw("test description"), true); - sc1 = new SubCommand(parser, "sub-command1", INFO_BACKUPDB_DESCRIPTION_BACKEND_ID.get()); + sc1 = new SubCommand(parser, "sub-command1", LocalizableMessage.raw("sub-command1")); sc2 = new SubCommand(parser, "sub-command2", true, 2, 4, "args1 arg2 [arg3 arg4]", - INFO_BACKUPDB_DESCRIPTION_BACKUP_ALL.get()); + LocalizableMessage.raw("sub-command2")); } /** diff --git a/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandTestCase.java b/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandTestCase.java index 1ce1846e0..885a08ff5 100644 --- a/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandTestCase.java +++ b/opendj-cli/src/test/java/com/forgerock/opendj/cli/TestSubCommandTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java b/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java index e0671bdda..18401c0ba 100644 --- a/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java +++ b/opendj-cli/src/test/java/com/forgerock/opendj/cli/UtilsTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2015 ForgeRock AS. */ package com.forgerock.opendj.cli; diff --git a/opendj-copyright-maven-plugin/pom.xml b/opendj-copyright-maven-plugin/pom.xml deleted file mode 100644 index 1df418532..000000000 --- a/opendj-copyright-maven-plugin/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - 4.0.0 - - - opendj-sdk-parent - org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml - - - opendj-copyright-maven-plugin - OpenDJ Copyright Check Maven Plugin - Checks ForgeRock source file copyrights. - - maven-plugin - - - - 3.2.3 - 3.2 - - - - - - - org.apache.maven - maven-core - ${maven.version} - provided - - - - org.apache.maven - maven-model - ${maven.version} - provided - - - - org.apache.maven - maven-plugin-api - ${maven.version} - provided - - - - org.apache.maven.plugin-tools - maven-plugin-annotations - ${maven-plugin-plugin.version} - provided - - - - - org.forgerock - forgerock-build-tools - test - - - - - org.twdata.maven - mojo-executor - 2.2.0 - - - - - org.forgerock.commons - forgerock-util - - - - org.apache.maven.scm - maven-scm-api - 1.9.2 - - - - org.apache.maven.scm - maven-scm-provider-svn-commons - 1.9.2 - - - - org.apache.maven.scm - maven-scm-provider-gitexe - 1.9.2 - - - diff --git a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java deleted file mode 100644 index 8a56c02ee..000000000 --- a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CheckCopyrightMojo.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. - */ -package org.forgerock.maven; - -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.LifecyclePhase; -import org.apache.maven.plugins.annotations.Mojo; -import org.apache.maven.plugins.annotations.Parameter; - -/** - * This be used to check that if a modified file contains a line that appears to - * be a comment and includes the word "copyright", then it should contain the - * current year. - */ -@Mojo(name = "check-copyright", defaultPhase = LifecyclePhase.VALIDATE) -public class CheckCopyrightMojo extends CopyrightAbstractMojo { - - /** - * The property that may be used to prevent copyright date problems from - * failing the build. - */ - @Parameter(required = true, property = "ignoreCopyrightErrors", defaultValue = "false") - private boolean ignoreCopyrightErrors; - - @Parameter(required = true, property = "skipCopyrightCheck", defaultValue = "false") - private boolean checkDisabled; - - /** - * Uses maven-scm API to identify all modified files in the current - * workspace. For all source files, check if the copyright is up to date. - * - * @throws MojoFailureException - * if any - * @throws MojoExecutionException - * if any - */ - public void execute() throws MojoFailureException, MojoExecutionException { - if (checkDisabled) { - getLog().info("Copyright check is disabled"); - return; - } - - checkCopyrights(); - if (!getIncorrectCopyrightFilePaths().isEmpty()) { - getLog().warn("Potential copyright year updates needed for the following files:"); - for (String filename : getIncorrectCopyrightFilePaths()) { - getLog().warn(" " + filename); - } - - if (!ignoreCopyrightErrors) { - getLog().warn("Fix copyright date problems before proceeding, " - + "or use '-DignoreCopyrightErrors=true' to ignore copyright errors."); - getLog().warn("You can use update-copyrights maven profile " - + "(mvn validate -Pupdate-copyrights) to automatically update copyrights."); - throw new MojoExecutionException("Found files with potential copyright year updates needed"); - } - } else { - getLog().info("Copyrights are up to date"); - } - } -} diff --git a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java b/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java deleted file mode 100644 index 54fd88488..000000000 --- a/opendj-copyright-maven-plugin/src/main/java/org/forgerock/maven/CopyrightAbstractMojo.java +++ /dev/null @@ -1,367 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. - */ -package org.forgerock.maven; - -import static org.forgerock.util.Utils.closeSilently; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.LinkedList; -import java.util.List; - -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; -import org.apache.maven.scm.ScmException; -import org.apache.maven.scm.ScmFile; -import org.apache.maven.scm.ScmFileSet; -import org.apache.maven.scm.ScmFileStatus; -import org.apache.maven.scm.ScmResult; -import org.apache.maven.scm.ScmVersion; -import org.apache.maven.scm.command.diff.DiffScmResult; -import org.apache.maven.scm.command.status.StatusScmResult; -import org.apache.maven.scm.log.ScmLogDispatcher; -import org.apache.maven.scm.log.ScmLogger; -import org.apache.maven.scm.manager.BasicScmManager; -import org.apache.maven.scm.manager.NoSuchScmProviderException; -import org.apache.maven.scm.manager.ScmManager; -import org.apache.maven.scm.provider.ScmProviderRepository; -import org.apache.maven.scm.provider.git.command.GitCommand; -import org.apache.maven.scm.provider.git.command.diff.GitDiffConsumer; -import org.apache.maven.scm.provider.git.gitexe.GitExeScmProvider; -import org.apache.maven.scm.provider.git.gitexe.command.GitCommandLineUtils; -import org.apache.maven.scm.provider.git.gitexe.command.diff.GitDiffCommand; -import org.apache.maven.scm.repository.ScmRepository; -import org.apache.maven.scm.repository.ScmRepositoryException; -import org.codehaus.plexus.util.cli.CommandLineUtils; -import org.codehaus.plexus.util.cli.CommandLineUtils.StringStreamConsumer; -import org.codehaus.plexus.util.cli.Commandline; - -/** - * Abstract class which is used for both copyright checks and updates. - */ -public abstract class CopyrightAbstractMojo extends AbstractMojo { - - /** The Maven Project. */ - @Parameter(required = true, property = "project", readonly = true) - private MavenProject project; - - /** - * Copyright owner. - * This string token must be present on the same line with 'copyright' keyword and the current year. - */ - @Parameter(required = true, defaultValue = "ForgeRock AS") - private String copyrightOwnerToken; - - /** The path to the root of the scm local workspace to check. */ - @Parameter(required = true, defaultValue = "${basedir}") - private String baseDir; - - @Parameter(required = true, defaultValue = "${project.scm.connection}") - private String scmRepositoryUrl; - - /** - * List of file patterns for which copyright check and/or update will be skipped. - * Pattern can contain the following wildcards (*, ?, **{@literal /}). - */ - @Parameter(required = false) - private List disabledFiles; - - /** The file extensions to test. */ - public static final List CHECKED_EXTENSIONS = new LinkedList<>(Arrays.asList( - "bat", "c", "h", "html", "java", "ldif", "Makefile", "mc", "sh", "txt", "xml", "xsd", "xsl")); - - private static final List EXCLUDED_END_COMMENT_BLOCK_TOKEN = new LinkedList<>(Arrays.asList( - "*/", "-->")); - - private static final List SUPPORTED_COMMENT_MIDDLE_BLOCK_TOKEN = new LinkedList<>(Arrays.asList( - "*", "#", "rem", "!")); - - private static final List SUPPORTED_START_BLOCK_COMMENT_TOKEN = new LinkedList<>(Arrays.asList( - "/*", " - -MUST BE REMOVED: Copyright 2012-2014 ForgeRock AS. -EXPECTED OUTPUT: Copyright 2012-YEAR ForgeRock AS. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt deleted file mode 100644 index 4c140eb64..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-2.txt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013 ForgeRock AS. - */ - -MUST BE REMOVED: Copyright 2013 ForgeRock AS. -EXPECTED OUTPUT: Copyright 2013-YEAR ForgeRock AS. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt deleted file mode 100644 index e5f672171..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-3.txt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - */ - -EXPECTED OUTPUT: Copyright YEAR ForgeRock AS. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt deleted file mode 100644 index 1537c5702..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-4.txt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2010-2013 Old Copyright Owner Inc. - * - */ - -EXPECTED OUTPUT: Portions Copyright YEAR ForgeRock AS. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt deleted file mode 100644 index 1c120bb0c..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-5.txt +++ /dev/null @@ -1,27 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2010-2012 Very Old copyright owner Inc. - * Copyright 2013-2014 Old copyright owner Inc. - */ - -EXPECTED OUTPUT: Portions Copyright YEAR ForgeRock AS. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt b/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt deleted file mode 100644 index 0c3a8220d..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/opendj-copyrights/opendj-bad-copyright-6.txt +++ /dev/null @@ -1,29 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2008-2010 Very Old copyright owner Inc. - * Portions Copyright 2011-2012 Old copyright owner Inc. - * Portions Copyright 2013-2014 ForgeRock AS. - */ - -MUST BE REMOVED: Portions Copyright 2013-2014 ForgeRock AS. -EXPECTED OUTPUT: Portions Copyright 2013-YEAR ForgeRock AS. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt deleted file mode 100644 index e01ee4e73..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-1.txt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2011-2014 ForgeRock AS. All rights reserved. - * - * The contents of this file are subject to the terms - * of the Common Development and Distribution License - * (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at - * http://forgerock.org/license/CDDLv1.0.html - * See the License for the specific language governing - * permission and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at http://forgerock.org/license/CDDLv1.0.html - * If applicable, add the following below the CDDL Header, - * with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - */ - -MUST BE REMOVED: Copyright (c) 2011-2014 ForgeRock AS. All rights reserved. -EXPECTED OUTPUT: Copyright (c) 2011-YEAR ForgeRock AS. All rights reserved. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt deleted file mode 100644 index d748d883c..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-2.txt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2012 ForgeRock AS. All rights reserved. - * - * The contents of this file are subject to the terms - * of the Common Development and Distribution License - * (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at - * http://forgerock.org/license/CDDLv1.0.html - * See the License for the specific language governing - * permission and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at http://forgerock.org/license/CDDLv1.0.html - * If applicable, add the following below the CDDL Header, - * with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - */ - -MUST BE REMOVED: Copyright (c) 2012 ForgeRock AS. All rights reserved. -EXPECTED OUTPUT: Copyright (c) 2012-YEAR ForgeRock AS. All rights reserved. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt deleted file mode 100644 index 20a378fc6..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-3.txt +++ /dev/null @@ -1,24 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * - * The contents of this file are subject to the terms - * of the Common Development and Distribution License - * (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at - * http://forgerock.org/license/CDDLv1.0.html - * See the License for the specific language governing - * permission and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at http://forgerock.org/license/CDDLv1.0.html - * If applicable, add the following below the CDDL Header, - * with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - */ - -EXPECTED OUTPUT: Copyright (c) YEAR ForgeRock AS. All rights reserved. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt deleted file mode 100644 index 5f5a5150c..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-4.txt +++ /dev/null @@ -1,25 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-2011 Old Copyright Owner. - * - * The contents of this file are subject to the terms - * of the Common Development and Distribution License - * (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at - * http://forgerock.org/license/CDDLv1.0.html - * See the License for the specific language governing - * permission and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at http://forgerock.org/license/CDDLv1.0.html - * If applicable, add the following below the CDDL Header, - * with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - */ - - EXPECTED OUTPUT: Portions Copyrighted YEAR ForgeRock AS. All rights reserved. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt deleted file mode 100644 index 2e8c5d980..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-5.txt +++ /dev/null @@ -1,26 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-2011 Very Old Copyright Owner. - * Copyright (c) 2012-2013 Old Copyright Owner. - * - * The contents of this file are subject to the terms - * of the Common Development and Distribution License - * (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at - * http://forgerock.org/license/CDDLv1.0.html - * See the License for the specific language governing - * permission and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at http://forgerock.org/license/CDDLv1.0.html - * If applicable, add the following below the CDDL Header, - * with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - */ - - EXPECTED OUTPUT: Portions Copyrighted YEAR ForgeRock AS. All rights reserved. \ No newline at end of file diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt b/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt deleted file mode 100644 index e05d576e6..000000000 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openidm-copyrights/openidm-bad-copyright-6.txt +++ /dev/null @@ -1,28 +0,0 @@ -/* - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. - * - * Copyright (c) 2010-2011 Very Old Copyright Owner. - * Portions Copyrighted 2012-2013 Old Copyright Owner. - * Portions Copyrighted 2013-2014 ForgeRock AS. All rights reserved. - * - * The contents of this file are subject to the terms - * of the Common Development and Distribution License - * (the License). You may not use this file except in - * compliance with the License. - * - * You can obtain a copy of the License at - * http://forgerock.org/license/CDDLv1.0.html - * See the License for the specific language governing - * permission and limitations under the License. - * - * When distributing Covered Code, include this CDDL - * Header Notice in each file and include the License file - * at http://forgerock.org/license/CDDLv1.0.html - * If applicable, add the following below the CDDL Header, - * with the fields enclosed by brackets [] replaced by - * your own identifying information: - * "Portions Copyrighted [year] [name of copyright owner]" - */ - -MUST BE REMOVED: Portions Copyrighted 2013-2014 ForgeRock AS. All rights reserved. -EXPECTED OUTPUT: Portions Copyrighted 2013-YEAR ForgeRock AS. All rights reserved. \ No newline at end of file diff --git a/opendj-core/clirr-ignored-api-changes.xml b/opendj-core/clirr-ignored-api-changes.xml deleted file mode 100644 index 69380923c..000000000 --- a/opendj-core/clirr-ignored-api-changes.xml +++ /dev/null @@ -1,590 +0,0 @@ - - - - - - org/forgerock/opendj/ldap/LDAPConnectionFactory - 7002 - LDAPConnectionFactory(java.net.SocketAddress) - Moving from inetSocketAddress to host+port constructors - - - org/forgerock/opendj/ldap/LDAPConnectionFactory - 7002 - LDAPConnectionFactory(java.net.SocketAddress, org.forgerock.opendj.ldap.LDAPOptions) - Moving from inetSocketAddress to host+port constructors - - - org/forgerock/opendj/ldap/LDAPConnectionFactory - 7002 - java.net.InetAddress getAddress() - Moving from inetSocketAddress to host+port constructors - - - org/forgerock/opendj/ldap/LDAPConnectionFactory - 7002 - java.net.SocketAddress getSocketAddress() - Moving from inetSocketAddress to host+port constructors - - - - org/forgerock/opendj/ldap/CoreMessages - 8001 - Incorrectly reported because it is automatically generated - - - - org/forgerock/opendj/ldap/Connections - 7005 - %regex[org\.forgerock\.opendj\.ldap\.ConnectionFactory newHeartBeatConnectionFactory\(org\.forgerock\.opendj\.ldap\.ConnectionFactory, long, java\.util\.concurrent\.TimeUnit, org\.forgerock\.opendj\.ldap\.requests\.SearchRequest(, java\.util\.concurrent\.ScheduledExecutorService)?\)] - %regex[org\.forgerock\.opendj\.ldap\.ConnectionFactory newHeartBeatConnectionFactory\(org\.forgerock\.opendj\.ldap\.ConnectionFactory,\s*long,\s*long,\s*java\.util\.concurrent\.TimeUnit(,\s*org\.forgerock\.opendj\.ldap\.requests\.SearchRequest(,\s*java\.util\.concurrent\.ScheduledExecutorService)?)?\)] - OPENDJ-1058: Added a timeout parameter to actively shutdown dead connections - - - org/forgerock/opendj/ldap/Connections - 7004 - org.forgerock.opendj.ldap.ConnectionFactory newHeartBeatConnectionFactory(org.forgerock.opendj.ldap.ConnectionFactory, long, java.util.concurrent.TimeUnit) - OPENDJ-1058: Added a timeout parameter to actively shutdown dead connections - - - org/forgerock/opendj/ldap/ErrorResultException - 7005 - %regex[org\.forgerock\.opendj\.ldap\.ErrorResultException newErrorResult\(org\.forgerock\.opendj\.ldap\.ResultCode, java\.lang\.String(, java\.lang\.Throwable)?\)] - %regex[org\.forgerock\.opendj\.ldap\.ErrorResultException newErrorResult\(org\.forgerock\.opendj\.ldap\.ResultCode, java\.lang\.CharSequence(, java\.lang\.Throwable)?\)] - OPENDJ-1058: Broadened the API by accepting java.lang.CharSequence while retaining source compatibility - - - %regex[org/forgerock/opendj/ldap/(LDAPConnectionFactory|LDAPListener)] - 7002 - java.lang.String getHostname() - OPENDJ-1270: Renamed LDAP{ConnectionFactory|Listener}.getHostname() to getHostName() - - - %regex[org/forgerock/opendj/ldap/(LDAPConnectionFactory|LDAPListener)] - 7006 - java.net.SocketAddress getSocketAddress() - java.net.InetSocketAddress - OPENDJ-1270: Changed LDAP{ConnectionFactory|Listener}.getAddress() to return InetSocketAddresses - - - org/forgerock/opendj/ldap/LDAPConnectionFactory - 7005 - %regex[LDAPConnectionFactory\(java\.lang\.String(.)*(org\.forgerock\.opendj\.ldap\.LDAPOptions)\)] - %regex[LDAPConnectionFactory\(java\.lang\.String(.)*(org\.forgerock\.util\.Options)\)] - OPENDJ-1654: LDAPOptions should be converted in a SchemaOptions style API - - - org/forgerock/opendj/ldap/LDAPListener - 7005 - %regex[LDAPListener\((.*), org\.forgerock\.opendj\.ldap\.ServerConnectionFactory(,\s*org\.forgerock\.opendj\.ldap\.LDAPListenerOptions)?\)] - %regex[LDAPListener\((.*)\s*org\.forgerock\.opendj\.ldap\.ServerConnectionFactory(,\s*org\.forgerock\.util\.Options)?\)] - OPENDJ-1654: LDAPOptions should be converted in a SchemaOptions style API - - - - %regex[org/forgerock/opendj/ldap/(LDAPOptions|LDAPListenerOptions)] - 7002 - %regex[org\.glassfish\.grizzly\.nio\.transport\.TCPNIOTransport getTCPNIOTransport\(\)] - OPENDJ-346: Decoupled opendj-ldap-sdk from grizzly-framework - - - %regex[org/forgerock/opendj/ldap/(LDAPOptions|LDAPListenerOptions)] - 7002 - %regex[org\.forgerock\.opendj\.ldap\.(LDAPOptions|LDAPListenerOptions) setTCPNIOTransport\(org\.glassfish\.grizzly\.nio\.transport\.TCPNIOTransport\)] - OPENDJ-346: Decoupled opendj-ldap-sdk from grizzly-framework - - - - %regex[org/forgerock/opendj/asn1/[^/]*] - 8001 - OPENDJ-175: Moved all classes from org.forgerock.opendj.asn1 package to org.forgerock.opendj.io package - - - org/forgerock/opendj/ldap/ByteSequence - 7012 - boolean isEmpty() - OPENDJ-701: Added method isEmpty() to interface ByteSequence - - - org/forgerock/opendj/ldap/requests/SearchRequest - 7012 - boolean isSingleEntrySearch() - OPENDJ-972: Added method isSingleEntrySearch() to interface SearchRequest - - - - org/forgerock/opendj/ldap/schema/MatchingRule - 7002 - %regex[org\.forgerock\.opendj\.ldap\.Assertion getAssertion\(org\.forgerock\.opendj\.ldap\.ByteSequence, java\.util\.List, org\.forgerock\.opendj\.ldap\.ByteSequence\)] - Renamed getAssertion() to getSubstringAssertion() - - - org/forgerock/opendj/ldap/schema/MatchingRuleImpl - 7002 - %regex[org\.forgerock\.opendj\.ldap\.Assertion getAssertion\(org\.forgerock\.opendj\.ldap\.schema\.Schema, org\.forgerock\.opendj\.ldap\.ByteSequence, java\.util\.List, org\.forgerock\.opendj\.ldap\.ByteSequence\)] - Renamed getAssertion() to getSubstringAssertion() - - - org/forgerock/opendj/ldap/schema/MatchingRuleImpl - 7012 - %regex[org\.forgerock\.opendj\.ldap\.Assertion getSubstringAssertion\(org\.forgerock\.opendj\.ldap\.schema\.Schema, org\.forgerock\.opendj\.ldap\.ByteSequence, java\.util\.List, org\.forgerock\.opendj\.ldap\.ByteSequence\)] - Renamed getAssertion() to getSubstringAssertion() - - - - org/forgerock/opendj/ldap/schema/SchemaValidationPolicy - 7006 - %regex[org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy\$Policy (checkAttributeValues|checkAttributesAndObjectClasses|checkDITContentRules|checkDITStructureRules|checkNameForms|requireSingleStructuralObjectClass)\(\)] - %regex[org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy\$Action] - Renamed SchemaValidationPolicy.Policy to SchemaValidationPolicy.Action - - - org/forgerock/opendj/ldap/schema/SchemaValidationPolicy - 7005 - %regex[org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy (checkAttributeValues|checkAttributesAndObjectClasses|checkDITContentRules|checkDITStructureRules|checkNameForms|requireSingleStructuralObjectClass)\(org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy\$Policy(, org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy\$EntryResolver)?\)] - %regex[org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy (checkAttributeValues|checkAttributesAndObjectClasses|checkDITContentRules|checkDITStructureRules|checkNameForms|requireSingleStructuralObjectClass)\(org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy\$Action(,\s*org\.forgerock\.opendj\.ldap\.schema\.SchemaValidationPolicy\$EntryResolver)?\)] - Renamed SchemaValidationPolicy.Policy to SchemaValidationPolicy.Action - - - org/forgerock/opendj/ldap/schema/SchemaValidationPolicy$Policy - 8001 - Renamed SchemaValidationPolicy.Policy to SchemaValidationPolicy.Action - - - - org/forgerock/opendj/ldap/LDAPListenerOptions - 7002 - org.forgerock.opendj.ldap.LDAPListenerOptions setDecodeOptions(org.forgerock.opendj.ldap.DecodeOptions) - OPENDJ-1197: Method return type has changed due to reification - - - org/forgerock/opendj/ldap/LDAPOptions - 7002 - org.forgerock.opendj.ldap.LDAPOptions setDecodeOptions(org.forgerock.opendj.ldap.DecodeOptions) - OPENDJ-1197: Method return type has changed due to reification - - - - org/forgerock/opendj/ldap/Assertion - 7012 - java.lang.Object createIndexQuery(org.forgerock.opendj.ldap.spi.IndexQueryFactory) - OPENDJ-1308 Migrate schema support: allows decoupling indexing from a specific backend - - - org/forgerock/opendj/ldap/schema/MatchingRuleImpl - 7012 - java.util.Collection getIndexers() - OPENDJ-1308 Migrate schema support: allows decoupling indexing from a specific backend - - - org/forgerock/opendj/ldap/schema/MatchingRuleImpl - 7012 - boolean isIndexingSupported() - OPENDJ-1308 Migrate schema support: allows decoupling indexing from a specific backend - - - org/forgerock/opendj/ldap/*Connection* - 7004 - org.forgerock.opendj.ldap.FutureResult *Async(*org.forgerock.opendj.ldap.ResultHandler) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/schema/Schema - 7004 - org.forgerock.opendj.ldap.FutureResult readSchema*Async*(org.forgerock.opendj.ldap.Connection, org.forgerock.opendj.ldap.DN, org.forgerock.opendj.ldap.ResultHandler) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/*Connection* - 7006 - org.forgerock.opendj.ldap.FutureResult *Async(*org.forgerock.opendj.ldap.ResultHandler) - org.forgerock.util.promise.Promise - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/Connection - 7012 - org.forgerock.opendj.ldap.FutureResult *Async(org.forgerock.opendj.*) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - %regex[org/forgerock/opendj/ldap/(RequestHandler|MemoryBackend)] - 7004 - *handleSearch(*) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/ResultHandler - 7012 - *handleError(org.forgerock.opendj.ldap.ErrorResultException) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/ResultHandler - 7002 - *handleErrorResult(org.forgerock.opendj.ldap.ErrorResultException) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/SearchResultHandler - 4001 - org/forgerock/opendj/ldap/ResultHandler - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/schema/SchemaBuilder - 7004 - org.forgerock.opendj.ldap.FutureResult addSchema*Async(*) - OPENDJ-1285 Migrate SDK from Futures to Promises - - - org/forgerock/opendj/ldap/*Exception - 5001 - org/forgerock/opendj/ldap/ErrorResultException - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/*Exception - 5001 - java/util/concurrent/ExecutionException - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/ConnectionEventListener - 7005 - *handleConnectionError(boolean, org.forgerock.opendj.ldap.ErrorResultException) - *handleConnectionError(boolean, org.forgerock.opendj.ldap.LdapException) - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/ResultHandler - 7012 - *handleError(org.forgerock.opendj.ldap.LdapException) - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/ErrorResult*Exception - 8001 - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/*Connection* - 7006 - *Async* - org.forgerock.opendj.ldap.LdapPromise - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/RootDSE - 7006 - *Async* - org.forgerock.opendj.ldap.LdapPromise - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/schema/Schema* - 7006 - *Async* - org.forgerock.opendj.ldap.LdapPromise - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/Connection - 7012 - org.forgerock.opendj.ldap.LdapPromise *Async(*) - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/FutureResult - 8001 - OPENDJ-1536 Rename FutureResult and ErrorResultException classes hierarchy in the SDK to enhance code consistency - - - org/forgerock/opendj/ldap/Functions - 7002 - *composeFirstP(*) - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - - - org/forgerock/opendj/ldap/Functions - 7002 - *composeSecondP(*) - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - - - org/forgerock/opendj/ldap/Functions - 7002 - *fixedFunction(*) - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - - - org/forgerock/opendj/ldap/Function - 8001 - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - - - org/forgerock/opendj/ldap/AttributeParser - 7005 - *as*(org.forgerock.opendj.ldap.Function*) - *as*(org.forgerock.util.Function*) - - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - - org/forgerock/opendj/ldap/Functions - 7005 - *compose(org.forgerock.opendj.ldap.Function, org.forgerock.opendj.ldap.Function) - *compose(org.forgerock.util.Function, org.forgerock.util.Function) - - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - - org/forgerock/opendj/ldap/Functions - 7006 - * - org.forgerock.util.promise.Function - OPENDJ-1550 Replace SDK Function with Function from forgerock-util - - - org/forgerock/opendj/ldap/DN - 7002 - *toNormalizedString() - *toIrreversibleNormalizedByteString() - OPENDJ-1585 Function has been renamed to avoid abuse - - - %regex[org/forgerock/opendj/ldap/schema/Schema(Builder)?] - 7002 - %regex[(boolean|org.forgerock.opendj.ldap.schema.SchemaBuilder) allow(.)*\((boolean)?\)] - OPENDJ-1478 Make it easier to add compatibility options to schemas - - - org/forgerock/opendj/ldap/ByteSequence - 7012 - java.nio.ByteBuffer copyTo(java.nio.ByteBuffer) - Added new utility method copyTo() for a byte buffer - - - org/forgerock/opendj/ldap/ByteSequence - 7012 - boolean copyTo(java.nio.CharBuffer, java.nio.charset.CharsetDecoder) - OPENDJ-1585: Added new utility method copyTo for a char buffer - - - org/forgerock/opendj/ldap/schema/MatchingRule - 7002 - java.util.Comparator comparator() - OPENDJ-1689 method has been removed because all matching rules should support the default comparator - - - org/forgerock/opendj/ldap/schema/MatchingRuleImpl - 7002 - java.util.Comparator comparator(org.forgerock.opendj.ldap.schema.Schema) - OPENDJ-1689 method has been removed because all matching rules should support the default comparator - - - org/forgerock/opendj/ldap/schema/MatchingRuleImpl - 7012 - java.util.Collection createIndexers(org.forgerock.opendj.ldap.spi.IndexingOptions) - Doesn't really seem correct to call createKeys() with different options each time. - - - org/forgerock/opendj/ldap/ByteSequence - 7012 - boolean startsWith(org.forgerock.opendj.ldap.ByteSequence) - Lack of startsWith() forced to re-implement it multiple times at different location - - - org/forgerock/opendj/ldap/ByteString - 7005 - org.forgerock.opendj.ldap.ByteString valueOf(java.lang.String) - org.forgerock.opendj.ldap.ByteString valueOf(java.lang.String) - org.forgerock.opendj.ldap.ByteString valueOf(java.lang.CharSequence) - Using CharSequence instead of String allows to reduce memory copy. - - - - - org/forgerock/opendj/ldap/Functions - 7006 - * - org.forgerock.util.Function - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - org/forgerock/opendj/ldap/LdapResultHandler - 8000 - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - %regex[org/forgerock/opendj/ldap/(RequestHandler|MemoryBackend)] - 7005 - %regex[(.)* handle*(.)*org\.forgerock\.opendj\.ldap\.ResultHandler(.)*] - %regex[(.)* handle*(.)*org\.forgerock\.opendj\.ldap\.LdapResultHandler(.)*] - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - %regex[org/forgerock/opendj/ldap/responses/(Abstract)?ExtendedResultDecoder] - 7006 - org.forgerock.opendj.ldap.ResultHandler adaptExtendedResultHandler(org.forgerock.opendj.ldap.requests.ExtendedRequest, org.forgerock.opendj.ldap.ResultHandler, org.forgerock.opendj.ldap.DecodeOptions) - org.forgerock.opendj.ldap.LdapResultHandler - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - %regex[org/forgerock/opendj/ldap/responses/(Abstract)?ExtendedResultDecoder] - 7005 - org.forgerock.opendj.ldap.ResultHandler adaptExtendedResultHandler(org.forgerock.opendj.ldap.requests.ExtendedRequest, org.forgerock.opendj.ldap.ResultHandler, org.forgerock.opendj.ldap.DecodeOptions) - org.forgerock.opendj.ldap.ResultHandler adaptExtendedResultHandler(org.forgerock.opendj.ldap.requests.ExtendedRequest, org.forgerock.opendj.ldap.LdapResultHandler, org.forgerock.opendj.ldap.DecodeOptions) - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - org/forgerock/opendj/ldap/RootDSE - 7005 - *readRootDSEAsync(org.forgerock.opendj.ldap.Connection, org.forgerock.opendj.ldap.ResultHandler) - *readRootDSEAsync(org.forgerock.opendj.ldap.Connection, org.forgerock.opendj.ldap.LdapResultHandler) - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - org/forgerock/opendj/ldap/AuthenticatedConnectionFactory$AuthenticatedConnection - 7005 - *bindAsync(org.forgerock.opendj.ldap.requests.BindRequest, org.forgerock.opendj.ldap.IntermediateResponseHandler, org.forgerock.opendj.ldap.ResultHandler) - *bindAsync(org.forgerock.opendj.ldap.requests.BindRequest*org.forgerock.opendj.ldap.IntermediateResponseHandler*org.forgerock.opendj.ldap.LdapResultHandler) - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - org/forgerock/opendj/ldap/ResultHandler - 8001 - OPENDJ-1666 Update sdk to forgerock-util 2.0.0 - - - org/forgerock/opendj/ldap/LDAPListenerOptions - 8001 - OPENDJ-1654: LDAPOptions should be converted in a SchemaOptions style API - - - org/forgerock/opendj/ldap/LDAPOptions - 8001 - OPENDJ-1654: LDAPOptions should be converted in a SchemaOptions style API - - - org/forgerock/opendj/ldap/ByteStringBuilder - 7002 - %regex[(org\.forgerock\.opendj\.ldap\.ByteStringBuilder|int) append\(.*\)] - OPENDJ-1802 ByteStringBuilder.append() => appendByte(), appendShort(), appendInt(), appendLong(), appendBytes(), appendObject() - - - org/forgerock/opendj/ldap/ByteStringBuilder - 7004 - org.forgerock.opendj.ldap.ByteStringBuilder append(byte) - org.forgerock.opendj.ldap.ByteStringBuilder appendByte(int) - OPENDJ-1802 Consider making ByteString / ByteStringBuilder methods more intentional - - - org/forgerock/opendj/ldap/ByteStringBuilder - 7006 - org.forgerock.opendj.ldap.ByteStringBuilder append(byte) - void - OPENDJ-1802 Consider making ByteString / ByteStringBuilder methods more intentional - - - org/forgerock/opendj/ldap/ByteSequenceReader - 7002 - %regex[(\w|\.)+ get\w*\([^)]*\)] - OPENDJ-1802 ByteSequenceReader.get*() => readByte(), readBytes() and read*() - - - org/forgerock/opendj/ldap/ByteString - 7002 - %regex[org\.forgerock\.opendj\.ldap\.ByteString valueOf\([^)]+\)] - OPENDJ-1802 ByteString.valueOf() => valueOfInt(), valueOfLong(), valueOfUtf8(), valueOfBytes(), valueOfObject() - - - org/forgerock/opendj/ldap/Connections - 7002 - *newAuthenticatedConnectionFactory* - OPENDJ-1607: merge authenticated and heart-beat connection factories into - LDAPConnectionFactory. Pre-authenticated connection support is now part of - LDAPConnectionFactory and can be enabled by specifying the AUTHN_BIND_REQUEST option. - - - org/forgerock/opendj/ldap/Connections - 7002 - *newHeartBeatConnectionFactory* - OPENDJ-1607: merge authenticated and heart-beat connection factories into - LDAPConnectionFactory. Heart-beat support is now part of - LDAPConnectionFactory and can be configured using the HEARTBEAT_* options. - - - org/forgerock/opendj/ldap/AuthenticatedConnectionFactory* - 8001 - OPENDJ-1607: merge authenticated and heart-beat connection factories into - LDAPConnectionFactory. Pre-authenticated connection support is now part of - LDAPConnectionFactory and can be enabled by specifying the AUTHN_BIND_REQUEST option. - - - org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest - 7012 - *addEnabled*(java.util.Collection) - OPENDJ-1607: added Collection based addEnabled* methods - - - org/forgerock/opendj/ldap/AttributeParser - 7014 - java.util.Set asSetOf(org.forgerock.opendj.ldap.Function, java.lang.Object[]) - Method needs to be final in order to use SafeVarArgs annotation - - - org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm - 1001 - Class instances are now created using Connections.newFailoverLoadBalancer - - - org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm - 1001 - Class instances are now created using Connections.newRoundRobinLoadBalancer - - diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java b/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java deleted file mode 100644 index df1bafb8c..000000000 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -/** - * Classes implementing Sun proprietary LDAP controls. - */ -package com.forgerock.opendj.ldap.controls; - diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java b/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java deleted file mode 100644 index f965c18cd..000000000 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package com.forgerock.opendj.ldap.extensions; - -import org.forgerock.opendj.ldap.ByteString; - -/** - * Password policy state operation. - */ -public interface PasswordPolicyStateOperation { - /** - * Returns the type of operation. - * - * @return The type of operation. - */ - PasswordPolicyStateOperationType getOperationType(); - - /** - * Returns the operation values. - * - * @return The operation values. - */ - Iterable getValues(); -} diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java b/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java deleted file mode 100644 index 7bc9d5652..000000000 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -/** - * Classes implementing Sun proprietary LDAP extended operations. - */ -package com.forgerock.opendj.ldap.extensions; - diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/package-info.java b/opendj-core/src/main/java/com/forgerock/opendj/util/package-info.java deleted file mode 100644 index 8626357f7..000000000 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -/** - * Classes providing utility functionality. - */ -package com.forgerock.opendj.util; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/io/package-info.java deleted file mode 100644 index ad6a68111..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/package-info.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. - */ - -/** - * Classes and interfaces providing I/O functionality. - *

- * It includes facilities for encoding and decoding ASN.1 data streams, as - * well as LDAP protocol messages. - *

- * Note that this particular implementation is limited to the subset of elements - * that are typically used by LDAP clients. As such, it does not include all - * ASN.1 element types, particularly elements like OIDs, bit strings, and - * timestamp values. - */ -package org.forgerock.opendj.io; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java deleted file mode 100644 index a653cef42..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.opendj.ldap.responses.Result; - -/** - * Thrown when the result code returned in a Result indicates that the Request - * failed because the filter contained in an assertion control failed to match - * the target entry. More specifically, this exception is used for the - * {@link ResultCode#ASSERTION_FAILED ASSERTION_FAILED} result code. - */ -@SuppressWarnings("serial") -public class AssertionFailureException extends LdapException { - AssertionFailureException(final Result result) { - super(result); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java deleted file mode 100644 index 04aff9557..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -/** - * Attribute factories are included with a set of {@code DecodeOptions} in order - * to allow application to control how {@code Attribute} instances are created - * when decoding requests and responses. - * - * @see Attribute - * @see DecodeOptions - */ -public interface AttributeFactory { - /** - * Creates an attribute using the provided attribute description and no - * values. - * - * @param attributeDescription - * The attribute description. - * @return The new attribute. - * @throws NullPointerException - * If {@code attributeDescription} was {@code null}. - */ - Attribute newAttribute(AttributeDescription attributeDescription); -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java deleted file mode 100644 index 08ae43da0..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.opendj.ldap.responses.Result; - -/** - * Thrown when the result code returned in a Result indicates that the Request - * was cancelled. More specifically, this exception is used for the following - * error result codes: - *

    - *
  • {@link ResultCode#CANCELLED CANCELLED} - the requested operation was - * cancelled. - *
  • {@link ResultCode#CLIENT_SIDE_USER_CANCELLED CLIENT_SIDE_USER_CANCELLED} - * - the requested operation was cancelled by the user. - *
- */ -@SuppressWarnings("serial") -public class CancelledResultException extends LdapException { - CancelledResultException(final Result result) { - super(result); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java deleted file mode 100644 index 95d407400..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.opendj.ldap.responses.Result; - -/** - * Thrown when the result code returned in a Result indicates that the Request - * was unsuccessful because of a connection failure. - */ -@SuppressWarnings("serial") -public class ConnectionException extends LdapException { - ConnectionException(final Result result) { - super(result); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java deleted file mode 100644 index ef94ccc95..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -/** - * Entry factories are included with a set of {@code DecodeOptions} in order to - * allow application to control how {@code Entry} instances are created when - * decoding requests and responses. - * - * @see Entry - * @see DecodeOptions - */ -public interface EntryFactory { - /** - * Creates an empty entry using the provided distinguished name and no - * attributes. - * - * @param name - * The distinguished name of the entry to be created. - * @return The new entry. - * @throws NullPointerException - * If {@code name} was {@code null}. - */ - Entry newEntry(DN name); -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java deleted file mode 100644 index 7290b01ad..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/FailoverLoadBalancingAlgorithm.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -import java.util.Collection; - -import org.forgerock.util.Options; - -/** - * A fail-over load balancing algorithm provides fault tolerance across multiple - * underlying connection factories. - */ -final class FailoverLoadBalancingAlgorithm extends AbstractLoadBalancingAlgorithm { - FailoverLoadBalancingAlgorithm(final Collection factories, final Options options) { - super(factories, options); - } - - @Override - String getAlgorithmName() { - return "Failover"; - } - - @Override - int getInitialConnectionFactoryIndex() { - // Always start with the first connection factory. - return 0; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java deleted file mode 100644 index 90e89c25b..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.util.Reject; -import org.forgerock.util.promise.Promise; - -import static org.forgerock.util.promise.Promises.*; - -/** - * A load balancing connection factory allocates connections using the provided - * algorithm. - */ -final class LoadBalancer implements ConnectionFactory { - private final LoadBalancingAlgorithm algorithm; - - LoadBalancer(final LoadBalancingAlgorithm algorithm) { - Reject.ifNull(algorithm); - this.algorithm = algorithm; - } - - @Override - public void close() { - // Delegate to the algorithm. - algorithm.close(); - } - - @Override - public Connection getConnection() throws LdapException { - return algorithm.getConnectionFactory().getConnection(); - } - - @Override - public Promise getConnectionAsync() { - final ConnectionFactory factory; - - try { - factory = algorithm.getConnectionFactory(); - } catch (final LdapException e) { - return newExceptionPromise(e); - } - - return factory.getConnectionAsync(); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("LoadBalancer("); - builder.append(algorithm); - builder.append(')'); - return builder.toString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java deleted file mode 100644 index eebdead5e..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancingAlgorithm.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2013-2015 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -import static org.forgerock.util.time.Duration.duration; - -import java.io.Closeable; -import java.util.concurrent.ScheduledExecutorService; - -import org.forgerock.util.Option; -import org.forgerock.util.time.Duration; - -/** - * A load balancing algorithm distributes connection requests across one or more underlying connection factories in an - * implementation defined manner. - * - * @see Connections#newLoadBalancer(LoadBalancingAlgorithm) - */ -public interface LoadBalancingAlgorithm extends Closeable { - /** - * Specifies the interval between successive attempts to reconnect to offline load-balanced connection factories. - * The default configuration is to attempt to reconnect every second. - */ - Option LOAD_BALANCER_MONITORING_INTERVAL = Option.withDefault(duration("1 seconds")); - - /** - * Specifies the event listener which should be notified whenever a load-balanced connection factory changes state - * from online to offline or vice-versa. By default events will be logged to the {@code LoadBalancingAlgorithm} - * logger using the {@link LoadBalancerEventListener#LOG_EVENTS} listener. - */ - Option LOAD_BALANCER_EVENT_LISTENER = - Option.of(LoadBalancerEventListener.class, LoadBalancerEventListener.LOG_EVENTS); - - /** - * Specifies the scheduler which will be used for periodically reconnecting to offline connection factories. A - * system-wide scheduler will be used by default. - */ - Option LOAD_BALANCER_SCHEDULER = Option.of(ScheduledExecutorService.class, null); - - /** - * Releases any resources associated with this algorithm, including any associated connection factories. - */ - @Override - void close(); - - /** - * Returns a connection factory which should be used in order to satisfy the next connection request. - * - * @return The connection factory. - * @throws LdapException - * If no connection factories are available for use. - */ - ConnectionFactory getConnectionFactory() throws LdapException; -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java deleted file mode 100644 index abc265ef2..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.opendj.ldap.responses.Result; - -/** - * Thrown when the result code returned in a Result indicates that the requested - * single entry search operation or read operation failed because the Directory - * Server returned multiple matching entries (or search references) when only a - * single matching entry was expected. More specifically, this exception is used - * for the {@link ResultCode#CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED - * CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED} error result codes. - */ -@SuppressWarnings("serial") -public class MultipleEntriesFoundException extends LdapException { - MultipleEntriesFoundException(final Result result) { - super(result); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ReferralException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/ReferralException.java deleted file mode 100644 index 37df786c9..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ReferralException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.opendj.ldap.responses.Result; - -/** - * Thrown when the result code returned in a Result indicates that the Request - * could not be processed by the Directory Server because the target entry is - * located on another server. More specifically, this exception is used for the - * {@link ResultCode#REFERRAL REFERRAL} result code. - */ -@SuppressWarnings("serial") -public class ReferralException extends EntryNotFoundException { - ReferralException(final Result result) { - super(result); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java deleted file mode 100644 index 997fdaf7d..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RoundRobinLoadBalancingAlgorithm.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -import java.util.Collection; -import java.util.concurrent.atomic.AtomicInteger; - -import org.forgerock.util.Options; - -/** - * A round robin load balancing algorithm distributes connection requests across a list of - * connection factories one at a time. When the end of the list is reached, the algorithm starts again from the - * beginning. - */ -final class RoundRobinLoadBalancingAlgorithm extends AbstractLoadBalancingAlgorithm { - private final int maxIndex; - private final AtomicInteger nextIndex = new AtomicInteger(-1); - - RoundRobinLoadBalancingAlgorithm(final Collection factories, final Options options) { - super(factories, options); - this.maxIndex = factories.size(); - } - - @Override - String getAlgorithmName() { - return "RoundRobin"; - } - - @Override - int getInitialConnectionFactoryIndex() { - // A round robin pool of one connection factories is unlikely in - // practice and requires special treatment. - if (maxIndex == 1) { - return 0; - } - - // Determine the next factory to use: avoid blocking algorithm. - int oldNextIndex; - int newNextIndex; - do { - oldNextIndex = nextIndex.get(); - newNextIndex = oldNextIndex + 1; - if (newNextIndex == maxIndex) { - newNextIndex = 0; - } - } while (!nextIndex.compareAndSet(oldNextIndex, newNextIndex)); - - // There's a potential, but benign, race condition here: other threads - // could jump in and rotate through the list before we return the - // connection factory. - return newNextIndex; - } - -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java deleted file mode 100644 index 86e4d3eac..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap; - -import org.forgerock.opendj.ldap.responses.Result; - -/** - * Thrown when the result code returned in a Result indicates that the Request - * was aborted because it did not complete in the required time out period. - */ -@SuppressWarnings("serial") -public class TimeoutResultException extends LdapException { - TimeoutResultException(final Result result) { - super(result); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java deleted file mode 100755 index bbffb97f2..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - */ - -/** - * Classes and interfaces for common LDAP controls. - */ -package org.forgerock.opendj.ldap.controls; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/package-info.java deleted file mode 100755 index 40d6bd0ce..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/package-info.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - */ - -/** - * Classes and interfaces for core types including connections, entries, and - * attributes. - */ -package org.forgerock.opendj.ldap; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java deleted file mode 100644 index e310a3deb..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * An abstract Bind request which can be used as the basis for implementing new - * authentication methods. - * - * @param - * The type of Bind request. - */ -abstract class AbstractBindRequest extends AbstractRequestImpl implements - BindRequest { - - AbstractBindRequest() { - // Nothing to do. - } - - AbstractBindRequest(final BindRequest bindRequest) { - super(bindRequest); - } - - @Override - public abstract String getName(); - - @Override - @SuppressWarnings("unchecked") - final R getThis() { - return (R) this; - } - -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java deleted file mode 100644 index 4e6bfe1f2..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -import org.forgerock.opendj.io.LDAP; - -/** - * An abstract SASL Bind request which can be used as the basis for implementing - * new SASL authentication methods. - * - * @param - * The type of SASL Bind request. - */ -abstract class AbstractSASLBindRequest extends AbstractBindRequest - implements SASLBindRequest { - - AbstractSASLBindRequest() { - - } - - AbstractSASLBindRequest(final SASLBindRequest saslBindRequest) { - super(saslBindRequest); - } - - @Override - public final byte getAuthenticationType() { - return LDAP.TYPE_AUTHENTICATION_SASL; - } - - @Override - public final String getName() { - return "".intern(); - } - -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java deleted file mode 100644 index 172023030..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap.requests; - -import org.forgerock.opendj.ldap.LdapException; - -/** - * An abstract unmodifiable Bind request which can be used as the basis for - * implementing new unmodifiable authentication methods. - * - * @param - * The type of Bind request. - */ -abstract class AbstractUnmodifiableBindRequest extends - AbstractUnmodifiableRequest implements BindRequest { - - AbstractUnmodifiableBindRequest(final R impl) { - super(impl); - } - - @Override - public BindClient createBindClient(final String serverName) throws LdapException { - return impl.createBindClient(serverName); - } - - @Override - public byte getAuthenticationType() { - return impl.getAuthenticationType(); - } - - @Override - public String getName() { - return impl.getName(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java deleted file mode 100644 index d821452ec..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * An abstract unmodifiable SASL Bind request which can be used as the basis for - * implementing new unmodifiable SASL authentication methods. - * - * @param - * The type of SASL Bind request. - */ -abstract class AbstractUnmodifiableSASLBindRequest extends - AbstractUnmodifiableBindRequest implements SASLBindRequest { - - AbstractUnmodifiableSASLBindRequest(final R impl) { - super(impl); - } - - @Override - public String getSASLMechanism() { - return impl.getSASLMechanism(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java deleted file mode 100644 index d138eda50..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -import java.util.List; - -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; - -/** - * The Unbind operation allows a client to terminate an LDAP session. - */ -public interface UnbindRequest extends Request { - - @Override - UnbindRequest addControl(Control control); - - @Override - C getControl(ControlDecoder decoder, DecodeOptions options) - throws DecodeException; - - @Override - List getControls(); -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java deleted file mode 100644 index 92efdb607..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * Unbind request implementation. - */ -final class UnbindRequestImpl extends AbstractRequestImpl implements UnbindRequest { - - UnbindRequestImpl() { - // Do nothing. - } - - UnbindRequestImpl(final UnbindRequest unbindRequest) { - super(unbindRequest); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("UnbindRequest(controls="); - builder.append(getControls()); - builder.append(")"); - return builder.toString(); - } - - @Override - UnbindRequest getThis() { - return this; - } - -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java deleted file mode 100644 index 591bcca8d..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * Unmodifiable abandon request implementation. - */ -final class UnmodifiableAbandonRequestImpl extends AbstractUnmodifiableRequest - implements AbandonRequest { - UnmodifiableAbandonRequestImpl(final AbandonRequest request) { - super(request); - } - - @Override - public int getRequestID() { - return impl.getRequestID(); - } - - @Override - public AbandonRequest setRequestID(final int id) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java deleted file mode 100644 index 626dbbdba..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * Unmodifiable anonymous SASL bind request implementation. - */ -final class UnmodifiableAnonymousSASLBindRequestImpl extends - AbstractUnmodifiableSASLBindRequest implements - AnonymousSASLBindRequest { - UnmodifiableAnonymousSASLBindRequestImpl(final AnonymousSASLBindRequest impl) { - super(impl); - } - - @Override - public String getTraceString() { - return impl.getTraceString(); - } - - @Override - public AnonymousSASLBindRequest setTraceString(final String traceString) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java deleted file mode 100644 index 10f2bc459..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -import org.forgerock.opendj.ldap.responses.ExtendedResult; - -/** - * Unmodifiable cancel extended request implementation. - */ -final class UnmodifiableCancelExtendedRequestImpl extends - AbstractUnmodifiableExtendedRequest implements - CancelExtendedRequest { - UnmodifiableCancelExtendedRequestImpl(final CancelExtendedRequest impl) { - super(impl); - } - - @Override - public int getRequestID() { - return impl.getRequestID(); - } - - @Override - public CancelExtendedRequest setRequestID(final int id) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java deleted file mode 100644 index 3625e66db..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -import org.forgerock.opendj.ldap.DN; -import org.forgerock.opendj.ldif.ChangeRecordVisitor; - -/** - * Unmodifiable delete request implementation. - */ -final class UnmodifiableDeleteRequestImpl extends AbstractUnmodifiableRequest - implements DeleteRequest { - UnmodifiableDeleteRequestImpl(final DeleteRequest impl) { - super(impl); - } - - @Override - public R accept(final ChangeRecordVisitor v, final P p) { - return v.visitChangeRecord(p, this); - } - - @Override - public DN getName() { - return impl.getName(); - } - - @Override - public DeleteRequest setName(final DN dn) { - throw new UnsupportedOperationException(); - } - - @Override - public DeleteRequest setName(final String dn) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java deleted file mode 100644 index b61fecb72..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * Unmodifiable external SASL bind request implementation. - */ -final class UnmodifiableExternalSASLBindRequestImpl extends - AbstractUnmodifiableSASLBindRequest implements - ExternalSASLBindRequest { - UnmodifiableExternalSASLBindRequestImpl(final ExternalSASLBindRequest impl) { - super(impl); - } - - @Override - public String getAuthorizationID() { - return impl.getAuthorizationID(); - } - - @Override - public ExternalSASLBindRequest setAuthorizationID(final String authorizationID) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java deleted file mode 100644 index 4ec7bc65f..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.requests; - -import org.forgerock.opendj.ldap.responses.GenericExtendedResult; - -/** - * Unmodifiable generic extended request implementation. - */ -final class UnmodifiableGenericExtendedRequestImpl extends - AbstractUnmodifiableExtendedRequest - implements GenericExtendedRequest { - UnmodifiableGenericExtendedRequestImpl(final GenericExtendedRequest impl) { - super(impl); - } - - @Override - public GenericExtendedRequest setOID(final String oid) { - throw new UnsupportedOperationException(); - } - - @Override - public GenericExtendedRequest setValue(final Object value) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java deleted file mode 100644 index 43b5c3591..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.requests; - -/** - * Unmodifiable unbind request implementation. - */ -final class UnmodifiableUnbindRequestImpl extends AbstractUnmodifiableRequest - implements UnbindRequest { - UnmodifiableUnbindRequestImpl(final UnbindRequest impl) { - super(impl); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java deleted file mode 100644 index e990af49c..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.requests; - -import org.forgerock.opendj.ldap.responses.WhoAmIExtendedResult; - -/** - * Unmodifiable Who Am I extended request implementation. - */ -final class UnmodifiableWhoAmIExtendedRequestImpl extends - AbstractUnmodifiableExtendedRequest implements - WhoAmIExtendedRequest { - UnmodifiableWhoAmIExtendedRequestImpl(final WhoAmIExtendedRequest impl) { - super(impl); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java deleted file mode 100755 index 8805522b5..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -/** - * Classes and interfaces for core LDAP requests. - */ -package org.forgerock.opendj.ldap.requests; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java deleted file mode 100644 index 100cd8385..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.responses; - -import org.forgerock.opendj.ldap.ByteString; - -/** - * An abstract unmodifiable Extended result which can be used as the basis for - * implementing new unmodifiable Extended operations. - * - * @param - * The type of Extended result. - */ -abstract class AbstractUnmodifiableExtendedResultImpl extends - AbstractUnmodifiableResultImpl implements ExtendedResult { - AbstractUnmodifiableExtendedResultImpl(final S impl) { - super(impl); - } - - @Override - public String getOID() { - return impl.getOID(); - } - - @Override - public ByteString getValue() { - return impl.getValue(); - } - - @Override - public boolean hasValue() { - return impl.hasValue(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java deleted file mode 100644 index dc98f24d7..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.responses; - -import org.forgerock.opendj.ldap.ByteString; - -/** - * An abstract unmodifiable Intermediate response which can be used as the basis - * for implementing new unmodifiable Intermediate responses. - * - * @param - * The type of Intermediate response. - */ -abstract class AbstractUnmodifiableIntermediateResponseImpl extends - AbstractUnmodifiableResponseImpl implements IntermediateResponse { - AbstractUnmodifiableIntermediateResponseImpl(final S impl) { - super(impl); - } - - @Override - public String getOID() { - return impl.getOID(); - } - - @Override - public ByteString getValue() { - return impl.getValue(); - } - - @Override - public boolean hasValue() { - return impl.hasValue(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java deleted file mode 100644 index 14ef66650..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -import org.forgerock.opendj.ldap.ByteString; - -/** - * Unmodifiable Bind result implementation. - */ -class UnmodifiableBindResultImpl extends AbstractUnmodifiableResultImpl implements - BindResult { - UnmodifiableBindResultImpl(final BindResult impl) { - super(impl); - } - - @Override - public ByteString getServerSASLCredentials() { - return impl.getServerSASLCredentials(); - } - - @Override - public boolean isSASLBindInProgress() { - return impl.isSASLBindInProgress(); - } - - @Override - public BindResult setServerSASLCredentials(final ByteString credentials) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java deleted file mode 100644 index 021776a84..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.responses; - -/** - * Unmodifiable Compare result implementation. - */ -class UnmodifiableCompareResultImpl extends AbstractUnmodifiableResultImpl implements - CompareResult { - UnmodifiableCompareResultImpl(final CompareResult impl) { - super(impl); - } - - @Override - public boolean matched() { - return impl.matched(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java deleted file mode 100644 index d5b815607..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -/** - * Unmodifiable Generic extended result implementation. - */ -class UnmodifiableGenericExtendedResultImpl extends - AbstractUnmodifiableExtendedResultImpl implements ExtendedResult, - GenericExtendedResult { - UnmodifiableGenericExtendedResultImpl(final GenericExtendedResult impl) { - super(impl); - } - - @Override - public GenericExtendedResult setOID(final String oid) { - throw new UnsupportedOperationException(); - } - - @Override - public GenericExtendedResult setValue(final Object value) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java deleted file mode 100644 index fb1e5799d..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -/** - * Unmodifiable Generic extended result implementation. - */ -class UnmodifiableGenericIntermediateResponseImpl extends - AbstractUnmodifiableIntermediateResponseImpl implements - GenericIntermediateResponse { - UnmodifiableGenericIntermediateResponseImpl(final GenericIntermediateResponse impl) { - super(impl); - } - - @Override - public GenericIntermediateResponse setOID(final String oid) { - throw new UnsupportedOperationException(); - } - - @Override - public GenericIntermediateResponse setValue(final Object value) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java deleted file mode 100644 index f7960ed6d..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -/** - * Unmodifiable Password modify extended result implementation. - */ -class UnmodifiablePasswordModifyExtendedResultImpl extends - AbstractUnmodifiableExtendedResultImpl implements - PasswordModifyExtendedResult { - UnmodifiablePasswordModifyExtendedResultImpl(final PasswordModifyExtendedResult impl) { - super(impl); - } - - @Override - public byte[] getGeneratedPassword() { - return impl.getGeneratedPassword(); - } - - @Override - public PasswordModifyExtendedResult setGeneratedPassword(final byte[] password) { - throw new UnsupportedOperationException(); - } - - @Override - public PasswordModifyExtendedResult setGeneratedPassword(final char[] password) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java deleted file mode 100644 index 8bd82bfbc..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.responses; - -/** - * A unmodifiable generic result indicates the final status of an operation. - */ -class UnmodifiableResultImpl extends AbstractUnmodifiableResultImpl implements Result { - UnmodifiableResultImpl(final Result impl) { - super(impl); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java deleted file mode 100644 index 6fb4116f8..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -import java.util.List; - -/** - * Unmodifiable Search result reference implementation. - */ -class UnmodifiableSearchResultReferenceImpl extends - AbstractUnmodifiableResponseImpl implements SearchResultReference { - UnmodifiableSearchResultReferenceImpl(final SearchResultReference impl) { - super(impl); - } - - @Override - public SearchResultReference addURI(final String uri) { - throw new UnsupportedOperationException(); - } - - @Override - public List getURIs() { - return impl.getURIs(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java deleted file mode 100644 index d4339327b..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -/** - * Unmodifiable Who Am I extended result implementation. - */ -class UnmodifiableWhoAmIExtendedResultImpl extends - AbstractUnmodifiableExtendedResultImpl implements - WhoAmIExtendedResult { - UnmodifiableWhoAmIExtendedResultImpl(final WhoAmIExtendedResult impl) { - super(impl); - } - - @Override - public String getAuthorizationID() { - return impl.getAuthorizationID(); - } - - @Override - public WhoAmIExtendedResult setAuthorizationID(final String authorizationID) { - throw new UnsupportedOperationException(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java deleted file mode 100755 index 721ed0de0..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -/** - * Classes and interfaces for core LDAP responses. - */ -package org.forgerock.opendj.ldap.responses; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java deleted file mode 100644 index 7fefd8653..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -/** - * This class defines the set of methods and structures that must be implemented - * to define a new attribute syntax. - */ -abstract class AbstractSyntaxImpl implements SyntaxImpl { - AbstractSyntaxImpl() { - // Nothing to do. - } - - public String getApproximateMatchingRule() { - return null; - } - - public String getEqualityMatchingRule() { - return null; - } - - public String getOrderingMatchingRule() { - return null; - } - - public String getSubstringMatchingRule() { - return null; - } - - public boolean isBEREncodingRequired() { - return false; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java deleted file mode 100644 index 03941283c..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BINARY_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class defines the binary attribute syntax, which is essentially a byte - * array using very strict matching. Equality, ordering, and substring matching - * will be allowed by default. - */ -final class BinarySyntaxImpl extends AbstractSyntaxImpl { - @Override - public String getEqualityMatchingRule() { - return EMR_OCTET_STRING_OID; - } - - public String getName() { - return SYNTAX_BINARY_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_OCTET_STRING_OID; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // All values will be acceptable for the binary syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java deleted file mode 100644 index 4e59cc1fa..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_BOOLEAN_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BOOLEAN_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class defines the Boolean attribute syntax, which only allows values of - * "TRUE" or "FALSE" (although this implementation is more flexible and will - * also allow "YES", "ON", or "1" instead of "TRUE", or "NO", "OFF", or "0" - * instead of "FALSE"). Only equality matching is allowed by default for this - * syntax. - */ -final class BooleanSyntaxImpl extends AbstractSyntaxImpl { - @Override - public String getEqualityMatchingRule() { - return EMR_BOOLEAN_OID; - } - - public String getName() { - return SYNTAX_BOOLEAN_NAME; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - final String valueString = value.toString().toUpperCase(); - - if (!"TRUE".equals(valueString) && !"YES".equals(valueString) - && !"ON".equals(valueString) && !"1".equals(valueString) - && !"FALSE".equals(valueString) && !"NO".equals(valueString) - && !"OFF".equals(valueString) && !"0".equals(valueString)) { - invalidReason.append(WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN.get(value.toString())); - } - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java deleted file mode 100644 index c1838469c..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -import static com.forgerock.opendj.util.StringPrepProfile.*; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -/** - * This class defines the caseExactMatch matching rule defined in X.520 and - * referenced in RFC 4519. - */ -final class CaseExactEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { - - CaseExactEqualityMatchingRuleImpl() { - super(EMR_CASE_EXACT_NAME); - } - - @Override - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeStringAttributeValue(value, TRIM, NO_CASE_FOLD); - } - - @Override - public String keyToHumanReadableString(ByteSequence key) { - return key.toString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java deleted file mode 100644 index ea7084d51..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -import static com.forgerock.opendj.util.StringPrepProfile.*; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -/** - * This class defines the caseExactOrderingMatch matching rule defined in X.520 - * and referenced in RFC 4519. - */ -final class CaseExactOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { - - public CaseExactOrderingMatchingRuleImpl() { - // Reusing equality index since OPENDJ-1864 - super(EMR_CASE_EXACT_NAME); - } - - @Override - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeStringAttributeValue(value, TRIM, NO_CASE_FOLD); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java deleted file mode 100644 index 271e48392..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static com.forgerock.opendj.util.StringPrepProfile.*; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This class defines the caseIgnoreMatch matching rule defined in X.520 and - * referenced in RFC 2252. - */ -final class CaseIgnoreEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { - - CaseIgnoreEqualityMatchingRuleImpl() { - super(EMR_CASE_IGNORE_NAME); - } - - @Override - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeStringAttributeValue(value, TRIM, CASE_FOLD); - } - - @Override - public String keyToHumanReadableString(ByteSequence key) { - return key.toString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java deleted file mode 100644 index fbec64405..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -import static com.forgerock.opendj.util.StringPrepProfile.*; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -/** - * This class implements the caseIgnoreListMatch matching rule defined in X.520 - * and referenced in RFC 2252. - */ -final class CaseIgnoreListEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { - - CaseIgnoreListEqualityMatchingRuleImpl() { - super(EMR_CASE_IGNORE_LIST_NAME); - } - - @Override - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeStringListAttributeValue(value, TRIM, CASE_FOLD); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java deleted file mode 100644 index dae024d95..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -import static com.forgerock.opendj.util.StringPrepProfile.*; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -/** - * This class defines the caseIgnoreOrderingMatch matching rule defined in X.520 - * and referenced in RFC 2252. - */ -final class CaseIgnoreOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { - - public CaseIgnoreOrderingMatchingRuleImpl() { - // Reusing equality index since OPENDJ-1864 - super(EMR_CASE_IGNORE_NAME); - } - - @Override - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeStringAttributeValue(value, TRIM, CASE_FOLD); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactAssertionSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactAssertionSyntaxImpl.java deleted file mode 100644 index c16179933..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactAssertionSyntaxImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 Manuel Gaupp - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTIFICATE_EXACT_ASSERTION_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class defines the Certificate Exact Assertion attribute syntax, which - * contains components for matching X.509 certificates. - */ -final class CertificateExactAssertionSyntaxImpl extends AbstractSyntaxImpl { - - /** {@inheritDoc} */ - public String getName() { - return SYNTAX_CERTIFICATE_EXACT_ASSERTION_NAME; - } - - /** {@inheritDoc} */ - @Override - public boolean isBEREncodingRequired() { - return false; - } - - /** {@inheritDoc} */ - public boolean isHumanReadable() { - return true; - } - - /** {@inheritDoc} */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // This method will never be called because this syntax is only used - // within assertions. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java deleted file mode 100644 index a5af1f8ea..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTLIST_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the certificate list attribute syntax. This should be - * restricted to holding only X.509 certificate lists, but we will accept any - * set of bytes. It will be treated much like the octet string attribute syntax. - */ -final class CertificateListSyntaxImpl extends AbstractSyntaxImpl { - - @Override - public String getEqualityMatchingRule() { - return EMR_OCTET_STRING_OID; - } - - public String getName() { - return SYNTAX_CERTLIST_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_OCTET_STRING_OID; - } - - @Override - public boolean isBEREncodingRequired() { - return true; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // All values will be acceptable for the certificate list syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java deleted file mode 100644 index 91f91e8b1..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTPAIR_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the certificate pair attribute syntax. This should be - * restricted to holding only X.509 certificate pairs, but we will accept any - * set of bytes. It will be treated much like the octet string attribute syntax. - */ -final class CertificatePairSyntaxImpl extends AbstractSyntaxImpl { - @Override - public String getEqualityMatchingRule() { - return EMR_OCTET_STRING_OID; - } - - public String getName() { - return SYNTAX_CERTPAIR_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_OCTET_STRING_OID; - } - - @Override - public boolean isBEREncodingRequired() { - return true; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // All values will be acceptable for the certificate pair syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java deleted file mode 100644 index deb526ae5..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import org.forgerock.i18n.LocalizableMessage; -import org.forgerock.i18n.LocalizedIllegalArgumentException; - -/** - * Thrown when addition of a schema element to a schema builder fails because - * the OID of the schema element conflicts with an existing schema element and - * the caller explicitly requested not to override existing schema elements. - */ -@SuppressWarnings("serial") -public class ConflictingSchemaElementException extends LocalizedIllegalArgumentException { - /** - * Creates a new conflicting schema element exception with the provided - * message. - * - * @param message - * The message that explains the problem that occurred. - */ - public ConflictingSchemaElementException(final LocalizableMessage message) { - super(message); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DelayedSchema.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DelayedSchema.java deleted file mode 100644 index 30ae44a97..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DelayedSchema.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2014 ForgeRock AS - */ - -package org.forgerock.opendj.ldap.schema; - -/** - * This class is used to maintain a reference to the global schemas and avoids - * having to reference the core schema in the {@link Schema} class since this - * can cause initialization errors because the CoreSchema depends on Schema. - */ -final class DelayedSchema { - static final Schema EMPTY_SCHEMA = new SchemaBuilder("Empty Schema").toSchema().asNonStrictSchema(); - static volatile Schema defaultSchema = Schema.getCoreSchema(); - - private DelayedSchema() { - // Prevent instantiation. - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java deleted file mode 100644 index 58460c395..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_FAX_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the fax attribute syntax. This should be restricted to - * holding only fax message contents, but we will accept any set of bytes. It - * will be treated much like the octet string attribute syntax. - */ -final class FaxSyntaxImpl extends AbstractSyntaxImpl { - - @Override - public String getEqualityMatchingRule() { - return EMR_OCTET_STRING_OID; - } - - public String getName() { - return SYNTAX_FAX_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_OCTET_STRING_OID; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // All values will be acceptable for the fax syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java deleted file mode 100644 index 3107ae036..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; -import org.forgerock.opendj.ldap.DecodeException; - -/** - * This class defines the generalizedTimeOrderingMatch matching rule defined in - * X.520 and referenced in RFC 2252. - */ -final class GeneralizedTimeOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { - - GeneralizedTimeOrderingMatchingRuleImpl() { - // Reusing equality index since OPENDJ-1864 - super(EMR_GENERALIZED_TIME_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { - return GeneralizedTimeEqualityMatchingRuleImpl.normalizeAttributeValue(value); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java deleted file mode 100644 index 71ed13d7b..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java +++ /dev/null @@ -1,347 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 Manuel Gaupp - * Portions Copyright 2015 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.schema; - -import java.util.Arrays; -import java.util.Calendar; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; -import java.util.Set; -import java.util.SortedMap; -import java.util.TreeMap; - -/** - * Tool for generating CoreSchema.java. - */ -final class GenerateCoreSchema { - private static final Set ABBREVIATIONS = new HashSet<>(Arrays.asList("SASL", - "LDAP", "DN", "DIT", "RDN", "JPEG", "OID", "UUID", "IA5", "UID", "UTC", "X500", "X121", - "C", "CN", "O", "OU", "L", "DC", "ISDN", "SN", "ST")); - - /** - * Tool for generating CoreSchema.java. - * - * @param args - * The command line arguments (none required). - */ - public static void main(final String[] args) { - testSplitNameIntoWords(); - - final Schema schema = Schema.getCoreSchema(); - - final SortedMap syntaxes = new TreeMap<>(); - for (final Syntax syntax : schema.getSyntaxes()) { - if (isOpenDSOID(syntax.getOID())) { - continue; - } - - final String name = syntax.getDescription().replaceAll(" Syntax$", ""); - final String fieldName = name.replace(" ", "_").replaceAll("[.-]", "") - .toUpperCase(Locale.ENGLISH).concat("_SYNTAX"); - syntaxes.put(fieldName, syntax); - } - - final SortedMap matchingRules = new TreeMap<>(); - for (final MatchingRule matchingRule : schema.getMatchingRules()) { - if (isOpenDSOID(matchingRule.getOID()) || isCollationMatchingRule(matchingRule.getOID())) { - continue; - } - - final String name = matchingRule.getNameOrOID().replaceAll("Match$", ""); - final String fieldName = splitNameIntoWords(name).concat("_MATCHING_RULE"); - matchingRules.put(fieldName, matchingRule); - } - - final SortedMap attributeTypes = new TreeMap<>(); - for (final AttributeType attributeType : schema.getAttributeTypes()) { - if (isOpenDSOID(attributeType.getOID())) { - continue; - } - final String name = attributeType.getNameOrOID(); - final String fieldName = splitNameIntoWords(name).concat("_ATTRIBUTE_TYPE"); - attributeTypes.put(fieldName, attributeType); - } - - final SortedMap objectClasses = new TreeMap<>(); - for (final ObjectClass objectClass : schema.getObjectClasses()) { - if (isOpenDSOID(objectClass.getOID())) { - continue; - } - final String name = objectClass.getNameOrOID(); - final String fieldName = splitNameIntoWords(name.replace("-", "")).concat("_OBJECT_CLASS"); - - objectClasses.put(fieldName, objectClass); - } - - System.out.println("/*"); - System.out.println(" * CDDL HEADER START"); - System.out.println(" *"); - System.out.println(" * The contents of this file are subject to the terms of the"); - System.out.println(" * Common Development and Distribution License, Version 1.0 only"); - System.out.println(" * (the \"License\"). You may not use this file except in compliance"); - System.out.println(" * with the License."); - System.out.println(" *"); - System.out.println(" * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt"); - System.out.println(" * or http://forgerock.org/license/CDDLv1.0.html."); - System.out.println(" * See the License for the specific language governing permissions"); - System.out.println(" * and limitations under the License."); - System.out.println(" *"); - System.out.println(" * When distributing Covered Code, include this CDDL HEADER in each"); - System.out.println(" * file and include the License file at legal-notices/CDDLv1_0.txt."); - System.out.println(" * If applicable, add the following below this CDDL HEADER, with the"); - System.out.println(" * fields enclosed by brackets \"[]\" replaced with your own identifying"); - System.out.println(" * information:"); - System.out.println(" * Portions Copyright [yyyy] [name of copyright owner]"); - System.out.println(" *"); - System.out.println(" * CDDL HEADER END"); - System.out.println(" *"); - System.out.println(" *"); - System.out.println(" * Copyright 2009 Sun Microsystems, Inc."); - final int year = Calendar.getInstance().get(Calendar.YEAR); - System.out.println(" * Portions copyright 2014" + (year > 2014 ? "-" + year : "") + " ForgeRock AS"); - System.out.println(" */"); - System.out.println("package org.forgerock.opendj.ldap.schema;"); - System.out.println(); - System.out.println(); - System.out.println("// DON'T EDIT THIS FILE!"); - System.out.println("// It is automatically generated using GenerateCoreSchema class."); - System.out.println(); - System.out.println("/**"); - System.out.println(" * The OpenDJ SDK core schema contains standard LDAP " - + "RFC schema elements. These include:"); - System.out.println(" * "); - System.out.println(" *

"); - System.out.println(" * The core schema is non-strict: attempts to retrieve"); - System.out.println(" * non-existent Attribute Types will return a temporary"); - System.out.println(" * Attribute Type having the Octet String syntax."); - System.out.println(" */"); - System.out.println("public final class CoreSchema {"); - - System.out.println(" // Core Syntaxes"); - for (final Map.Entry syntax : syntaxes.entrySet()) { - System.out.println(" private static final Syntax " + syntax.getKey() + " ="); - System.out.println(" CoreSchemaImpl.getInstance().getSyntax(\"" - + syntax.getValue().getOID() + "\");"); - } - - System.out.println(); - System.out.println(" // Core Matching Rules"); - for (final Map.Entry matchingRule : matchingRules.entrySet()) { - System.out.println(" private static final MatchingRule " + matchingRule.getKey() - + " ="); - System.out.println(" CoreSchemaImpl.getInstance().getMatchingRule(\"" - + matchingRule.getValue().getOID() + "\");"); - } - - System.out.println(); - System.out.println(" // Core Attribute Types"); - for (final Map.Entry attributeType : attributeTypes.entrySet()) { - System.out.println(" private static final AttributeType " + attributeType.getKey() - + " ="); - System.out.println(" CoreSchemaImpl.getInstance().getAttributeType(\"" - + attributeType.getValue().getOID() + "\");"); - } - - System.out.println(); - System.out.println(" // Core Object Classes"); - for (final Map.Entry objectClass : objectClasses.entrySet()) { - System.out.println(" private static final ObjectClass " + objectClass.getKey() + " ="); - System.out.println(" CoreSchemaImpl.getInstance().getObjectClass(\"" - + objectClass.getValue().getOID() + "\");"); - } - - System.out.println(); - System.out.println(" // Prevent instantiation"); - System.out.println(" private CoreSchema() {"); - System.out.println(" // Nothing to do."); - System.out.println(" }"); - - System.out.println(); - System.out.println(" /**"); - System.out.println(" * Returns a reference to the singleton core schema."); - System.out.println(" *"); - System.out.println(" * @return The core schema."); - System.out.println(" */"); - System.out.println(" public static Schema getInstance() {"); - System.out.println(" return CoreSchemaImpl.getInstance();"); - System.out.println(" }"); - - for (final Map.Entry syntax : syntaxes.entrySet()) { - System.out.println(); - - final String description = - toCodeJavaDoc(syntax.getValue().getDescription().replaceAll(" Syntax$", "") - + " Syntax"); - System.out.println(" /**"); - System.out.println(" * Returns a reference to the " + description); - System.out.println(" * which has the OID " - + toCodeJavaDoc(syntax.getValue().getOID()) + "."); - System.out.println(" *"); - System.out.println(" * @return A reference to the " + description + "."); - - System.out.println(" */"); - System.out.println(" public static Syntax get" + toJavaName(syntax.getKey()) + "() {"); - System.out.println(" return " + syntax.getKey() + ";"); - System.out.println(" }"); - } - - for (final Map.Entry matchingRule : matchingRules.entrySet()) { - System.out.println(); - - final String description = toCodeJavaDoc(matchingRule.getValue().getNameOrOID()); - System.out.println(" /**"); - System.out.println(" * Returns a reference to the " + description + " Matching Rule"); - System.out.println(" * which has the OID " - + toCodeJavaDoc(matchingRule.getValue().getOID()) + "."); - System.out.println(" *"); - System.out.println(" * @return A reference to the " + description + " Matching Rule."); - - System.out.println(" */"); - System.out.println(" public static MatchingRule get" + toJavaName(matchingRule.getKey()) + "() {"); - System.out.println(" return " + matchingRule.getKey() + ";"); - System.out.println(" }"); - } - - for (final Map.Entry attributeType : attributeTypes.entrySet()) { - System.out.println(); - - final String description = toCodeJavaDoc(attributeType.getValue().getNameOrOID()); - System.out.println(" /**"); - System.out.println(" * Returns a reference to the " + description + " Attribute Type"); - System.out.println(" * which has the OID " - + toCodeJavaDoc(attributeType.getValue().getOID()) + "."); - System.out.println(" *"); - System.out.println(" * @return A reference to the " + description + " Attribute Type."); - - System.out.println(" */"); - System.out.println(" public static AttributeType get" - + toJavaName(attributeType.getKey()) + "() {"); - System.out.println(" return " + attributeType.getKey() + ";"); - System.out.println(" }"); - } - - for (final Map.Entry objectClass : objectClasses.entrySet()) { - System.out.println(); - - final String description = toCodeJavaDoc(objectClass.getValue().getNameOrOID()); - System.out.println(" /**"); - System.out.println(" * Returns a reference to the " + description + " Object Class"); - System.out.println(" * which has the OID " - + toCodeJavaDoc(objectClass.getValue().getOID()) + "."); - System.out.println(" *"); - System.out.println(" * @return A reference to the " + description + " Object Class."); - - System.out.println(" */"); - System.out.println(" public static ObjectClass get" + toJavaName(objectClass.getKey()) - + "() {"); - System.out.println(" return " + objectClass.getKey() + ";"); - System.out.println(" }"); - } - - System.out.println("}"); - } - - private static boolean isOpenDSOID(final String oid) { - return oid.startsWith(SchemaConstants.OID_OPENDS_SERVER_BASE + "."); - } - - private static boolean isCollationMatchingRule(final String oid) { - return oid.startsWith("1.3.6.1.4.1.42.2.27.9.4."); - } - - private static String splitNameIntoWords(final String name) { - String splitName = name.replaceAll("([A-Z][a-z])", "_$1"); - splitName = splitName.replaceAll("([a-z])([A-Z])", "$1_$2"); - splitName = splitName.replaceAll("[-.]", ""); - - return splitName.toUpperCase(Locale.ENGLISH); - } - - private static void testSplitNameIntoWords() { - final String[][] values = - new String[][] { { "oneTwoThree", "ONE_TWO_THREE" }, - { "oneTWOThree", "ONE_TWO_THREE" }, { "oneX500Three", "ONE_X500_THREE" }, - { "oneTwoX500", "ONE_TWO_X500" }, { "oneTwoX500", "ONE_TWO_X500" }, - { "x500TwoThree", "X500_TWO_THREE" }, }; - - for (final String[] test : values) { - final String actual = splitNameIntoWords(test[0]); - final String expected = test[1]; - if (!actual.equals(expected)) { - System.out.println("Test Split Failure: " + test[0] + " -> " + actual + " != " - + expected); - } - } - } - - private static String toCodeJavaDoc(final String text) { - return String.format("{@code %s}", text); - } - - private static String toJavaName(final String splitName) { - final StringBuilder builder = new StringBuilder(); - for (final String word : splitName.split("_")) { - if (ABBREVIATIONS.contains(word)) { - builder.append(word); - } else { - builder.append(word.charAt(0)); - if (word.length() > 1) { - builder.append(word.substring(1).toLowerCase(Locale.ENGLISH)); - } - } - } - return builder.toString(); - } - - private GenerateCoreSchema() { - // Prevent instantiation. - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java deleted file mode 100644 index dcc75fcb1..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This class implements the numericStringMatch matching rule defined in X.520 - * and referenced in RFC 2252. It allows for values with numeric digits and - * spaces, but ignores spaces when performing matching. - */ -final class NumericStringEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { - - NumericStringEqualityMatchingRuleImpl() { - super(EMR_NUMERIC_STRING_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeNumericStringAttributeValue(value); - } - - @Override - public String keyToHumanReadableString(ByteSequence key) { - return key.toString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java deleted file mode 100644 index 2b9bc3f9f..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This implements defines the numericStringOrderingMatch matching rule defined - * in X.520 and referenced in RFC 2252. - */ -final class NumericStringOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { - - NumericStringOrderingMatchingRuleImpl() { - // Reusing equality index since OPENDJ-1864 - super(EMR_NUMERIC_STRING_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeNumericStringAttributeValue(value); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java deleted file mode 100644 index 2d06bf492..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This class implements the numericStringSubstringsMatch matching rule defined - * in X.520 and referenced in RFC 2252. - */ -final class NumericStringSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl { - - NumericStringSubstringMatchingRuleImpl() { - super(SMR_NUMERIC_STRING_NAME, EMR_NUMERIC_STRING_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return SchemaUtils.normalizeNumericStringAttributeValue(value); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java deleted file mode 100644 index 5e0e02a52..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This class defines the octetStringMatch matching rule defined in X.520. It - * will be used as the default equality matching rule for the binary and octet - * string syntaxes. - */ -final class OctetStringEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { - - OctetStringEqualityMatchingRuleImpl() { - super(EMR_OCTET_STRING_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return value.toByteString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java deleted file mode 100644 index f0e9c9f9c..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2015 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This class defines the octetStringOrderingMatch matching rule defined in - * X.520. This will be the default ordering matching rule for the binary and - * octet string syntaxes. - */ -final class OctetStringOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { - - OctetStringOrderingMatchingRuleImpl() { - // Reusing equality index since OPENDJ-1864 - super(EMR_OCTET_STRING_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return value.toByteString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java deleted file mode 100644 index 12d9fee19..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.opendj.ldap.ByteSequence; -import org.forgerock.opendj.ldap.ByteString; - -/** - * This class defines the octetStringSubstringsMatch matching rule defined in - * X.520. It will be used as the default substring matching rule for the binary - * and octet string syntaxes. - */ -final class OctetStringSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl { - - OctetStringSubstringMatchingRuleImpl() { - super(SMR_OCTET_STRING_NAME, EMR_OCTET_STRING_NAME); - } - - public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { - return value.toByteString(); - } - - @Override - String keyToHumanReadableString(ByteSequence key) { - return key.toByteString().toHexString(); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java deleted file mode 100644 index d378b70ec..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OCTET_STRING_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the octet string attribute syntax, which is equivalent - * to the binary syntax and should be considered a replacement for it. Equality, - * ordering, and substring matching will be allowed by default. - */ -final class OctetStringSyntaxImpl extends AbstractSyntaxImpl { - @Override - public String getEqualityMatchingRule() { - return EMR_OCTET_STRING_OID; - } - - public String getName() { - return SYNTAX_OCTET_STRING_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_OCTET_STRING_OID; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // All values will be acceptable for the octet string syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java deleted file mode 100644 index 4a9b15e62..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_CASE_IGNORE_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_POSTAL_ADDRESS_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the postal address attribute syntax, which is a list of - * UCS (Universal Character Set, as defined in the ISO 10646 specification and - * includes UTF-8 and UTF-16) strings separated by dollar signs. By default, - * they will be treated in a case-insensitive manner, and equality and substring - * matching will be allowed. - */ -final class PostalAddressSyntaxImpl extends AbstractSyntaxImpl { - - @Override - public String getEqualityMatchingRule() { - return EMR_CASE_IGNORE_OID; - } - - public String getName() { - return SYNTAX_POSTAL_ADDRESS_NAME; - } - - @Override - public String getSubstringMatchingRule() { - return SMR_CASE_IGNORE_OID; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // We'll allow any value. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java deleted file mode 100644 index e708a2064..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the presentation address attribute syntax, which is - * defined in RFC 1278. However, because this LDAP syntax is being deprecated, - * this implementation behaves exactly like the directory string syntax. - */ -final class PresentationAddressSyntaxImpl extends AbstractSyntaxImpl { - @Override - public String getApproximateMatchingRule() { - return AMR_DOUBLE_METAPHONE_OID; - } - - @Override - public String getEqualityMatchingRule() { - return EMR_CASE_IGNORE_OID; - } - - public String getName() { - return SYNTAX_PRESENTATION_ADDRESS_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_CASE_IGNORE_OID; - } - - @Override - public String getSubstringMatchingRule() { - return SMR_CASE_IGNORE_OID; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // We will accept any value for this syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java deleted file mode 100644 index 7a5b2b0e1..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the protocol information attribute syntax, which is - * being deprecated. As such, this implementation behaves exactly like the - * directory string syntax. - */ -final class ProtocolInformationSyntaxImpl extends AbstractSyntaxImpl { - - @Override - public String getApproximateMatchingRule() { - return AMR_DOUBLE_METAPHONE_OID; - } - - @Override - public String getEqualityMatchingRule() { - return EMR_CASE_IGNORE_OID; - } - - public String getName() { - return SYNTAX_PROTOCOL_INFORMATION_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_CASE_IGNORE_OID; - } - - @Override - public String getSubstringMatchingRule() { - return SMR_CASE_IGNORE_OID; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // We will accept any value for this syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java deleted file mode 100644 index dbe0ffcfd..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_SUPPORTED_ALGORITHM_NAME; - -import org.forgerock.i18n.LocalizableMessageBuilder; -import org.forgerock.opendj.ldap.ByteSequence; - -/** - * This class implements the supported algorithm attribute syntax. This should - * be restricted to holding only X.509 supported algorithms, but we will accept - * any set of bytes. It will be treated much like the octet string attribute - * syntax. - */ -final class SupportedAlgorithmSyntaxImpl extends AbstractSyntaxImpl { - - @Override - public String getEqualityMatchingRule() { - return EMR_OCTET_STRING_OID; - } - - public String getName() { - return SYNTAX_SUPPORTED_ALGORITHM_NAME; - } - - @Override - public String getOrderingMatchingRule() { - return OMR_OCTET_STRING_OID; - } - - @Override - public boolean isBEREncodingRequired() { - return true; - } - - 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ - public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, - final LocalizableMessageBuilder invalidReason) { - // All values will be acceptable for the supported algorithm syntax. - return true; - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java deleted file mode 100644 index fd9ee3866..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.schema; - -import org.forgerock.i18n.LocalizableMessage; -import org.forgerock.i18n.LocalizedIllegalArgumentException; - -/** - * Thrown when a schema query fails because the requested schema element could - * not be found or is ambiguous. - */ -@SuppressWarnings("serial") -public class UnknownSchemaElementException extends LocalizedIllegalArgumentException { - /** - * Creates a new unknown schema element exception with the provided message. - * - * @param message - * The message that explains the problem that occurred. - */ - public UnknownSchemaElementException(final LocalizableMessage message) { - super(message); - } -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java deleted file mode 100755 index 9c4234386..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -/** - * Classes and interfaces for constructing and querying LDAP schemas. - */ -package org.forgerock.opendj.ldap.schema; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexingOptions.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexingOptions.java deleted file mode 100644 index ac8d64f9b..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexingOptions.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014 ForgeRock AS - */ -package org.forgerock.opendj.ldap.spi; - -/** - * Contains options indicating how indexing must be performed. - */ -public interface IndexingOptions { - - /** - * Returns the maximum size to use when building the keys for the - * "substring" index. - * - * @return the maximum size to use when building the keys for the - * "substring" index. - */ - int substringKeySize(); - - -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/Provider.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/Provider.java deleted file mode 100644 index 2c0487edd..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/Provider.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.spi; - -/** - * Interface for providers, which provide an implementation of one or more interfaces. - *

- * A provider must be declared in the provider-configuration file - * {@code META-INF/services/org.forgerock.opendj.ldap.spi.} - * in order to allow automatic loading of the implementation classes using the - * {@code java.util.ServiceLoader} facility. - */ -public interface Provider { - - /** - * Returns the name of this provider. - * - * @return name of provider - */ - String getName(); - -} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/package-info.java deleted file mode 100644 index b59caf05e..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. - */ - -/** - * Interfaces and classes for service providers. - */ -package org.forgerock.opendj.ldap.spi; - diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/package-info.java b/opendj-core/src/main/java/org/forgerock/opendj/ldif/package-info.java deleted file mode 100755 index 82f3c53ba..000000000 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/package-info.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ - -/** - * Classes and interfaces for reading and writing LDIF. - */ -package org.forgerock.opendj.ldif; - diff --git a/opendj-core/src/test/java/com/forgerock/opendj/util/UtilTestCase.java b/opendj-core/src/test/java/com/forgerock/opendj/util/UtilTestCase.java deleted file mode 100644 index 3cb63ede2..000000000 --- a/opendj-core/src/test/java/com/forgerock/opendj/util/UtilTestCase.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package com.forgerock.opendj.util; - -import org.forgerock.testng.ForgeRockTestCase; -import org.testng.annotations.Test; - -/** - * An abstract class that all util unit tests should extend. Util represents the - * classes found directly under the package org.forgerock.opendj.ldap.util. - */ -@Test(groups = { "precommit", "util", "sdk" }) -public abstract class UtilTestCase extends ForgeRockTestCase { -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1ByteSequenceReaderTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1ByteSequenceReaderTestCase.java deleted file mode 100644 index 30f416e72..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1ByteSequenceReaderTestCase.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS - */ - -package org.forgerock.opendj.io; - -import org.forgerock.opendj.ldap.ByteSequenceReader; -import org.forgerock.opendj.ldap.ByteString; - -/** - * Test class for ASN1ByteSequenceReaderTestCase. - */ -public class ASN1ByteSequenceReaderTestCase extends ASN1ReaderTestCase { - @Override - protected ASN1Reader getReader(final byte[] b, final int maxElementSize) { - final ByteSequenceReader reader = ByteString.wrap(b).asReader(); - return ASN1.getReader(reader, maxElementSize); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1InputStreamReaderTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1InputStreamReaderTestCase.java deleted file mode 100644 index 406819bf8..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1InputStreamReaderTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS - */ -package org.forgerock.opendj.io; - -import java.io.ByteArrayInputStream; - -/** - * Test class for ASN1InputStreamReader. - */ -public class ASN1InputStreamReaderTestCase extends ASN1ReaderTestCase { - @Override - protected ASN1Reader getReader(final byte[] b, final int maxElementSize) { - final ByteArrayInputStream inStream = new ByteArrayInputStream(b); - return new ASN1InputStreamReader(inStream, maxElementSize); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1OutputStreamWriterTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1OutputStreamWriterTestCase.java deleted file mode 100644 index 8b260de4c..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1OutputStreamWriterTestCase.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS - */ -package org.forgerock.opendj.io; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; - -/** - * Test class for ASN1OutputStreamWriter. - */ -public class ASN1OutputStreamWriterTestCase extends ASN1WriterTestCase { - private final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); - private final ASN1Writer writer = new ASN1OutputStreamWriter(outStream, 1); - - @Override - protected byte[] getEncodedBytes() { - return outStream.toByteArray(); - } - - @Override - protected ASN1Reader getReader(final byte[] encodedBytes) { - final ByteArrayInputStream inStream = new ByteArrayInputStream(encodedBytes); - return new ASN1InputStreamReader(inStream, 0); - } - - @Override - protected ASN1Writer getWriter() { - outStream.reset(); - return writer; - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java deleted file mode 100644 index 58e0fb6da..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java +++ /dev/null @@ -1,419 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertSame; -import static org.testng.Assert.assertTrue; - -import java.util.Iterator; - -import org.forgerock.i18n.LocalizedIllegalArgumentException; -import org.forgerock.opendj.ldap.schema.Schema; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Test {@code AttributeDescription}. - */ -@SuppressWarnings("javadoc") -public final class AttributeDescriptionTestCase extends SdkTestCase { - @DataProvider(name = "dataForCompareCoreSchema") - public Object[][] dataForCompareCoreSchema() { - // AD1, AD2, compare result, isSubtype, isSuperType - return new Object[][] { { "cn", "cn", 0, true, true }, - { "cn", "commonName", 0, true, true }, { " cn", "commonName ", 0, true, true }, - { "commonName", "cn", 0, true, true }, { "commonName", "commonName", 0, true, true }, - { "cn", "objectClass", 1, false, false }, { "objectClass", "cn", -1, false, false }, - { "name", "cn", 1, false, true }, { "cn", "name", -1, true, false }, - { "name;foo", "cn", 1, false, false }, { "cn;foo", "name", -1, true, false }, - { "name", "cn;foo", 1, false, true }, { "cn", "name;foo", -1, false, false }, }; - } - - @DataProvider(name = "dataForCompareNoSchema") - public Object[][] dataForCompareNoSchema() { - // AD1, AD2, compare result, isSubtype, isSuperType - return new Object[][] { { "cn", "cn", 0, true, true }, { "cn", "CN", 0, true, true }, - { "CN", "cn", 0, true, true }, { "CN", "CN", 0, true, true }, - { "cn", "commonName", -1, false, false }, { "commonName", "cn", 1, false, false }, - { "commonName", "commonName", 0, true, true }, { "cn", "cn;foo", -1, false, true }, - { "cn;foo", "cn", 1, true, false }, { "cn;foo", "cn;foo", 0, true, true }, - { "CN;FOO", "cn;foo", 0, true, true }, { "cn;foo", "CN;FOO", 0, true, true }, - { "CN;FOO", "CN;FOO", 0, true, true }, { "cn;foo", "cn;bar", 1, false, false }, - { "cn;bar", "cn;foo", -1, false, false }, - - { "cn;xxx;yyy", "cn", 1, true, false }, { "cn;xxx;yyy", "cn;yyy", 1, true, false }, - { "cn;xxx;yyy", "cn;xxx", 1, true, false }, - { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true }, - { "cn;xxx;yyy", "cn;yyy;xxx", 0, true, true }, - - { "cn", "cn;xxx;yyy", -1, false, true }, { "cn;yyy", "cn;xxx;yyy", -1, false, true }, - { "cn;xxx", "cn;xxx;yyy", -1, false, true }, - { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true }, - { "cn;yyy;xxx", "cn;xxx;yyy", 0, true, true }, }; - } - - @DataProvider(name = "dataForValueOfCoreSchema") - public Object[][] dataForValueOfCoreSchema() { - // Value, type, isObjectClass - return new Object[][] { { "cn", "cn", false }, { "CN", "cn", false }, - { "commonName", "cn", false }, { "objectclass", "objectClass", true }, }; - } - - @DataProvider(name = "dataForValueOfInvalidAttributeDescriptions") - public Object[][] dataForValueOfInvalidAttributeDescriptions() { - return new Object[][] { { "" }, { " " }, { ";" }, { " ; " }, { "0cn" }, { "cn+" }, - { "cn;foo+bar" }, { "cn;foo;foo+bar" }, { ";foo" }, { "cn;" }, { "cn;;foo" }, - { "cn; ;foo" }, { "cn;foo;" }, { "cn;foo; " }, { "cn;foo;;bar" }, { "cn;foo; ;bar" }, - { "cn;foo;bar;;" }, { "1a" }, { "1.a" }, { "1-" }, { "1.1a" }, { "1.1.a" }, }; - } - - @DataProvider(name = "dataForValueOfNoSchema") - public Object[][] dataForValueOfNoSchema() { - // Value, type, options, containsOptions("foo") - return new Object[][] { { "cn", "cn", new String[0], false }, - { " cn ", "cn", new String[0], false }, { " cn ", "cn", new String[0], false }, - { "CN", "CN", new String[0], false }, { "1", "1", new String[0], false }, - { "1.2", "1.2", new String[0], false }, { "1.2.3", "1.2.3", new String[0], false }, - { "111.222.333", "111.222.333", new String[0], false }, - { "objectClass", "objectClass", new String[0], false }, - { "cn;foo", "cn", new String[] { "foo" }, true }, - { "cn;FOO", "cn", new String[] { "FOO" }, true }, - { "cn;bar", "cn", new String[] { "bar" }, false }, - { "cn;BAR", "cn", new String[] { "BAR" }, false }, - { "cn;foo;bar", "cn", new String[] { "foo", "bar" }, true }, - { "cn;FOO;bar", "cn", new String[] { "FOO", "bar" }, true }, - { "cn;foo;BAR", "cn", new String[] { "foo", "BAR" }, true }, - { "cn;FOO;BAR", "cn", new String[] { "FOO", "BAR" }, true }, - { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true }, - { "cn;BAR;foo", "cn", new String[] { "BAR", "foo" }, true }, - { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true }, - { "cn;BAR;FOO", "cn", new String[] { "BAR", "FOO" }, true }, - { " cn;BAR;FOO ", "cn", new String[] { "BAR", "FOO" }, true }, - { " cn;BAR;FOO ", "cn", new String[] { "BAR", "FOO" }, true }, - { "cn;xxx;yyy;zzz", "cn", new String[] { "xxx", "yyy", "zzz" }, false }, - { "cn;zzz;YYY;xxx", "cn", new String[] { "zzz", "YYY", "xxx" }, false }, }; - } - - @Test(dataProvider = "dataForCompareCoreSchema") - public void testCompareCoreSchema(final String ad1, final String ad2, final int compare, - final boolean isSubType, final boolean isSuperType) { - final AttributeDescription attributeDescription1 = - AttributeDescription.valueOf(ad1, Schema.getCoreSchema()); - - final AttributeDescription attributeDescription2 = - AttributeDescription.valueOf(ad2, Schema.getCoreSchema()); - - // Identity. - assertTrue(attributeDescription1.equals(attributeDescription1)); - assertTrue(attributeDescription1.compareTo(attributeDescription1) == 0); - assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1)); - assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription1)); - - if (compare == 0) { - assertTrue(attributeDescription1.equals(attributeDescription2)); - assertTrue(attributeDescription2.equals(attributeDescription1)); - assertTrue(attributeDescription1.compareTo(attributeDescription2) == 0); - assertTrue(attributeDescription2.compareTo(attributeDescription1) == 0); - - assertTrue(attributeDescription1.isSubTypeOf(attributeDescription2)); - assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription2)); - assertTrue(attributeDescription2.isSubTypeOf(attributeDescription1)); - assertTrue(attributeDescription2.isSuperTypeOf(attributeDescription1)); - } else { - assertFalse(attributeDescription1.equals(attributeDescription2)); - assertFalse(attributeDescription2.equals(attributeDescription1)); - - if (compare < 0) { - assertTrue(attributeDescription1.compareTo(attributeDescription2) < 0); - assertTrue(attributeDescription2.compareTo(attributeDescription1) > 0); - } else { - assertTrue(attributeDescription1.compareTo(attributeDescription2) > 0); - assertTrue(attributeDescription2.compareTo(attributeDescription1) < 0); - } - - assertEquals(attributeDescription1.isSubTypeOf(attributeDescription2), isSubType); - - assertEquals(attributeDescription1.isSuperTypeOf(attributeDescription2), isSuperType); - } - } - - @Test(dataProvider = "dataForCompareNoSchema") - public void testCompareNoSchema(final String ad1, final String ad2, final int compare, - final boolean isSubType, final boolean isSuperType) { - final AttributeDescription attributeDescription1 = - AttributeDescription.valueOf(ad1, Schema.getEmptySchema()); - - final AttributeDescription attributeDescription2 = - AttributeDescription.valueOf(ad2, Schema.getEmptySchema()); - - // Identity. - assertTrue(attributeDescription1.equals(attributeDescription1)); - assertTrue(attributeDescription1.compareTo(attributeDescription1) == 0); - assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1)); - assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription1)); - - if (compare == 0) { - assertTrue(attributeDescription1.equals(attributeDescription2)); - assertTrue(attributeDescription2.equals(attributeDescription1)); - assertTrue(attributeDescription1.compareTo(attributeDescription2) == 0); - assertTrue(attributeDescription2.compareTo(attributeDescription1) == 0); - - assertTrue(attributeDescription1.isSubTypeOf(attributeDescription2)); - assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription2)); - assertTrue(attributeDescription2.isSubTypeOf(attributeDescription1)); - assertTrue(attributeDescription2.isSuperTypeOf(attributeDescription1)); - } else { - assertFalse(attributeDescription1.equals(attributeDescription2)); - assertFalse(attributeDescription2.equals(attributeDescription1)); - - if (compare < 0) { - assertTrue(attributeDescription1.compareTo(attributeDescription2) < 0); - assertTrue(attributeDescription2.compareTo(attributeDescription1) > 0); - } else { - assertTrue(attributeDescription1.compareTo(attributeDescription2) > 0); - assertTrue(attributeDescription2.compareTo(attributeDescription1) < 0); - } - - assertEquals(attributeDescription1.isSubTypeOf(attributeDescription2), isSubType); - - assertEquals(attributeDescription1.isSuperTypeOf(attributeDescription2), isSuperType); - } - } - - @Test(dataProvider = "dataForValueOfCoreSchema") - public void testValueOfCoreSchema(final String ad, final String at, final boolean isObjectClass) { - final AttributeDescription attributeDescription = - AttributeDescription.valueOf(ad, Schema.getCoreSchema()); - - assertEquals(attributeDescription.toString(), ad); - - assertEquals(attributeDescription.getAttributeType().getNameOrOID(), at); - - assertEquals(attributeDescription.isObjectClass(), isObjectClass); - - assertFalse(attributeDescription.hasOptions()); - assertFalse(attributeDescription.hasOption("dummy")); - - final Iterator iterator = attributeDescription.getOptions().iterator(); - assertFalse(iterator.hasNext()); - } - - /** FIXME: none of these pass! The valueOf method is far to lenient. */ - @Test(dataProvider = "dataForValueOfInvalidAttributeDescriptions", - expectedExceptions = LocalizedIllegalArgumentException.class) - public void testValueOfInvalidAttributeDescriptions(final String ad) { - AttributeDescription.valueOf(ad, Schema.getEmptySchema()); - } - - @Test(dataProvider = "dataForValueOfNoSchema") - public void testValueOfNoSchema(final String ad, final String at, final String[] options, - final boolean containsFoo) { - final AttributeDescription attributeDescription = - AttributeDescription.valueOf(ad, Schema.getEmptySchema()); - - assertEquals(attributeDescription.toString(), ad); - - assertEquals(attributeDescription.getAttributeType().getNameOrOID(), at); - - assertFalse(attributeDescription.isObjectClass()); - - if (options.length == 0) { - assertFalse(attributeDescription.hasOptions()); - } else { - assertTrue(attributeDescription.hasOptions()); - } - - assertFalse(attributeDescription.hasOption("dummy")); - if (containsFoo) { - assertTrue(attributeDescription.hasOption("foo")); - assertTrue(attributeDescription.hasOption("FOO")); - assertTrue(attributeDescription.hasOption("FoO")); - } else { - assertFalse(attributeDescription.hasOption("foo")); - assertFalse(attributeDescription.hasOption("FOO")); - assertFalse(attributeDescription.hasOption("FoO")); - } - - for (final String option : options) { - assertTrue(attributeDescription.hasOption(option)); - } - - final Iterator iterator = attributeDescription.getOptions().iterator(); - for (final String option : options) { - assertTrue(iterator.hasNext()); - assertEquals(iterator.next(), option); - } - assertFalse(iterator.hasNext()); - } - - @Test - public void testWithOptionAddFirstOption() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn"); - AttributeDescription ad2 = ad1.withOption("test"); - assertTrue(ad2.hasOptions()); - assertTrue(ad2.hasOption("test")); - assertFalse(ad2.hasOption("dummy")); - assertEquals(ad2.toString(), "cn;test"); - assertEquals(ad2.getOptions().iterator().next(), "test"); - } - - @Test - public void testWithOptionAddExistingFirstOption() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test"); - AttributeDescription ad2 = ad1.withOption("test"); - assertSame(ad1, ad2); - } - - @Test - public void testWithOptionAddSecondOption() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1"); - AttributeDescription ad2 = ad1.withOption("test2"); - assertTrue(ad2.hasOptions()); - assertTrue(ad2.hasOption("test1")); - assertTrue(ad2.hasOption("test2")); - assertFalse(ad2.hasOption("dummy")); - assertEquals(ad2.toString(), "cn;test1;test2"); - Iterator i = ad2.getOptions().iterator(); - assertEquals(i.next(), "test1"); - assertEquals(i.next(), "test2"); - } - - @Test - public void testWithOptionAddExistingSecondOption() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); - AttributeDescription ad2 = ad1.withOption("test1"); - AttributeDescription ad3 = ad1.withOption("test2"); - assertSame(ad1, ad2); - assertSame(ad1, ad3); - } - - @Test - public void testWithoutOptionEmpty() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn"); - AttributeDescription ad2 = ad1.withoutOption("test"); - assertSame(ad1, ad2); - } - - @Test - public void testWithoutOptionFirstOption() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test"); - AttributeDescription ad2 = ad1.withoutOption("test"); - assertFalse(ad2.hasOptions()); - assertFalse(ad2.hasOption("test")); - assertEquals(ad2.toString(), "cn"); - assertFalse(ad2.getOptions().iterator().hasNext()); - } - - @Test - public void testWithoutOptionFirstOptionMissing() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test"); - AttributeDescription ad2 = ad1.withoutOption("dummy"); - assertSame(ad1, ad2); - } - - @Test - public void testWithoutOptionSecondOption1() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); - AttributeDescription ad2 = ad1.withoutOption("test1"); - assertTrue(ad2.hasOptions()); - assertFalse(ad2.hasOption("test1")); - assertTrue(ad2.hasOption("test2")); - assertEquals(ad2.toString(), "cn;test2"); - assertEquals(ad2.getOptions().iterator().next(), "test2"); - } - - @Test - public void testWithoutOptionSecondOption2() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); - AttributeDescription ad2 = ad1.withoutOption("test2"); - assertTrue(ad2.hasOptions()); - assertTrue(ad2.hasOption("test1")); - assertFalse(ad2.hasOption("test2")); - assertEquals(ad2.toString(), "cn;test1"); - assertEquals(ad2.getOptions().iterator().next(), "test1"); - } - - @Test - public void testWithoutOptionSecondOptionMissing() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); - AttributeDescription ad2 = ad1.withoutOption("dummy"); - assertSame(ad1, ad2); - } - - @Test - public void testWithoutOptionThirdOption1() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); - AttributeDescription ad2 = ad1.withoutOption("test1"); - assertTrue(ad2.hasOptions()); - assertFalse(ad2.hasOption("test1")); - assertTrue(ad2.hasOption("test2")); - assertTrue(ad2.hasOption("test3")); - assertEquals(ad2.toString(), "cn;test2;test3"); - Iterator i = ad2.getOptions().iterator(); - assertEquals(i.next(), "test2"); - assertEquals(i.next(), "test3"); - } - - @Test - public void testWithoutOptionThirdOption2() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); - AttributeDescription ad2 = ad1.withoutOption("test2"); - assertTrue(ad2.hasOptions()); - assertTrue(ad2.hasOption("test1")); - assertFalse(ad2.hasOption("test2")); - assertTrue(ad2.hasOption("test3")); - assertEquals(ad2.toString(), "cn;test1;test3"); - Iterator i = ad2.getOptions().iterator(); - assertEquals(i.next(), "test1"); - assertEquals(i.next(), "test3"); - } - - @Test - public void testWithoutOptionThirdOption3() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); - AttributeDescription ad2 = ad1.withoutOption("test3"); - assertTrue(ad2.hasOptions()); - assertTrue(ad2.hasOption("test1")); - assertTrue(ad2.hasOption("test2")); - assertFalse(ad2.hasOption("test3")); - assertEquals(ad2.toString(), "cn;test1;test2"); - Iterator i = ad2.getOptions().iterator(); - assertEquals(i.next(), "test1"); - assertEquals(i.next(), "test2"); - } - - @Test - public void testWithoutOptionThirdOptionMissing() { - AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); - AttributeDescription ad2 = ad1.withoutOption("dummy"); - assertSame(ad1, ad2); - } - -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java deleted file mode 100644 index ff164c2b9..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS - */ -package org.forgerock.opendj.ldap; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.verifyZeroInteractions; - -import org.testng.annotations.Test; - -@SuppressWarnings("javadoc") -public class ConnectionsTestCase extends SdkTestCase { - - @Test - public void testUncloseableConnectionClose() throws Exception { - final Connection connection = mock(Connection.class); - final Connection uncloseable = Connections.uncloseable(connection); - uncloseable.close(); - verifyZeroInteractions(connection); - } - - @Test - public void testUncloseableConnectionNotClose() throws Exception { - final Connection connection = mock(Connection.class); - final Connection uncloseable = Connections.uncloseable(connection); - uncloseable.applyChange(null); - verify(connection).applyChange(null); - } - - @Test - public void testUncloseableConnectionUnbind() throws Exception { - final Connection connection = mock(Connection.class); - final Connection uncloseable = Connections.uncloseable(connection); - uncloseable.close(null, null); - verifyZeroInteractions(connection); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java deleted file mode 100644 index e13003f74..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. - */ -package org.forgerock.opendj.ldap; - -import org.forgerock.testng.ForgeRockTestCase; -import org.testng.annotations.Test; - -/** - * An abstract class that all types unit tests should extend. A type represents - * the classes found directly under the package org.forgerock.opendj.ldap. - */ -@Test(groups = { "precommit", "types", "sdk" }) -public abstract class SdkTestCase extends ForgeRockTestCase { - -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtilsTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtilsTestCase.java deleted file mode 100644 index ba4df8781..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtilsTestCase.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS - */ -package org.forgerock.opendj.ldap; - -import static org.fest.assertions.Assertions.assertThat; -import static org.forgerock.opendj.ldap.TestCaseUtils.mockTimeService; - -import org.testng.annotations.Test; - -import org.forgerock.util.time.TimeService; - -@SuppressWarnings("javadoc") -public class TestCaseUtilsTestCase extends SdkTestCase { - - /** - * Test for {@link #mockTimeSource(long...)}. - */ - @Test - public void testMockTimeSource() { - final TimeService mock1 = mockTimeService(10); - assertThat(mock1.now()).isEqualTo(10); - assertThat(mock1.now()).isEqualTo(10); - - final TimeService mock2 = mockTimeService(10, 20, 30); - assertThat(mock2.now()).isEqualTo(10); - assertThat(mock2.now()).isEqualTo(20); - assertThat(mock2.now()).isEqualTo(30); - assertThat(mock2.now()).isEqualTo(30); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java deleted file mode 100644 index a15090700..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.controls; - -import org.forgerock.opendj.ldap.TestCaseUtils; -import org.forgerock.testng.ForgeRockTestCase; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -/** - * An abstract class that all controls unit tests should extend. A control - * represents the classes found directly under the package - * org.forgerock.opendj.ldap.controls. - */ - -@Test(groups = { "precommit", "controls", "sdk" }) -public abstract class ControlsTestCase extends ForgeRockTestCase { - /** - * Set up the environment for performing the tests in this suite. - * - * @throws Exception - * If the environment could not be set up. - */ - @BeforeClass - public void setUp() throws Exception { - // This test suite depends on having the schema available. - TestCaseUtils.startServer(); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java deleted file mode 100644 index 49593dbc7..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - */ - -package org.forgerock.opendj.ldap.requests; - -import static org.testng.Assert.assertNotNull; - -import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder; -import org.testng.annotations.Test; - -/** - * Tests various extended requests. - */ -@SuppressWarnings("javadoc") -public abstract class ExtendedRequestTestCase extends RequestsTestCase { - - @Test(dataProvider = "ExtendedRequests") - public void testDecoder(final ExtendedRequest request) throws Exception { - final ExtendedResultDecoder decoder = request.getResultDecoder(); - assertNotNull(decoder); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java deleted file mode 100644 index e1690018b..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.responses; - -import org.forgerock.testng.ForgeRockTestCase; -import org.testng.annotations.Test; - -/** - * An abstract class that all responses unit tests should extend. Responses - * represents the classes found directly under the package - * org.forgerock.opendj.ldap.responses. - */ - -@Test(groups = { "precommit", "responses", "sdk" }) -public abstract class ResponsesTestCase extends ForgeRockTestCase { -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java deleted file mode 100644 index 9f9a833ee..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import org.forgerock.testng.ForgeRockTestCase; -import org.testng.annotations.Test; - -/** - * An abstract class that all schema unit test should extend. - */ -@Test(groups = { "precommit", "schema", "sdk" }) -public abstract class AbstractSchemaTestCase extends ForgeRockTestCase { -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java deleted file mode 100644 index e0eab345f..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BIT_STRING_OID; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** Bit string syntax tests. */ -@Test -public class BitStringSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ - @Override - @DataProvider(name = "acceptableValues") - public Object[][] createAcceptableValues() { - return new Object[][] { - { "'0101'B", true }, - { "'1'B", true }, - { "'0'B", true }, - { "invalid", false }, - { "1", false }, - { "'010100000111111010101000'B", true }, - }; - } - - /** {@inheritDoc} */ - @Override - protected Syntax getRule() { - return Schema.getCoreSchema().getSyntax(SYNTAX_BIT_STRING_OID); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java deleted file mode 100644 index b2f0d5ac4..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_EXACT_OID; - -import org.testng.annotations.DataProvider; - -/** - * Test the CaseExactOrderingMatchingRule. - */ -public class CaseExactOrderingMatchingRuleTest extends OrderingMatchingRuleTest { - - /** {@inheritDoc} */ - @Override - @DataProvider(name = "OrderingMatchingRuleInvalidValues") - public Object[][] createOrderingMatchingRuleInvalidValues() { - return new Object[][] {}; - } - - /** {@inheritDoc} */ - @Override - @DataProvider(name = "Orderingmatchingrules") - public Object[][] createOrderingMatchingRuleTestData() { - return new Object[][] { - { "12345678", "02345678", 1 }, - { "abcdef", "bcdefa", -1 }, - { "abcdef", "abcdef", 0 }, }; - } - - /** {@inheritDoc} */ - @Override - protected MatchingRule getRule() { - return Schema.getCoreSchema().getMatchingRule(OMR_CASE_EXACT_OID); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java deleted file mode 100644 index 0f6ae1929..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - */ -package org.forgerock.opendj.ldap.schema; - -import org.testng.Assert; -import org.testng.annotations.Test; - -/** - * Core schema tests. - */ -@SuppressWarnings("javadoc") -public class CoreSchemaTest extends AbstractSchemaTestCase { - @Test - public final void testCoreSchemaWarnings() { - // Make sure core schema doesn't have any warnings. - Assert.assertTrue(Schema.getCoreSchema().getWarnings().isEmpty()); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxTest.java deleted file mode 100644 index 0a009d1d1..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2012 Manuel Gaupp - * Portions copyright 2014 ForgeRock AS. - * - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_COUNTRY_STRING_OID; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Country String syntax tests. - */ -@Test -public class CountryStringSyntaxTest extends AbstractSyntaxTestCase { - @Override - @DataProvider(name = "acceptableValues") - public Object[][] createAcceptableValues() { - return new Object[][] { - // tests for the Country String syntax. - { "DE", true }, - { "de", false }, - { "SX", true }, - { "12", false }, - { "UK", true }, - { "Xf", false }, - { "ÖÄ", false }, // "\u00D6\u00C4" - }; - } - - /** {@inheritDoc} */ - @Override - protected Syntax getRule() { - return Schema.getCoreSchema().getSyntax(SYNTAX_COUNTRY_STRING_OID); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java deleted file mode 100644 index 732e9ad79..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_IA5_STRING_OID; - -import org.testng.annotations.DataProvider; - -/** - * IA5 string syntax tests. - */ -public class IA5StringSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ - @Override - @DataProvider(name = "acceptableValues") - public Object[][] createAcceptableValues() { - return new Object[][] { { "12345678", true }, { "12345678\u2163", false }, }; - } - - /** {@inheritDoc} */ - @Override - protected Syntax getRule() { - return Schema.getCoreSchema().getSyntax(SYNTAX_IA5_STRING_OID); - } - -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxTest.java deleted file mode 100644 index 71c6b5900..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_INTEGER_OID; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Integer syntax tests. - */ -@Test -public class IntegerSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ - @Override - @DataProvider(name = "acceptableValues") - public Object[][] createAcceptableValues() { - return new Object [][] { - {"123", true}, - {"987654321", true}, - {"-1", true}, - {"10001", true}, - {"001", false}, - {"-01", false}, - {"12345678\u2163", false}, - {" 123", false}, - {"123 ", false} - }; - } - - /** {@inheritDoc} */ - @Override - protected Syntax getRule() { - return Schema.getCoreSchema().getSyntax(SYNTAX_INTEGER_OID); - } - -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java deleted file mode 100644 index dffd71482..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OTHER_MAILBOX_OID; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Other mailbox syntax tests. - */ -@Test -public class OtherMailboxSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ - @Override - @DataProvider(name = "acceptableValues") - public Object[][] createAcceptableValues() { - return new Object[][] { { "MyMail$Mymailbox", true }, { "MyMailMymailbox", false }, }; - } - - /** {@inheritDoc} */ - @Override - protected Syntax getRule() { - return Schema.getCoreSchema().getSyntax(SYNTAX_OTHER_MAILBOX_OID); - } -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java deleted file mode 100644 index 7026accca..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_TELEX_OID; - -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -/** - * Telex syntax tests. - */ -@Test -public class TelexSyntaxTest extends AbstractSyntaxTestCase { - - /** {@inheritDoc} */ - @Override - @DataProvider(name = "acceptableValues") - public Object[][] createAcceptableValues() { - return new Object[][] { - { "123$france$456", true }, - { "abcdefghijk$lmnopqr$stuvwxyz", true }, - { "12345$67890$()+,-./:? ", true }, }; - } - - /** {@inheritDoc} */ - @Override - protected Syntax getRule() { - return Schema.getCoreSchema().getSyntax(SYNTAX_TELEX_OID); - } - -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java deleted file mode 100644 index ab7ab535d..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS - */ -package org.forgerock.opendj.ldap.schema; - -import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_USER_PASSWORD_EXACT_OID; - -import org.testng.annotations.DataProvider; - -/** - * Test the UserPasswordExactEqualityMatchingRule. - */ -public class UserPasswordExactEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ - @Override - @DataProvider(name = "matchingRuleInvalidAttributeValues") - public Object[][] createMatchingRuleInvalidAttributeValues() { - return new Object[][] { - - }; - } - - /** {@inheritDoc} */ - @Override - @DataProvider(name = "matchingrules") - public Object[][] createMatchingRuleTest() { - return new Object[][] { - - }; - } - - /** {@inheritDoc} */ - @Override - protected MatchingRule getRule() { - return Schema.getCoreSchema().getMatchingRule(EMR_USER_PASSWORD_EXACT_OID); - } - -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/LDAPTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/LDAPTestCase.java deleted file mode 100644 index eb94928d5..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/LDAPTestCase.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ - -package org.forgerock.opendj.ldap.spi; - -import org.forgerock.testng.ForgeRockTestCase; -import org.testng.annotations.Test; - -/** - * An abstract class that all ldap unit tests should extend. Ldap represents the - * classes found directly under the package com.forgerock.opendj.ldap.ldap. - */ - -@Test(groups = { "precommit", "ldap", "sdk" }) -public abstract class LDAPTestCase extends ForgeRockTestCase { -} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/AbstractLDIFTestCase.java b/opendj-core/src/test/java/org/forgerock/opendj/ldif/AbstractLDIFTestCase.java deleted file mode 100644 index 35ddf669e..000000000 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/AbstractLDIFTestCase.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. - */ -package org.forgerock.opendj.ldif; - -import org.forgerock.opendj.ldap.SdkTestCase; -import org.testng.annotations.Test; - -/** - * An abstract class that all LDIF unit tests should extend. LDIF represents the - * classes found directly under the package org.forgerock.opendj.ldif. - */ - -@Test(groups = { "precommit", "types", "sdk" }) -public abstract class AbstractLDIFTestCase extends SdkTestCase { -} - - - - diff --git a/opendj-core/src/test/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider b/opendj-core/src/test/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider deleted file mode 100644 index 8e5ad9880..000000000 --- a/opendj-core/src/test/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider +++ /dev/null @@ -1,26 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2013 ForgeRock AS. -# -org.forgerock.opendj.ldap.spi.BasicTransportProvider \ No newline at end of file diff --git a/opendj-doc-maven-plugin/pom.xml b/opendj-doc-maven-plugin/pom.xml index ec089001a..54b400bcb 100644 --- a/opendj-doc-maven-plugin/pom.xml +++ b/opendj-doc-maven-plugin/pom.xml @@ -1,28 +1,18 @@ 4.0.0 @@ -30,8 +20,7 @@ opendj-sdk-parent org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml + 4.0.0-SNAPSHOT opendj-doc-maven-plugin @@ -47,7 +36,7 @@ org.forgerock.opendj - opendj-core + opendj-sdk-core diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/CommandLineTool.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/CommandLineTool.java index 711020b84..dc76e60e4 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/CommandLineTool.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/CommandLineTool.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateConfigurationReferenceMojo.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateConfigurationReferenceMojo.java index 1498ae5d2..a035a20c6 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateConfigurationReferenceMojo.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateConfigurationReferenceMojo.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; @@ -54,7 +44,7 @@ public class GenerateConfigurationReferenceMojo extends AbstractMojo { /** * The path to the directory where the configuration reference should be written. - * This path must be under {@code ${project.build.directory} }. + * This path must be under ${project.build.directory}. */ @Parameter(defaultValue = "${project.build.directory}/site/configref") private String outputDirectory; @@ -77,7 +67,7 @@ public void execute() throws MojoExecutionException, MojoFailureException { /** * Creates the output directory where the configuration reference is written. - * @throws MojoExecutionException The output directory is not under {@code ${project.build.directory} } + * @throws MojoExecutionException The output directory is not under ${project.build.directory} * or could not be created. */ private void createOutputDirectory() throws MojoExecutionException { diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateGlobalAcisTableMojo.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateGlobalAcisTableMojo.java index 67e0c2f77..346a6f0fb 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateGlobalAcisTableMojo.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateGlobalAcisTableMojo.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; @@ -67,9 +58,6 @@ public class GenerateGlobalAcisTableMojo extends AbstractMojo { @Parameter(defaultValue = "${project.build.directory}/docbkx-sources/shared") private File outputDirectory; - /** Holds descriptions for ACIs. */ - private Map descriptions; - /** Holds documentation for an ACI. */ private class Aci { String name; diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateMessageFileMojo.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateMessageFileMojo.java index c0a036fcf..363e71937 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateMessageFileMojo.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateMessageFileMojo.java @@ -1,34 +1,23 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2008-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; import static org.apache.maven.plugins.annotations.LifecyclePhase.*; import static org.forgerock.opendj.maven.doc.DocsMessages.*; -import static org.forgerock.util.Utils.*; import java.io.File; import java.io.FileInputStream; @@ -58,27 +47,16 @@ import org.apache.maven.project.MavenProject; import org.forgerock.i18n.LocalizableMessage; -/** - * Generates an XML file of log messages found in properties files. - */ +/** Generates an XML file of log messages found in properties files. */ @Mojo(name = "generate-xml-messages-doc", defaultPhase = PRE_SITE) public class GenerateMessageFileMojo extends AbstractMojo { - - /** - * The Maven Project. - */ + /** The Maven Project. */ @Parameter(property = "project", readonly = true, required = true) private MavenProject project; - - /** - * The tag of the locale for which to generate the documentation. - */ + /** The tag of the locale for which to generate the documentation. */ @Parameter(defaultValue = "en") private String locale; - - /** - * The path to the directory containing the message properties files. - */ + /** The path to the directory containing the message properties files. */ @Parameter(required = true) private String messagesDirectory; @@ -89,16 +67,11 @@ public class GenerateMessageFileMojo extends AbstractMojo { @Parameter(required = true) private String outputDirectory; - /** - * A list which contains all file names, the extension is not needed. - */ + /** A list which contains all file names, the extension is not needed. */ @Parameter(required = true) private List messageFileNames; - - /** - * One-line descriptions for log reference categories. - */ - private static final HashMap CATEGORY_DESCRIPTIONS = new HashMap<>(); + /** One-line descriptions for log reference categories. */ + private static final Map CATEGORY_DESCRIPTIONS = new HashMap<>(); static { CATEGORY_DESCRIPTIONS.put("ACCESS_CONTROL", CATEGORY_ACCESS_CONTROL.get()); CATEGORY_DESCRIPTIONS.put("ADMIN", CATEGORY_ADMIN.get()); @@ -127,7 +100,6 @@ public class GenerateMessageFileMojo extends AbstractMojo { /** Message giving formatting rules for string keys. */ public static final String KEY_FORM_MSG = ".\n\nOpenDJ message property keys must be of the form\n\n" + "\t\'[CATEGORY]_[SEVERITY]_[DESCRIPTION]_[ORDINAL]\'\n\n"; - private static final String ERROR_SEVERITY_IDENTIFIER_STRING = "ERR_"; /** FreeMarker template configuration. */ @@ -157,26 +129,18 @@ private void writeLogRef(final File file, final String template, final Map { private Integer ordinal; private String xmlId; private String formatString; - /** - * Build log reference entry for an log message. - */ + /** Build log reference entry for an log message. */ public MessageRefEntry(final String msgPropKey, final Integer ordinal, final String formatString) { this.formatString = formatString; this.ordinal = ordinal; @@ -298,7 +262,6 @@ public Integer getOrdinal() { return this.ordinal; } - /** {@inheritDoc} */ @Override public String toString() { if (ordinal != null) { @@ -307,13 +270,14 @@ public String toString() { return description; } - /** {@inheritDoc} */ @Override public int compareTo(MessagePropertyKey k) { if (ordinal == k.ordinal) { return description.compareTo(k.description); - } else { + } else if (ordinal != null && k.ordinal != null) { return ordinal.compareTo(k.ordinal); + } else { + return 0; } } } @@ -361,10 +325,8 @@ public void execute() throws MojoExecutionException, MojoFailureException { private void createOutputDirectory() throws IOException { File outputDir = new File(outputDirectory); - if (outputDir != null && !outputDir.exists()) { - if (!outputDir.mkdirs()) { - throw new IOException("Failed to create output directory."); - } + if (!outputDir.exists() && !outputDir.mkdirs()) { + throw new IOException("Failed to create output directory."); } } diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateRefEntriesMojo.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateRefEntriesMojo.java index 39e77028e..9747a9b6f 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateRefEntriesMojo.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateRefEntriesMojo.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateResultCodeDocMojo.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateResultCodeDocMojo.java index 134a053df..dfe0be0b4 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateResultCodeDocMojo.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateResultCodeDocMojo.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateSchemaDocMojo.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateSchemaDocMojo.java index a5b8195f4..1d65b3f03 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateSchemaDocMojo.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/GenerateSchemaDocMojo.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/Utils.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/Utils.java index 7db7c5ffc..be8a961f9 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/Utils.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/Utils.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.maven.doc; @@ -124,9 +114,9 @@ static void copyInputStreamToFile(InputStream original, File copy) throws IOExce */ static void writeStringToFile(final String string, final File file) throws IOException { createFile(file); - PrintWriter printWriter = new PrintWriter(file); - printWriter.print(string); - printWriter.close(); + try (PrintWriter printWriter = new PrintWriter(file)) { + printWriter.print(string); + } } /** diff --git a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/package-info.java b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/package-info.java index 8b4302359..0daf7e27f 100644 --- a/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/package-info.java +++ b/opendj-doc-maven-plugin/src/main/java/org/forgerock/opendj/maven/doc/package-info.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ /** diff --git a/opendj-doc-maven-plugin/src/main/resources/org/forgerock/opendj/maven/doc/docs.properties b/opendj-doc-maven-plugin/src/main/resources/org/forgerock/opendj/maven/doc/docs.properties index 8a41989af..c7fd1d076 100644 --- a/opendj-doc-maven-plugin/src/main/resources/org/forgerock/opendj/maven/doc/docs.properties +++ b/opendj-doc-maven-plugin/src/main/resources/org/forgerock/opendj/maven/doc/docs.properties @@ -1,28 +1,18 @@ # -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2015 ForgeRock AS. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2015 ForgeRock AS. + # # Documentation messages # diff --git a/opendj-doc-maven-plugin/src/main/resources/templates/appendix-ldap-result-codes.ftl b/opendj-doc-maven-plugin/src/main/resources/templates/appendix-ldap-result-codes.ftl index 3e531276c..158c532cf 100644 --- a/opendj-doc-maven-plugin/src/main/resources/templates/appendix-ldap-result-codes.ftl +++ b/opendj-doc-maven-plugin/src/main/resources/templates/appendix-ldap-result-codes.ftl @@ -1,28 +1,18 @@ <#-- Comment text comes from the Javadoc, so the language is English. -->

- * To be used, this implementation must be declared in the - * provider-configuration file - * {@code META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider} - * with this single line: - * - *
- * com.forgerock.opendj.ldap.GrizzlyTransportProvider
- * 
- * - * To require that this implementation is used, you must set the transport - * provider to "Grizzly" using {@code LDAPOptions#setTransportProvider()} - * method if requesting a {@code LDAPConnectionFactory} or - * {@code LDAPListenerOptions#setTransportProvider()} method if requesting a - * {@code LDAPListener}. Otherwise there is no guarantee that this - * implementation will be used. - */ -package org.forgerock.opendj.grizzly; - diff --git a/opendj-grizzly/src/main/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider b/opendj-grizzly/src/main/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider deleted file mode 100644 index d273aa2e1..000000000 --- a/opendj-grizzly/src/main/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider +++ /dev/null @@ -1,26 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2013 ForgeRock AS. -# -com.forgerock.opendj.grizzly.GrizzlyTransportProvider \ No newline at end of file diff --git a/opendj-grizzly/src/main/resources/com/forgerock/opendj/grizzly/grizzly.properties b/opendj-grizzly/src/main/resources/com/forgerock/opendj/grizzly/grizzly.properties deleted file mode 100755 index c0b3cbbf1..000000000 --- a/opendj-grizzly/src/main/resources/com/forgerock/opendj/grizzly/grizzly.properties +++ /dev/null @@ -1,35 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2013-2014 ForgeRock AS. -# -LDAP_CONNECTION_REQUEST_TIMEOUT=The request has failed because no response \ - was received from the server within the %d ms timeout -LDAP_CONNECTION_CONNECT_TIMEOUT=The connection attempt to server %s has failed \ - because the connection timeout period of %d ms was exceeded -LDAP_CONNECTION_BIND_OR_START_TLS_REQUEST_TIMEOUT=The bind or StartTLS request \ - has failed because no response was received from the server within the %d ms \ - timeout. The LDAP connection is now in an invalid state and can no longer be used -LDAP_CONNECTION_BIND_OR_START_TLS_CONNECTION_TIMEOUT=The LDAP connection has \ - failed because no bind or StartTLS response was received from the server \ - within the %d ms timeout diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferReaderTestCase.java b/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferReaderTestCase.java deleted file mode 100644 index 97de2ec94..000000000 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferReaderTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS - */ - -package org.forgerock.opendj.grizzly; - -import java.io.IOException; -import java.nio.ByteBuffer; - -import org.forgerock.opendj.io.ASN1Reader; -import org.forgerock.opendj.io.ASN1ReaderTestCase; -import org.glassfish.grizzly.memory.ByteBufferWrapper; -import org.glassfish.grizzly.memory.MemoryManager; - -/** - * This class provides test cases for ASN1BufferReader. - */ -public class ASN1BufferReaderTestCase extends ASN1ReaderTestCase { - @Override - protected ASN1Reader getReader(final byte[] b, final int maxElementSize) throws IOException { - final ByteBufferWrapper buffer = new ByteBufferWrapper(ByteBuffer.wrap(b)); - final ASN1BufferReader reader = - new ASN1BufferReader(maxElementSize, MemoryManager.DEFAULT_MEMORY_MANAGER); - reader.appendBytesRead(buffer); - return reader; - } -} diff --git a/opendj-ldap-sdk-examples/pom.xml b/opendj-ldap-sdk-examples/pom.xml index a86f7009f..e2b65fce6 100644 --- a/opendj-ldap-sdk-examples/pom.xml +++ b/opendj-ldap-sdk-examples/pom.xml @@ -1,28 +1,18 @@ 4.0.0 @@ -30,8 +20,7 @@ opendj-sdk-parent org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml + 4.0.0-SNAPSHOT opendj-ldap-sdk-examples @@ -41,12 +30,12 @@ org.forgerock.opendj - opendj-core + opendj-sdk-core org.forgerock.opendj - opendj-grizzly + opendj-sdk-grizzly diff --git a/opendj-ldap-sdk-examples/src/main/assembly/examples.xml b/opendj-ldap-sdk-examples/src/main/assembly/examples.xml index 22f76f7d7..56f4c548f 100644 --- a/opendj-ldap-sdk-examples/src/main/assembly/examples.xml +++ b/opendj-ldap-sdk-examples/src/main/assembly/examples.xml @@ -1,28 +1,18 @@ - * {@code - * [ ...]} + * {@code [--load-balancer ] + * [ ...]} * + * + * Where {@code } is one of "round-robin", "fail-over", or "sharded". The default is round-robin. */ public final class Proxy { /** * Main method. * * @param args - * The command line arguments: listen address, listen port, + * The command line arguments: [--load-balancer ] listen address, listen port, * remote address1, remote port1, remote address2, remote port2, * ... */ public static void main(final String[] args) { if (args.length < 6 || args.length % 2 != 0) { - System.err.println("Usage: listenAddress listenPort " - + "proxyDN proxyPassword remoteAddress1 remotePort1 " - + "remoteAddress2 remotePort2 ..."); + System.err.println("Usage: [--load-balancer ] listenAddress listenPort " + + "proxyDN proxyPassword remoteAddress1 remotePort1 remoteAddress2 remotePort2 ..."); System.exit(1); } // Parse command line arguments. - final String localAddress = args[0]; - final int localPort = Integer.parseInt(args[1]); + int i = 0; + + final LoadBalancingAlgorithm algorithm; + if ("--load-balancer".equals(args[i])) { + algorithm = getLoadBalancingAlgorithm(args[i + 1]); + i += 2; + } else { + algorithm = LoadBalancingAlgorithm.ROUND_ROBIN; + } - final String proxyDN = args[2]; - final String proxyPassword = args[3]; + final String localAddress = args[i++]; + final int localPort = Integer.parseInt(args[i++]); + + final String proxyDN = args[i++]; + final String proxyPassword = args[i++]; // Create load balancer. // --- JCite pools --- @@ -100,7 +102,7 @@ public static void main(final String[] args) { final List bindFactories = new LinkedList<>(); final Options bindFactoryOptions = Options.defaultOptions().set(HEARTBEAT_ENABLED, true); - for (int i = 4; i < args.length; i += 2) { + for (; i < args.length; i += 2) { final String remoteAddress = args[i]; final int remotePort = Integer.parseInt(args[i + 1]); @@ -114,10 +116,8 @@ public static void main(final String[] args) { } // --- JCite pools --- - // --- JCite load balancer --- - final ConnectionFactory factory = Connections.newRoundRobinLoadBalancer(factories, factoryOptions); - final ConnectionFactory bindFactory = Connections.newRoundRobinLoadBalancer(bindFactories, bindFactoryOptions); - // --- JCite load balancer --- + final ConnectionFactory factory = algorithm.newLoadBalancer(factories, factoryOptions); + final ConnectionFactory bindFactory = algorithm.newLoadBalancer(bindFactories, bindFactoryOptions); // --- JCite backend --- /* @@ -156,6 +156,47 @@ public ProxyBackend handleAccept(LDAPClientContext clientContext) // --- JCite listener --- } + private static LoadBalancingAlgorithm getLoadBalancingAlgorithm(final String algorithmName) { + switch (algorithmName) { + case "round-robin": + return LoadBalancingAlgorithm.ROUND_ROBIN; + case "fail-over": + return LoadBalancingAlgorithm.FAIL_OVER; + case "sharded": + return LoadBalancingAlgorithm.SHARDED; + default: + System.err.println("Unrecognized load-balancing algorithm '" + algorithmName + "'. Should be one of " + + "'round-robin', 'fail-over', or 'sharded'."); + System.exit(1); + } + return LoadBalancingAlgorithm.ROUND_ROBIN; // keep compiler happy. + } + + private enum LoadBalancingAlgorithm { + ROUND_ROBIN { + @Override + ConnectionFactory newLoadBalancer(final Collection factories, final Options options) { + // --- JCite load balancer --- + return Connections.newRoundRobinLoadBalancer(factories, options); + // --- JCite load balancer --- + } + }, + FAIL_OVER { + @Override + ConnectionFactory newLoadBalancer(final Collection factories, final Options options) { + return Connections.newFailoverLoadBalancer(factories, options); + } + }, + SHARDED { + @Override + ConnectionFactory newLoadBalancer(final Collection factories, final Options options) { + return Connections.newShardedRequestLoadBalancer(factories, options); + } + }; + + abstract ConnectionFactory newLoadBalancer(Collection factories, Options options); + } + private Proxy() { // Not used. } diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ProxyBackend.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ProxyBackend.java index b9dfdf98d..7073c8e5b 100644 --- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ProxyBackend.java +++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ProxyBackend.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.examples; import java.util.concurrent.atomic.AtomicReference; @@ -78,7 +67,6 @@ * client connection. The following code illustrates how this may be achieved: * *
- *     {@code
  * final RequestHandlerFactory proxyFactory =
  *     new RequestHandlerFactory() {
  *         @Override
@@ -101,7 +89,6 @@ final class ProxyBackend implements RequestHandler {
         this.bindFactory = bindFactory;
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleAdd(final RequestContext requestContext, final AddRequest request,
         final IntermediateResponseHandler intermediateResponseHandler, final LdapResultHandler resultHandler) {
@@ -117,7 +104,6 @@ public Promise apply(Connection connection) throws LdapEx
         }).thenOnResult(resultHandler).thenOnException(resultHandler).thenAlways(close(connectionHolder));
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleBind(final RequestContext requestContext, final int version, final BindRequest request,
         final IntermediateResponseHandler intermediateResponseHandler,
@@ -147,10 +133,8 @@ public final void handleResult(final BindResult result) {
                         }
                     }).thenOnException(resultHandler).thenAlways(close(connectionHolder));
         }
-
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleCompare(final RequestContext requestContext, final CompareRequest request,
             final IntermediateResponseHandler intermediateResponseHandler,
@@ -167,7 +151,6 @@ public Promise apply(Connection connection) throws
         }).thenOnResult(resultHandler).thenOnException(resultHandler).thenAlways(close(connectionHolder));
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleDelete(final RequestContext requestContext, final DeleteRequest request,
             final IntermediateResponseHandler intermediateResponseHandler,
@@ -184,7 +167,6 @@ public Promise apply(Connection connection) throws LdapEx
         }).thenOnResult(resultHandler).thenOnException(resultHandler).thenAlways(close(connectionHolder));
     }
 
-    /** {@inheritDoc} */
     @Override
     public  void handleExtendedRequest(final RequestContext requestContext,
         final ExtendedRequest request, final IntermediateResponseHandler intermediateResponseHandler,
@@ -213,7 +195,6 @@ public Promise apply(Connection connection) throws LdapExcepti
         }
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleModify(final RequestContext requestContext, final ModifyRequest request,
             final IntermediateResponseHandler intermediateResponseHandler,
@@ -230,7 +211,6 @@ public Promise apply(Connection connection) throws LdapEx
         }).thenOnResult(resultHandler).thenOnException(resultHandler).thenAlways(close(connectionHolder));
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleModifyDN(final RequestContext requestContext, final ModifyDNRequest request,
         final IntermediateResponseHandler intermediateResponseHandler, final LdapResultHandler resultHandler) {
@@ -246,7 +226,6 @@ public Promise apply(Connection connection) throws LdapEx
         }).thenOnResult(resultHandler).thenOnException(resultHandler).thenAlways(close(connectionHolder));
     }
 
-    /** {@inheritDoc} */
     @Override
     public void handleSearch(final RequestContext requestContext, final SearchRequest request,
             final IntermediateResponseHandler intermediateResponseHandler, final SearchResultHandler entryHandler,
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
index 592b72849..47a6129b6 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ReadSchema.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/RewriterProxy.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/RewriterProxy.java
index 8ebe90def..108b30782 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/RewriterProxy.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/RewriterProxy.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
index a4ccb0c28..ea4c563b0 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SASLAuth.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2011-2015 ForgeRock AS.
  */
 
 /**
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
index 9ca41b2bb..da511b4ce 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Search.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
index 8ab1d6a4f..9d52a64a7 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchAsync.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2015 ForgeRock AS.
+ * Copyright 2015-2016 ForgeRock AS.
  */
 package org.forgerock.opendj.examples;
 
@@ -61,7 +51,6 @@
 public final class SearchAsync {
     // --- JCite search result handler ---
     private static final class SearchResultHandlerImpl implements SearchResultHandler {
-        /** {@inheritDoc} */
         @Override
         public synchronized boolean handleEntry(final SearchResultEntry entry) {
             try {
@@ -101,7 +90,6 @@ public void handleException(LdapException exception) {
             return true;
         }
 
-        /** {@inheritDoc} */
         @Override
         public synchronized boolean handleReference(final SearchResultReference reference) {
             try {
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
index 07ae6e84c..75bfd7804 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBind.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *      Copyright 2012-2015 ForgeRock AS.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
+ * Copyright 2012-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBindAsync.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBindAsync.java
index c2266167a..3d59c2cb3 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBindAsync.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SearchBindAsync.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *      Copyright 2015 ForgeRock AS.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
+ * Copyright 2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
index 8b6e6537a..a422e8492 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Server.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLife.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLife.java
index 831ab6574..095fb71c2 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLife.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLife.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *      Copyright 2012-2015 ForgeRock AS.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
+ * Copyright 2012-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLifeAsync.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLifeAsync.java
index c0c82a3f6..9a6f257d5 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLifeAsync.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/ShortLifeAsync.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *      Copyright 2015 ForgeRock AS.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
+ * Copyright 2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
index 72fc412fd..df8eb2ba5 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuth.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2011-2015 ForgeRock AS
+ * Copyright 2011-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuthAsync.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuthAsync.java
index 67b3eba88..c9e796365 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuthAsync.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/SimpleAuthAsync.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2015 ForgeRock AS.
+ * Copyright 2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroup.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroup.java
index dd4cfa185..7ec596f1b 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroup.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroup.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *      Copyright 2012-2014 ForgeRock AS
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
+ * Copyright 2012-2014 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroupAsync.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroupAsync.java
index 023341307..d440d017d 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroupAsync.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UpdateGroupAsync.java
@@ -1,29 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *      Copyright 2015 ForgeRock AS.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
+ * Copyright 2016 ForgeRock AS.
  */
-
 package org.forgerock.opendj.examples;
 
 import static org.forgerock.util.Utils.closeSilently;
@@ -115,7 +104,7 @@ public Promise apply(Connection connection)
                     @Override
                     public Promise apply(BindResult bindResult)
                             throws LdapException {
-                        return RootDSE.readRootDSEAsync(connection, null);
+                        return RootDSE.readRootDSEAsync(connection);
                     }
                 })
                 .thenAsync(new AsyncFunction() {
@@ -191,9 +180,7 @@ public void handleException(LdapException e) {
         System.exit(resultCode);
     }
 
-    /**
-     * Print usage then exit.
-     */
+    /** Print usage then exit. */
     private static void printUsage() {
         System.err.println("Usage: host port group-dn member-dn {add|del}");
         System.err.println("For example: localhost 1389 "
@@ -224,9 +211,7 @@ private static void log(final String message) {
         System.out.println(message);
     }
 
-    /**
-     * Constructor not used.
-     */
+    /** Constructor not used. */
     private UpdateGroupAsync() {
         // Not used.
     }
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseGenericControl.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseGenericControl.java
index be5993d98..b1a26c265 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseGenericControl.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseGenericControl.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchema.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchema.java
index e9563b1e3..40d405219 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchema.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchema.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2015 ForgeRock AS.
+ * Copyright 2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchemaAsync.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchemaAsync.java
index 6666da9e9..c175ba765 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchemaAsync.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/UseSchemaAsync.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2015 ForgeRock AS.
+ * Copyright 2015 ForgeRock AS.
  */
 
 package org.forgerock.opendj.examples;
diff --git a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java
index 674532ae1..d0ae1e141 100644
--- a/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java
+++ b/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/package-info.java
@@ -1,27 +1,17 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2012 ForgeRock AS
+ * Copyright 2012 ForgeRock AS.
  */
 
 /**
diff --git a/opendj-ldap-sdk-examples/src/site/xdoc/index.xml.vm b/opendj-ldap-sdk-examples/src/site/xdoc/index.xml.vm
index abe0de47a..bdda1a74f 100644
--- a/opendj-ldap-sdk-examples/src/site/xdoc/index.xml.vm
+++ b/opendj-ldap-sdk-examples/src/site/xdoc/index.xml.vm
@@ -1,28 +1,18 @@
 
 
 
diff --git a/opendj-ldap-toolkit/legal-notices/THIRDPARTYREADME.txt b/opendj-ldap-toolkit/legal-notices/THIRDPARTYREADME.txt
index 9865ba266..d136babfc 100644
--- a/opendj-ldap-toolkit/legal-notices/THIRDPARTYREADME.txt
+++ b/opendj-ldap-toolkit/legal-notices/THIRDPARTYREADME.txt
@@ -4,7 +4,7 @@ DO NOT TRANSLATE OR LOCALIZE
 COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0
 ***************************************************************************
 
-Version: forgerock-util.jar (3.0.1)
+Version: forgerock-util.jar (3.0.2)
 Copyright: Copyright 2011-2015 ForgeRock AS.
            Copyright (c) 2010-2011 ApexIdentity Inc. All rights reserved.
            Portions Copyright 2011-2015 ForgeRock AS.
@@ -38,7 +38,7 @@ Copyright: Copyright 2013-2015 ForgeRock AS.
            Portions Copyright 2011-2015 ForgeRock AS.
 
 Version: opendj-ldap-toolkit.jar (3.0.0)
-Copyright: Copyright 2011-2015 ForgeRock AS.
+Copyright: Copyright 2011-2016 ForgeRock AS.
            Copyright 2006-2010 Sun Microsystems, Inc.
            Portions Copyright 2011-2015 ForgeRock AS.
 ==================
@@ -176,6 +176,95 @@ This License represents the complete agreement concerning subject matter hereof.
 As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
 
 
+***************************************************************************
+Apache Software License, Version 2.0
+***************************************************************************
+
+Version: jsr305.jar (3.0.0)
+Copyright: Copyright (c) 2005 Brian Goetz
+
+Version: metrics-core.jar (3.1.2)
+Copyright: Copyright (c) 2010-2014 Coda Hale, Yammer.com
+
+Version: hdrhistogram-metrics-reservoir.jar (1.1.0)
+Copyright: Copyright (c) 2014-2015 Marshall Pierce
+
+==================
+Full license text:
+==================
+
+Apache License
+
+Version 2.0, January 2004
+
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
+
+"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of this License; and
+You must cause any modified files to carry prominent notices stating that You changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
+
+You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
+5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
 ***************************************************************************
 The MIT License (MIT)
 ***************************************************************************
@@ -211,3 +300,39 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
+
+
+***************************************************************************
+The BSD 2-Clause License
+***************************************************************************
+
+Version: HdrHistogram.jar (2.1.4)
+Copyright (c) 2012, 2013, 2014 Gil Tene
+Copyright (c) 2014 Michael Barker
+Copyright (c) 2014 Matt Warren
+
+==================
+Full license text:
+==================
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,
+   this list of conditions and the following disclaimer in the documentation
+   and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
diff --git a/opendj-ldap-toolkit/pom.xml b/opendj-ldap-toolkit/pom.xml
index e488f9c2f..3cb329e7f 100644
--- a/opendj-ldap-toolkit/pom.xml
+++ b/opendj-ldap-toolkit/pom.xml
@@ -1,28 +1,18 @@
 
 
 
     4.0.0
@@ -30,8 +20,7 @@
     
         opendj-sdk-parent
         org.forgerock.opendj
-        3.0.0-SNAPSHOT
-        ../opendj-sdk-parent/pom.xml
+        4.0.0-SNAPSHOT
     
 
     opendj-ldap-toolkit
@@ -41,14 +30,25 @@
     jar
 
     
+        
+            io.dropwizard.metrics
+            metrics-core
+        
+
+        
+            org.mpierce.metrics.reservoir
+            hdrhistogram-metrics-reservoir
+            1.1.0
+        
+
         
             org.forgerock.opendj
-            opendj-core
+            opendj-sdk-core
         
 
         
             org.forgerock.opendj
-            opendj-grizzly
+            opendj-sdk-grizzly
         
 
         
@@ -73,7 +73,7 @@
 
         
             org.forgerock.opendj
-            opendj-core
+            opendj-sdk-core
             test-jar
             test
         
@@ -138,6 +138,9 @@
                             
                                 src/main/assembly/descriptor.xml
                             
+                            
+                                zip
+                            
                         
                     
                 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/addrate.bat b/opendj-ldap-toolkit/src/main/assembly/bat/addrate.bat
index d6e8d425b..66be9fdf1 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bat/addrate.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/addrate.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2014 ForgeRock AS
+rem Copyright 2014 ForgeRock AS.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat b/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat
index 07645287d..ee463c35c 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/authrate.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2010 Sun Microsystems, Inc.
+rem Copyright 2010 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat
old mode 100755
new mode 100644
index f45774190..96083bd5c
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldapcompare.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2006-2008 Sun Microsystems, Inc.
+rem Copyright 2006-2008 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat
old mode 100755
new mode 100644
index b2d9e16c1..e69a74b61
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldapmodify.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2006-2008 Sun Microsystems, Inc.
+rem Copyright 2006-2008 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat
old mode 100755
new mode 100644
index fdd921836..6fd4ec816
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldappasswordmodify.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2006-2008 Sun Microsystems, Inc.
+rem Copyright 2006-2008 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat
old mode 100755
new mode 100644
index bad1fae55..b91e20340
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldapsearch.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2006-2008 Sun Microsystems, Inc.
+rem Copyright 2006-2008 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat
old mode 100755
new mode 100644
index 02d4b5131..57d155a23
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldifdiff.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2012 ForgeRock AS.
+rem Copyright 2012 ForgeRock AS.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat
old mode 100755
new mode 100644
index 17c16da7b..a2642ca35
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldifmodify.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2012 ForgeRock AS.
+rem Copyright 2012 ForgeRock AS.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat b/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat
old mode 100755
new mode 100644
index ef0c8a529..0f1c440a3
--- a/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/ldifsearch.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2012 ForgeRock AS.
+rem Copyright 2012 ForgeRock AS.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/makeldif.bat b/opendj-ldap-toolkit/src/main/assembly/bat/makeldif.bat
old mode 100755
new mode 100644
index 67cb47a7a..fe7a50dcd
--- a/opendj-ldap-toolkit/src/main/assembly/bat/makeldif.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/makeldif.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2013 ForgeRock AS.
+rem Copyright 2013 ForgeRock AS.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat b/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat
old mode 100755
new mode 100644
index 5fac190d3..d2aad8a9d
--- a/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/modrate.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2009 Sun Microsystems, Inc.
+rem Copyright 2009 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat b/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat
old mode 100755
new mode 100644
index d2984a34f..9bcd1ac58
--- a/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/bat/searchrate.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2009 Sun Microsystems, Inc.
+rem Copyright 2009 Sun Microsystems, Inc.
 
 setlocal
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/addrate b/opendj-ldap-toolkit/src/main/assembly/bin/addrate
index 62bb339b1..d435cd6ad 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/addrate
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/addrate
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2014-2015 ForgeRock AS.
+# Copyright 2014-2015 ForgeRock AS.
 
 
 OPENDJ_INVOKE_CLASS="com.forgerock.opendj.ldap.tools.AddRate"
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/authrate b/opendj-ldap-toolkit/src/main/assembly/bin/authrate
index 0aaaa543b..b2552b59b 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/authrate
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/authrate
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2010 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2010 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to measure auth performance.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldapcompare b/opendj-ldap-toolkit/src/main/assembly/bin/ldapcompare
index bef30c3a0..7c2856862 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldapcompare
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldapcompare
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2006-2008 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2006-2008 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP compare operations.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldapmodify b/opendj-ldap-toolkit/src/main/assembly/bin/ldapmodify
index 9b011ea7e..063d6372c 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldapmodify
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldapmodify
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2006-2008 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2006-2008 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP add, delete, modify, and modify DN
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldappasswordmodify b/opendj-ldap-toolkit/src/main/assembly/bin/ldappasswordmodify
index 512f64019..ac8cbee0c 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldappasswordmodify
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldappasswordmodify
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2006-2008 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2006-2008 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP password modify operations.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldapsearch b/opendj-ldap-toolkit/src/main/assembly/bin/ldapsearch
index 5b04eabb8..1e221c3b0 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldapsearch
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldapsearch
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2006-2008 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2006-2008 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP search operations.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldifdiff b/opendj-ldap-toolkit/src/main/assembly/bin/ldifdiff
index 81bffb9f5..ede3ee6f9 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldifdiff
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldifdiff
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2012-2015 ForgeRock AS.
+# Copyright 2012-2015 ForgeRock AS.
 
 
 # This script may be used to compare LDIF files.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldifmodify b/opendj-ldap-toolkit/src/main/assembly/bin/ldifmodify
index f9a7c807d..a4a987834 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldifmodify
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldifmodify
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2012-2015 ForgeRock AS.
+# Copyright 2012-2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP add, delete, modify, and modify DN
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/ldifsearch b/opendj-ldap-toolkit/src/main/assembly/bin/ldifsearch
index 962c85cbb..f2bc7fca2 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/ldifsearch
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/ldifsearch
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2012-2015 ForgeRock AS.
+# Copyright 2012-2015 ForgeRock AS.
 
 
 # This script may be used to perform search operations against an LDIF file.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/makeldif b/opendj-ldap-toolkit/src/main/assembly/bin/makeldif
index 8c0a262ed..86273b484 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/makeldif
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/makeldif
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2013-2015 ForgeRock AS.
+# Copyright 2013-2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP add, delete, modify, and modify DN
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/modrate b/opendj-ldap-toolkit/src/main/assembly/bin/modrate
index 4501c6894..b3a32f12b 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/modrate
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/modrate
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2009 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2009 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP search operations.
diff --git a/opendj-ldap-toolkit/src/main/assembly/bin/searchrate b/opendj-ldap-toolkit/src/main/assembly/bin/searchrate
index eca21e261..1096381f1 100644
--- a/opendj-ldap-toolkit/src/main/assembly/bin/searchrate
+++ b/opendj-ldap-toolkit/src/main/assembly/bin/searchrate
@@ -1,29 +1,19 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at
-# legal-notices/CDDLv1_0.txt.  If applicable,
-# add the following below this CDDL HEADER, with the fields enclosed
-# by brackets "[]" replaced with your own identifying information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2009 Sun Microsystems, Inc.
-#      Portions Copyright 2015 ForgeRock AS.
+# Copyright 2009 Sun Microsystems, Inc.
+# Portions Copyright 2015 ForgeRock AS.
 
 
 # This script may be used to perform LDAP search operations.
diff --git a/opendj-ldap-toolkit/src/main/assembly/descriptor.xml b/opendj-ldap-toolkit/src/main/assembly/descriptor.xml
index 0fb1e5236..ab4fdff0c 100644
--- a/opendj-ldap-toolkit/src/main/assembly/descriptor.xml
+++ b/opendj-ldap-toolkit/src/main/assembly/descriptor.xml
@@ -1,114 +1,110 @@
 
 
 
-  opendj-ldap-toolkit
-  
-    zip
-  
-  
-    
-      ${project.basedir}
-      
-      755
-      644
-      
-        README
-        LICENSE
-        NOTICE
-      
-    
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2
+                              http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+    opendj-ldap-toolkit
+
+    ${project.artifactId}
+
+    
+        
+            lib
+            0755
+            0644
+        
+    
+
+    
+        
+            ${project.basedir}
+            
+            755
+            644
+            
+                README
+                LICENSE
+                NOTICE
+            
+        
+
+        
+        
+            ${basedir}/../legal-notices
+            legal-notices
+            0755
+            0644
+            
+                CDDLv1_0.txt
+            
+        
+
+        
+        
+            ${basedir}/legal-notices
+            legal-notices
+            0755
+            0644
+            
+                THIRDPARTYREADME.txt
+            
+        
+
+        
+            ${project.parent.parent.basedir}
+            
+            755
+            644
+            
+                *.png
+            
+        
+
+        
+            src/main/assembly/bin
+            bin
+            0755
+            0755
+            unix
+        
+
+        
+            src/main/assembly/bat
+            bat
+            0755
+            0644
+            dos
+        
 
-    
-    
-      ${basedir}/../legal-notices
-      legal-notices
-      0755
-      0644
-      
-          CDDLv1_0.txt
-      
-    
+        
+            src/main/assembly/libbin
+            lib
+            0755
+            0755
+            unix
+        
 
-    
-    
-      ${basedir}/legal-notices
-      legal-notices
-      0755
-      0644
-      
-        THIRDPARTYREADME.txt
-      
-    
-  
-    ${project.parent.parent.basedir}
-    
-    755
-    644
-    
-      *.png
-    
-  
-    
-      src/main/assembly/bin
-      bin
-      0755
-      0755
-      unix
-    
-    
-      src/main/assembly/bat
-      bat
-      0755
-      0644
-      dos
-    
-    
-      src/main/assembly/libbin
-      lib
-      0755
-      0755
-      unix
-    
-    
-      src/main/assembly/libbat
-      lib
-      0755
-      0644
-      dos
-    
-  
-  
-    
-      lib
-      0755
-      0644
-    
-  
+        
+            src/main/assembly/libbat
+            lib
+            0755
+            0644
+            dos
+        
+    
 
diff --git a/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat b/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat
old mode 100755
new mode 100644
index 5ac8809bc..eaed2040e
--- a/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/libbat/_client-script.bat
@@ -1,29 +1,18 @@
 
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2006-2009 Sun Microsystems, Inc.
+rem Copyright 2006-2009 Sun Microsystems, Inc.
 
 rem This script is used to invoke various client-side processes.  It should not
 rem be invoked directly by end users.
diff --git a/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat b/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
old mode 100755
new mode 100644
index 8cb983b63..1a612a92f
--- a/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/libbat/_script-util.bat
@@ -1,29 +1,18 @@
 @echo off
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2008-2009 Sun Microsystems, Inc.
-rem      Portions copyright 2013-2015 ForgeRock AS.
+rem Copyright 2008-2009 Sun Microsystems, Inc.
+rem Portions copyright 2013-2016 ForgeRock AS.
 
 set SET_JAVA_HOME_AND_ARGS_DONE=false
 set SET_ENVIRONMENT_VARS_DONE=false
@@ -75,7 +64,6 @@ if "%SET_CLASSPATH_DONE%" == "false" goto setClassPath
 if "%SET_ENVIRONMENT_VARS_DONE%" == "false" goto setEnvironmentVars
 goto testJava
 
-
 :setJavaHomeAndArgs
 if "%SET_JAVA_HOME_AND_ARGS_DONE%" == "true" goto prepareCheck
 if not exist "%INSTANCE_ROOT%\lib\set-java-home.bat" goto checkEnvJavaArgs
@@ -137,51 +125,6 @@ set SCRIPT_NAME_ARG=-Dcom.forgerock.opendj.ldap.tools.scriptName=%SCRIPT_NAME%
 set SET_ENVIRONMENT_VARS_DONE=true
 goto scriptBegin
 
-:noValidJavaHome
-if NOT "%OPENDJ_JAVA_ARGS%" == "" goto noValidHomeWithArgs
-echo ERROR:  The detected Java version could not be used.  The detected
-echo Java binary is:
-echo %OPENDJ_JAVA_BIN%
-echo You must specify the path to a valid Java 5.0 or higher version.
-echo The procedure to follow is:
-echo 1. Delete the file %INSTANCE_ROOT%\lib\set-java-home.bat if it exists.
-echo 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid
-echo Java 5.0 installation.
-echo If you want to have specific Java settings for each command line you must
-echo follow the steps 3 and 4.
-echo 3. Edit the properties file specifying the Java binary and the Java arguments
-echo for each command line.  The Java properties file is located in:
-echo %INSTANCE_ROOT%\config\java.properties.
-echo 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat
-pause
-exit /B 1
-
-:notSupportedJavaHome
-rem We get here when the java version is 5 (or up) but not supported.  We run
-rem InstallDS again to see a localized message.
-"%OPENDJ_JAVA_BIN%" %OPENDJ_JAVA_ARGS% org.opendj.server.tools.InstallDS --testonly
-pause
-exit /B 1
-
-:noValidHomeWithArgs
-echo ERROR:  The detected Java version could not be used with the set of Java
-echo arguments %OPENDJ_JAVA_ARGS%.
-echo The detected Java binary is:
-echo %OPENDJ_JAVA_BIN%
-echo You must specify the path to a valid Java 5.0 or higher version.
-echo The procedure to follow is:
-echo 1. Delete the file %INSTANCE_ROOT%\lib\set-java-home.bat if it exists.
-echo 2. Set the environment variable OPENDJ_JAVA_HOME to the root of a valid
-echo Java 5.0 installation.
-echo If you want to have specific Java settings for each command line you must
-echo follow the steps 3 and 4.
-echo 3. Edit the properties file specifying the Java binary and the Java arguments
-echo for each command line.  The Java properties file is located in:
-echo %INSTANCE_ROOT%\config\java.properties.
-echo 4. Run the command-line %INSTALL_ROOT%\bat\dsjavaproperties.bat
-pause
-exit /B 1
-
 :isVersionOrHelp
 if [%1] == [] goto end
 if [%1] == [--help] goto end
diff --git a/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat b/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat
old mode 100755
new mode 100644
index d0363c884..a47d4e6ac
--- a/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat
+++ b/opendj-ldap-toolkit/src/main/assembly/libbat/setcp.bat
@@ -1,28 +1,17 @@
 
-rem CDDL HEADER START
+rem The contents of this file are subject to the terms of the Common Development and
+rem Distribution License (the License). You may not use this file except in compliance with the
+rem License.
 rem
-rem The contents of this file are subject to the terms of the
-rem Common Development and Distribution License, Version 1.0 only
-rem (the "License").  You may not use this file except in compliance
-rem with the License.
+rem You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+rem specific language governing permission and limitations under the License.
 rem
-rem You can obtain a copy of the license at
-rem legal-notices/CDDLv1_0.txt
-rem or http://forgerock.org/license/CDDLv1.0.html.
-rem See the License for the specific language governing permissions
-rem and limitations under the License.
+rem When distributing Covered Software, include this CDDL Header Notice in each file and include
+rem the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+rem Header, with the fields enclosed by brackets [] replaced by your own identifying
+rem information: "Portions Copyright [year] [name of copyright owner]".
 rem
-rem When distributing Covered Code, include this CDDL HEADER in each
-rem file and include the License file at legal-notices/CDDLv1_0.txt.
-rem legal-notices/CDDLv1_0.txt.  If applicable,
-rem add the following below this CDDL HEADER, with the fields enclosed
-rem by brackets "[]" replaced with your own identifying information:
-rem      Portions Copyright [yyyy] [name of copyright owner]
-rem
-rem CDDL HEADER END
-rem
-rem
-rem      Copyright 2006-2008 Sun Microsystems, Inc.
+rem Copyright 2006-2008 Sun Microsystems, Inc.
 
 set CLASSPATHCOMPONENT=%1
 if ""%1""=="""" goto gotAllArgs
diff --git a/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh b/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh
old mode 100755
new mode 100644
index 5ef47c2e1..f65eb6c06
--- a/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh
+++ b/opendj-ldap-toolkit/src/main/assembly/libbin/_client-script.sh
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at legal-notices/CDDLv1_0.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2006-2008 Sun Microsystems, Inc.
+# Copyright 2006-2008 Sun Microsystems, Inc.
 
 
 # This script is used to invoke various client-side processes.  It should not
diff --git a/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh b/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
old mode 100755
new mode 100644
index 275684236..4d1938353
--- a/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
+++ b/opendj-ldap-toolkit/src/main/assembly/libbin/_script-util.sh
@@ -1,28 +1,18 @@
 #!/bin/sh
 #
-# CDDL HEADER START
+# The contents of this file are subject to the terms of the Common Development and
+# Distribution License (the License). You may not use this file except in compliance with the
+# License.
 #
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+# specific language governing permission and limitations under the License.
 #
-# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
-# or http://forgerock.org/license/CDDLv1.0.html.
-# See the License for the specific language governing permissions
-# and limitations under the License.
+# When distributing Covered Software, include this CDDL Header Notice in each file and include
+# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+# Header, with the fields enclosed by brackets [] replaced by your own identifying
+# information: "Portions Copyright [year] [name of copyright owner]".
 #
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at legal-notices/CDDLv1_0.txt.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information:
-#      Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-#
-#      Copyright 2008-2009 Sun Microsystems, Inc.
+# Copyright 2008-2009 Sun Microsystems, Inc.
 
 #
 # function that sets the java home
diff --git a/opendj-ldap-toolkit/src/main/assembly/man-pages.xml b/opendj-ldap-toolkit/src/main/assembly/man-pages.xml
index 41a280897..b5fb9588c 100644
--- a/opendj-ldap-toolkit/src/main/assembly/man-pages.xml
+++ b/opendj-ldap-toolkit/src/main/assembly/man-pages.xml
@@ -1,28 +1,18 @@
 
 
  {
             private final String entryDN;
 
@@ -93,9 +86,7 @@ private AddStatsHandler(final long currentTime, final String entryDN) {
             }
 
             @Override
-            public void handleResult(final Result result) {
-                super.handleResult(result);
-
+            void updateAdditionalStatsOnResult() {
                 switch (delStrategy) {
                 case RANDOM:
                     long newKey;
@@ -104,7 +95,7 @@ public void handleResult(final Result result) {
                     } while (dnEntriesAdded.putIfAbsent(newKey, entryDN) != null);
                     break;
                 case FIFO:
-                    long uniqueTime = currentTime;
+                    long uniqueTime = operationStartTimeNs;
                     while (dnEntriesAdded.putIfAbsent(uniqueTime, entryDN) != null) {
                         uniqueTime++;
                     }
@@ -113,9 +104,8 @@ public void handleResult(final Result result) {
                     break;
                 }
 
-                recentAdds.getAndIncrement();
-                totalAdds.getAndIncrement();
-                entryCount.getAndIncrement();
+                addCounter.inc();
+                entryCount.inc();
             }
         }
 
@@ -125,36 +115,37 @@ private DeleteStatsHandler(final long startTime) {
             }
 
             @Override
-            public void handleResult(final Result result) {
-                super.handleResult(result);
-                recentDeletes.getAndIncrement();
-                entryCount.getAndDecrement();
+            void updateAdditionalStatsOnResult() {
+                deleteCounter.inc();
+                entryCount.dec();
             }
         }
 
         private final class AddRateStatsThread extends StatsThread {
-            private final String[] extraColumn = new String[1];
+            private static final int PERCENTAGE_ADD_COLUMN_WIDTH = 6;
+            private static final String PERCENTAGE_ADD = STAT_ID_PREFIX + "add_percentage";
 
-            private AddRateStatsThread() {
-                super("Add%");
+            private AddRateStatsThread(final PerformanceRunner perfRunner, final ConsoleApplication app) {
+                super(perfRunner, app);
             }
 
             @Override
-            void resetStats() {
-                super.resetStats();
-                recentAdds.set(0);
-                recentDeletes.set(0);
+            void resetAdditionalStats() {
+                addCounter = newIntervalCounter();
+                deleteCounter = newIntervalCounter();
             }
 
             @Override
-            String[] getAdditionalColumns() {
-                final int adds = recentAdds.getAndSet(0);
-                final int deleteStat = recentDeletes.getAndSet(0);
-                final int total = adds + deleteStat;
-
-                extraColumn[0] = String.format(ENGLISH, "%.2f", total > 0 ? ((double) adds / total) * 100 : 0.0);
-
-                return extraColumn;
+            List registerAdditionalColumns() {
+                registry.register(PERCENTAGE_ADD, new RatioGauge() {
+                    @Override
+                    protected Ratio getRatio() {
+                        final long addIntervalCount = addCounter.refreshIntervalCount();
+                        final long deleteIntervalCount = deleteCounter.refreshIntervalCount();
+                        return Ratio.of(addIntervalCount * 100, addIntervalCount + deleteIntervalCount);
+                    }
+                });
+                return Collections.singletonList(column(PERCENTAGE_ADD, "Add%", PERCENTAGE_ADD_COLUMN_WIDTH, 2));
             }
         }
 
@@ -165,16 +156,16 @@ private AddDeleteWorkerThread(final Connection connection, final ConnectionFacto
 
             @Override
             public Promise performOperation(
-                    final Connection connection, final DataSource[] dataSources, final long currentTime) {
+                    final Connection connection, final DataSource[] dataSources, final long currentTimeNs) {
                 startPurgeIfMaxNumberAddReached();
-                startToggleDeleteIfAgeThresholdReached(currentTime);
+                startToggleDeleteIfAgeThresholdReached(currentTimeNs);
                 try {
-                    String entryToRemove = getEntryToRemove(currentTime);
+                    String entryToRemove = getEntryToRemove();
                     if (entryToRemove != null) {
-                        return doDelete(connection, currentTime, entryToRemove);
+                        return doDelete(connection, currentTimeNs, entryToRemove);
                     }
 
-                    return doAdd(connection, currentTime);
+                    return doAdd(connection, currentTimeNs);
                 } catch (final AddRateExecutionEndedException a) {
                     return newResultPromise(OTHER);
                 } catch (final IOException e) {
@@ -187,14 +178,14 @@ private void startToggleDeleteIfAgeThresholdReached(long currentTime) {
                         && delThreshold == DeleteThreshold.AGE_THRESHOLD
                         && !dnEntriesAdded.isEmpty()
                         && dnEntriesAdded.firstKey() + timeToWait < currentTime) {
-                    setSizeThreshold(entryCount.get());
+                    setSizeThreshold(entryCount.getCount());
                 }
             }
 
             private void startPurgeIfMaxNumberAddReached() {
                 AtomicBoolean purgeLatch = new AtomicBoolean();
                 if (!isPurgeBranchRunning.get()
-                            && 0 < maxNbAddIterations && maxNbAddIterations < totalAdds.get()
+                            && 0 < maxNbAddIterations && maxNbAddIterations < addCounter.getCount()
                             && purgeLatch.compareAndSet(false, true)) {
                     newPurgerThread().start();
                 }
@@ -203,15 +194,12 @@ private void startPurgeIfMaxNumberAddReached() {
             // FIXME Followings @Checkstyle:ignore tags are related to the maven-checkstyle-plugin
             // issue related here: https://github.com/checkstyle/checkstyle/issues/5
             // @Checkstyle:ignore
-            private String getEntryToRemove(final long currentTime) throws AddRateExecutionEndedException {
+            private String getEntryToRemove() throws AddRateExecutionEndedException {
                 if (isPurgeBranchRunning.get()) {
                     return purgeEntry();
-                }
-
-                if (toggleDelete && entryCount.get() > sizeThreshold) {
+                } else if (toggleDelete && entryCount.getCount() > sizeThreshold) {
                     return removeFirstAddedEntry();
                 }
-
                 return null;
             }
 
@@ -231,24 +219,22 @@ private String removeFirstAddedEntry() {
 
             private Promise doAdd(
                     final Connection connection, final long currentTime) throws IOException {
-                Entry entry;
+                final Entry entry;
                 synchronized (generator) {
                     entry = generator.readEntry();
                 }
 
                 final LdapResultHandler addHandler = new AddStatsHandler(
-                    currentTime, entry.getName().toString());
+                        currentTime, entry.getName().toString());
                 return connection.addAsync(newAddRequest(entry))
-                                 .thenOnResult(addHandler)
-                                 .thenOnException(addHandler);
+                                 .thenOnResultOrException(addHandler, addHandler);
             }
 
             private Promise doDelete(
                     final Connection connection, final long currentTime, final String entryToRemove) {
                 final LdapResultHandler deleteHandler = new DeleteStatsHandler(currentTime);
                 return connection.deleteAsync(newDeleteRequest(entryToRemove))
-                                 .thenOnResult(deleteHandler)
-                                 .thenOnException(deleteHandler);
+                                 .thenOnResultOrException(deleteHandler, deleteHandler);
             }
         }
 
@@ -269,7 +255,7 @@ void performStopOperations() {
                         throw new IllegalStateException();
                     }
                 } else if (!purgeEnabled) {
-                    stopRequested = true;
+                    stopTool();
                 }
             }
         }
@@ -285,20 +271,18 @@ protected Random initialValue() {
         private EntryGenerator generator;
         private DeleteStrategy delStrategy;
         private DeleteThreshold delThreshold;
-        private int sizeThreshold;
+        private long sizeThreshold;
         private volatile boolean toggleDelete;
         private long timeToWait;
         private int maxNbAddIterations;
         private boolean purgeEnabled;
-        private final AtomicInteger recentAdds = new AtomicInteger();
-        private final AtomicInteger recentDeletes = new AtomicInteger();
-        private final AtomicInteger totalAdds = new AtomicInteger();
-        private final AtomicInteger entryCount = new AtomicInteger();
+        private StatsThread.IntervalCounter addCounter = StatsThread.newIntervalCounter();
+        private StatsThread.IntervalCounter deleteCounter = StatsThread.newIntervalCounter();
+        private final Counter entryCount = new Counter();
         private final AtomicBoolean isPurgeBranchRunning = new AtomicBoolean();
 
         private AddPerformanceRunner(final PerformanceRunnerOptions options) throws ArgumentException {
             super(options);
-            maxIterationsArgument.setPropertyName("maxNumberOfAdd");
         }
 
         @Override
@@ -307,13 +291,13 @@ WorkerThread newWorkerThread(final Connection connection, final ConnectionFactor
         }
 
         @Override
-        StatsThread newStatsThread() {
-            return new AddRateStatsThread();
+        StatsThread newStatsThread(final PerformanceRunner performanceRunner, final ConsoleApplication app) {
+            return new AddRateStatsThread(performanceRunner, app);
         }
 
         @Override
-        TimerThread newEndTimerThread(final long timeTowait) {
-            return new AddRateTimerThread(timeTowait);
+        TimerThread newEndTimerThread(final long timeToWait) {
+            return new AddRateTimerThread(timeToWait);
         }
 
         TimerThread newPurgerThread() {
@@ -352,7 +336,7 @@ public void validate(final MultiChoiceArgument delModeArg,
             }
         }
 
-        private void setSizeThreshold(int entriesSizeThreshold) {
+        private void setSizeThreshold(final long entriesSizeThreshold) {
             sizeThreshold = entriesSizeThreshold;
             toggleDelete = true;
         }
@@ -415,7 +399,7 @@ int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_ADDRATE_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser =
             new ArgumentParser(AddRate.class.getName(), toolDescription, false, true, 1, 1, "template-file-path");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_ADDRATE.get());
         argParser.setDocToolDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RATE_TOOLS.get());
 
@@ -446,45 +430,60 @@ int run(final String[] args) {
 
             /* Entries generation parameters */
             resourcePathArg =
-                new StringArgument("resourcepath", 'r', MakeLDIF.OPTION_LONG_RESOURCE_PATH, false, false, true,
-                    INFO_PATH_PLACEHOLDER.get(), null, null, INFO_ADDRATE_DESCRIPTION_RESOURCE_PATH.get());
-            resourcePathArg.setDocDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RESOURCE_PATH.get());
-            argParser.addArgument(resourcePathArg);
+                    StringArgument.builder(MakeLDIF.OPTION_LONG_RESOURCE_PATH)
+                            .shortIdentifier('r')
+                            .description(INFO_ADDRATE_DESCRIPTION_RESOURCE_PATH.get())
+                            .docDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RESOURCE_PATH.get())
+                            .valuePlaceholder(INFO_PATH_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
             randomSeedArg =
-                new IntegerArgument("randomseed", 'R', OPTION_LONG_RANDOM_SEED, false, false, true,
-                    INFO_SEED_PLACEHOLDER.get(), 0, null, INFO_ADDRATE_DESCRIPTION_SEED.get());
-            argParser.addArgument(randomSeedArg);
-
+                    IntegerArgument.builder(OPTION_LONG_RANDOM_SEED)
+                            .shortIdentifier('R')
+                            .description(INFO_ADDRATE_DESCRIPTION_SEED.get())
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_SEED_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             constantsArg =
-                new StringArgument("constant", 'g', MakeLDIF.OPTION_LONG_CONSTANT, false, true, true,
-                    INFO_CONSTANT_PLACEHOLDER.get(), null, null, INFO_ADDRATE_DESCRIPTION_CONSTANT.get());
-            argParser.addArgument(constantsArg);
+                    StringArgument.builder(MakeLDIF.OPTION_LONG_CONSTANT)
+                            .shortIdentifier('g')
+                            .description(INFO_ADDRATE_DESCRIPTION_CONSTANT.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_CONSTANT_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
             /* addrate specifics arguments */
             deleteMode =
-                new MultiChoiceArgument<>("deletemode", 'C', "deleteMode", false, true,
-                    INFO_DELETEMODE_PLACEHOLDER.get(), Arrays.asList(DeleteStrategy.values()), false,
-                    INFO_ADDRATE_DESCRIPTION_DELETEMODE.get());
-            deleteMode.setDefaultValue(DeleteStrategy.FIFO.toString());
-            argParser.addArgument(deleteMode);
+                    MultiChoiceArgument.builder("deleteMode")
+                            .shortIdentifier('C')
+                            .description(INFO_ADDRATE_DESCRIPTION_DELETEMODE.get())
+                            .allowedValues(DeleteStrategy.values())
+                            .defaultValue(DeleteStrategy.FIFO)
+                            .valuePlaceholder(INFO_DELETEMODE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
             deleteSizeThreshold =
-                new IntegerArgument("deletesizethreshold", 's', "deleteSizeThreshold", false, false, true,
-                    INFO_DELETESIZETHRESHOLD_PLACEHOLDER.get(), DEFAULT_SIZE_THRESHOLD, "deleteSizeThreshold", true,
-                    SIZE_THRESHOLD_LOWERBOUND, false, Integer.MAX_VALUE,
-                    INFO_ADDRATE_DESCRIPTION_DELETESIZETHRESHOLD.get());
-            argParser.addArgument(deleteSizeThreshold);
+                    IntegerArgument.builder("deleteSizeThreshold")
+                            .shortIdentifier('s')
+                            .description(INFO_ADDRATE_DESCRIPTION_DELETESIZETHRESHOLD.get())
+                            .lowerBound(SIZE_THRESHOLD_LOWERBOUND)
+                            .defaultValue(DEFAULT_SIZE_THRESHOLD)
+                            .valuePlaceholder(INFO_DELETESIZETHRESHOLD_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
             deleteAgeThreshold =
-                new IntegerArgument("deleteagethreshold", 'a', "deleteAgeThreshold", false, true,
-                    INFO_DELETEAGETHRESHOLD_PLACEHOLDER.get(), true, AGE_THRESHOLD_LOWERBOUND, false,
-                    Integer.MAX_VALUE, INFO_ADDRATE_DESCRIPTION_DELETEAGETHRESHOLD.get());
-            deleteAgeThreshold.setPropertyName(deleteAgeThreshold.getLongIdentifier());
-            argParser.addArgument(deleteAgeThreshold);
-
-            noPurgeArgument = new BooleanArgument("nopurge", 'n', "noPurge", INFO_ADDRATE_DESCRIPTION_NOPURGE.get());
-            argParser.addArgument(noPurgeArgument);
+                    IntegerArgument.builder("deleteAgeThreshold")
+                            .shortIdentifier('a')
+                            .description(INFO_ADDRATE_DESCRIPTION_DELETEAGETHRESHOLD.get())
+                            .lowerBound(AGE_THRESHOLD_LOWERBOUND)
+                            .valuePlaceholder(INFO_DELETEAGETHRESHOLD_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            noPurgeArgument =
+                    BooleanArgument.builder("noPurge")
+                        .shortIdentifier('n')
+                        .description(INFO_ADDRATE_DESCRIPTION_NOPURGE.get())
+                        .buildAndAddToParser(argParser);
         } catch (final ArgumentException ae) {
             errPrintln(ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage()));
             return ResultCode.CLIENT_SIDE_PARAM_ERROR.intValue();
@@ -519,25 +518,25 @@ int run(final String[] args) {
     }
 
     private void addCommonArguments(final ArgumentParser argParser) throws ArgumentException {
-        final StringArgument propertiesFileArgument = CommonArguments.getPropertiesFile();
+        final StringArgument propertiesFileArgument = propertiesFileArgument();
         argParser.addArgument(propertiesFileArgument);
         argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-        final BooleanArgument noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+        final BooleanArgument noPropertiesFileArgument = noPropertiesFileArgument();
         argParser.addArgument(noPropertiesFileArgument);
         argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
-        final BooleanArgument showUsage = CommonArguments.getShowUsage();
+        final BooleanArgument showUsage = showUsageArgument();
         argParser.addArgument(showUsage);
         argParser.setUsageArgument(showUsage, getOutputStream());
 
-        verbose = CommonArguments.getVerbose();
+        verbose = verboseArgument();
         argParser.addArgument(verbose);
 
         scriptFriendly =
-            new BooleanArgument("scriptFriendly", 'S', "scriptFriendly", INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
-        scriptFriendly.setPropertyName("scriptFriendly");
-        argParser.addArgument(scriptFriendly);
-
+                BooleanArgument.builder("scriptFriendly")
+                        .shortIdentifier('S')
+                        .description(INFO_DESCRIPTION_SCRIPT_FRIENDLY.get())
+                        .buildAndAddToParser(argParser);
     }
 }
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
index 515633567..f0f6f8ffb 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/AuthRate.java
@@ -1,44 +1,38 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.cli.MultiColumnPrinter.column;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.ldap.tools.Utils.*;
+import static com.forgerock.opendj.cli.CommonArguments.*;
 
 import java.io.PrintStream;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Random;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
 
+import com.codahale.metrics.RatioGauge;
+import com.forgerock.opendj.cli.MultiColumnPrinter;
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.Connection;
 import org.forgerock.opendj.ldap.ConnectionFactory;
@@ -63,7 +57,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConnectionFactoryProvider;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.IntegerArgument;
@@ -75,39 +68,37 @@
  * requests using one or more LDAP connections.
  */
 public final class AuthRate extends ConsoleApplication {
+
     private final class BindPerformanceRunner extends PerformanceRunner {
         private final class BindStatsThread extends StatsThread {
-            private final String[] extraColumn;
+            private static final int BIND_TIME_PERCENTAGE_COLUMN_WIDTH = 5;
+            private static final String BIND_TIME_PERCENTAGE = STAT_ID_PREFIX + "bind_time_percentage";
 
-            private BindStatsThread(final boolean extraFieldRequired) {
-                super(extraFieldRequired ? new String[] { "bind time %" } : new String[0]);
-                extraColumn = new String[extraFieldRequired ? 1 : 0];
-            }
+            private final boolean computeBindTime;
 
-            @Override
-            String[] getAdditionalColumns() {
-                invalidCredRecentCount.set(0);
-                if (extraColumn.length != 0) {
-                    final long searchWaitTimeNs = searchWaitRecentTimeNs.getAndSet(0);
-                    extraColumn[0] = getDivisionResult(
-                            100 * (intervalWaitTimeNs - searchWaitTimeNs), intervalWaitTimeNs, 1, "-");
-                }
-                return extraColumn;
-            }
-        }
-
-        private final class BindUpdateStatsResultHandler extends UpdateStatsResultHandler {
-            private BindUpdateStatsResultHandler(final long startTime) {
-                super(startTime);
+            private BindStatsThread(final PerformanceRunner performanceRunner,
+                                    final ConsoleApplication app,
+                                    final boolean computeBindTime) {
+                super(performanceRunner, app);
+                this.computeBindTime = computeBindTime;
             }
 
             @Override
-            public void handleException(final LdapException exception) {
-                super.handleException(exception);
-
-                if (exception.getResult().getResultCode() == ResultCode.INVALID_CREDENTIALS) {
-                    invalidCredRecentCount.getAndIncrement();
+            List registerAdditionalColumns() {
+                if (!computeBindTime) {
+                    return Collections.emptyList();
                 }
+
+                registry.register(BIND_TIME_PERCENTAGE, new RatioGauge() {
+                    @Override
+                    protected Ratio getRatio() {
+                        final long searchWaitTimeIntervalNs = searchWaitRecentTimeNs.getLastIntervalCount();
+                        final long waitTimeIntervalNs = waitDurationNsCount.getLastIntervalCount();
+                        return Ratio.of(100 * (waitTimeIntervalNs - searchWaitTimeIntervalNs), waitTimeIntervalNs);
+                    }
+                });
+                return Collections.singletonList(
+                        column(BIND_TIME_PERCENTAGE, "bind time %", BIND_TIME_PERCENTAGE_COLUMN_WIDTH, 1));
             }
         }
 
@@ -130,7 +121,7 @@ private BindWorkerThread(final Connection connection, final ConnectionFactory co
 
             @Override
             public Promise performOperation(final Connection connection,
-                    final DataSource[] dataSources, final long startTime) {
+                    final DataSource[] dataSources, final long currentTimeNs) {
                 if (dataSources != null) {
                     data = DataSource.generateData(dataSources, data);
                     if (data.length == dataSources.length) {
@@ -161,7 +152,7 @@ public Promise performOperation(final Connection connection,
                                 @Override
                                 public Promise apply(SearchResultEntry result)
                                         throws LdapException {
-                                    searchWaitRecentTimeNs.getAndAdd(System.nanoTime() - startTime);
+                                    searchWaitRecentTimeNs.inc(System.nanoTime() - currentTimeNs);
                                     if (data == null) {
                                         data = new Object[1];
                                     }
@@ -175,8 +166,8 @@ public Promise apply(SearchResultEntry result)
                 }
 
                 incrementIterationCount();
-                return returnedPromise.thenOnResult(new UpdateStatsResultHandler(startTime))
-                                      .thenOnException(new BindUpdateStatsResultHandler(startTime));
+                return returnedPromise.thenOnResult(new UpdateStatsResultHandler(currentTimeNs))
+                                      .thenOnException(new UpdateStatsResultHandler(currentTimeNs));
             }
 
             private Promise performBind(final Connection connection,
@@ -305,8 +296,7 @@ private Promise performBind(final Connection connecti
             }
         }
 
-        private final AtomicLong searchWaitRecentTimeNs = new AtomicLong();
-        private final AtomicInteger invalidCredRecentCount = new AtomicInteger();
+        private final StatsThread.IntervalCounter searchWaitRecentTimeNs = StatsThread.newIntervalCounter();
         private String filter;
         private String baseDN;
         private SearchScope scope;
@@ -332,8 +322,8 @@ WorkerThread newWorkerThread(final Connection connection,
         }
 
         @Override
-        StatsThread newStatsThread() {
-            return new BindStatsThread(filter != null && baseDN != null);
+        StatsThread newStatsThread(final PerformanceRunner performanceRunner, final ConsoleApplication app) {
+            return new BindStatsThread(performanceRunner, app, filter != null && baseDN != null);
         }
     }
 
@@ -388,7 +378,7 @@ int run(final String[] args) {
         final ArgumentParser argParser =
                 new ArgumentParser(AuthRate.class.getName(), toolDescription, false, true, 0, 0,
                         "[filter format string] [attributes ...]");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_AUTHRATE.get());
         argParser.setDocToolDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RATE_TOOLS.get());
 
@@ -407,60 +397,60 @@ int run(final String[] args) {
             setDefaultPerfToolProperties();
             PerformanceRunnerOptions options = new PerformanceRunnerOptions(argParser, this);
             options.setSupportsRebind(false);
-            options.setSupportsAsynchronousRequests(false);
             options.setSupportsMultipleThreadsPerConnection(false);
 
             connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
             runner = new BindPerformanceRunner(options);
 
-            propertiesFileArgument = CommonArguments.getPropertiesFile();
+            propertiesFileArgument = propertiesFileArgument();
             argParser.addArgument(propertiesFileArgument);
             argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-            noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+            noPropertiesFileArgument = noPropertiesFileArgument();
             argParser.addArgument(noPropertiesFileArgument);
             argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
 
             baseDN =
-                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, false,
-                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
-                            INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get());
-            baseDN.setPropertyName(OPTION_LONG_BASEDN);
-            argParser.addArgument(baseDN);
+                    StringArgument.builder(OPTION_LONG_BASEDN)
+                            .shortIdentifier(OPTION_SHORT_BASEDN)
+                            .description(INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get())
+                            .valuePlaceholder(INFO_BASEDN_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
-            searchScope = CommonArguments.getSearchScope();
+            searchScope = searchScopeArgument();
             argParser.addArgument(searchScope);
 
             dereferencePolicy =
-                    new MultiChoiceArgument<>("derefpolicy", 'a',
-                            "dereferencePolicy", false, true, INFO_DEREFERENCE_POLICE_PLACEHOLDER
-                                    .get(), DereferenceAliasesPolicy.values(), false,
-                            INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
-            dereferencePolicy.setPropertyName("dereferencePolicy");
-            dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
-            argParser.addArgument(dereferencePolicy);
+                    MultiChoiceArgument.builder("dereferencePolicy")
+                            .shortIdentifier('a')
+                            .description(INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get())
+                            .allowedValues(DereferenceAliasesPolicy.values())
+                            .defaultValue(DereferenceAliasesPolicy.NEVER)
+                            .valuePlaceholder(INFO_DEREFERENCE_POLICE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
             invalidCredPercent =
-                    new IntegerArgument("invalidPassword", 'I', "invalidPassword", false, false,
-                            true, LocalizableMessage.raw("{invalidPassword}"), 0, null, true, 0,
-                            true, 100, LocalizableMessage
-                                    .raw("Percent of bind operations with simulated "
-                                            + "invalid password"));
-            invalidCredPercent.setPropertyName("invalidPassword");
-            argParser.addArgument(invalidCredPercent);
-
-            verbose = CommonArguments.getVerbose();
+                    IntegerArgument.builder("invalidPassword")
+                            .shortIdentifier('I')
+                            .description(LocalizableMessage.raw(
+                                    "Percent of bind operations with simulated invalid password"))
+                            .range(0, 100)
+                            .defaultValue(0)
+                            .valuePlaceholder(LocalizableMessage.raw("{invalidPassword}"))
+                            .buildAndAddToParser(argParser);
+
+            verbose = verboseArgument();
             argParser.addArgument(verbose);
 
             scriptFriendly =
-                    new BooleanArgument("scriptFriendly", 'S', "scriptFriendly",
-                            INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
-            scriptFriendly.setPropertyName("scriptFriendly");
-            argParser.addArgument(scriptFriendly);
+                    BooleanArgument.builder("scriptFriendly")
+                            .shortIdentifier('S')
+                            .description(INFO_DESCRIPTION_SCRIPT_FRIENDLY.get())
+                            .buildAndAddToParser(argParser);
         } catch (final ArgumentException ae) {
             final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
             errPrintln(message);
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java
index 46f2455b3..9532828c2 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/DataSource.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2009-2010 Sun Microsystems, Inc.
- *      Portions copyright 2014-2015 ForgeRock AS
+ * Copyright 2009-2010 Sun Microsystems, Inc.
+ * Portions copyright 2014-2016 ForgeRock AS.
  */
 
 package com.forgerock.opendj.ldap.tools;
@@ -59,14 +49,11 @@ private static class IncrementLineFileDataSource implements IDataSource {
 
         public IncrementLineFileDataSource(final String file) throws IOException {
             lines = new ArrayList<>();
-            final BufferedReader in = new BufferedReader(new FileReader(file));
-            try {
+            try (final BufferedReader in = new BufferedReader(new FileReader(file))) {
                 String line;
                 while ((line = in.readLine()) != null) {
                     lines.add(line);
                 }
-            } finally {
-                in.close();
             }
         }
 
@@ -74,10 +61,12 @@ private IncrementLineFileDataSource(final List lines) {
             this.lines = lines;
         }
 
+        @Override
         public IDataSource duplicate() {
             return new IncrementLineFileDataSource(lines);
         }
 
+        @Override
         public Object getData() {
             if (next == lines.size()) {
                 next = 0;
@@ -102,10 +91,12 @@ public IncrementNumberDataSource(final int low, final int high) {
             this.high = high;
         }
 
+        @Override
         public IDataSource duplicate() {
             return new IncrementNumberDataSource(low, high);
         }
 
+        @Override
         public Object getData() {
             if (next == high) {
                 next = low;
@@ -127,21 +118,20 @@ private static class RandomLineFileDataSource implements IDataSource {
         public RandomLineFileDataSource(final long seed, final String file) throws IOException {
             lines = new ArrayList<>();
             random = new Random(seed);
-            final BufferedReader in = new BufferedReader(new FileReader(file));
-            try {
+            try (final BufferedReader in = new BufferedReader(new FileReader(file))) {
                 String line;
                 while ((line = in.readLine()) != null) {
                     lines.add(line);
                 }
-            } finally {
-                in.close();
             }
         }
 
+        @Override
         public IDataSource duplicate() {
             return this;
         }
 
+        @Override
         public Object getData() {
             return lines.get(random.nextInt(lines.size()));
         }
@@ -162,11 +152,13 @@ public RandomNumberDataSource(final long seed, final int low, final int high) {
             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;
         }
@@ -203,10 +195,12 @@ private RandomStringDataSource(final int seed, final int length, final String ch
             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++) {
@@ -233,11 +227,13 @@ private StaticDataSource(final Object data) {
             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;
         }
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
index b1f339fa1..b5ac74c5b 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPCompare.java
@@ -1,37 +1,30 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
 import static com.forgerock.opendj.cli.Utils.readBytesFromFile;
 import static com.forgerock.opendj.ldap.tools.Utils.printErrorMessage;
 import static com.forgerock.opendj.ldap.tools.Utils.printPasswordPolicyResults;
+import static com.forgerock.opendj.cli.CommonArguments.*;
+
 import static org.forgerock.util.Utils.closeSilently;
 
 import java.io.BufferedReader;
@@ -62,7 +55,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConnectionFactoryProvider;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.IntegerArgument;
@@ -141,7 +133,7 @@ int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_LDAPCOMPARE_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser = new ArgumentParser(
             LDAPCompare.class.getName(), toolDescription, false, true, 1, 0, "attribute:value [DN ...]");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDAPCOMPARE.get());
 
         ConnectionFactoryProvider connectionFactoryProvider;
@@ -162,46 +154,45 @@ int run(final String[] args) {
         try {
             connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
 
-            propertiesFileArgument = CommonArguments.getPropertiesFile();
+            propertiesFileArgument = propertiesFileArgument();
             argParser.addArgument(propertiesFileArgument);
             argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-            noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+            noPropertiesFileArgument = noPropertiesFileArgument();
             argParser.addArgument(noPropertiesFileArgument);
             argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
-            filename = CommonArguments.getFilename(INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
+            filename = filenameArgument(INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
             argParser.addArgument(filename);
 
-            proxyAuthzID = CommonArguments.getProxyAuthId();
+            proxyAuthzID = proxyAuthIdArgument();
             argParser.addArgument(proxyAuthzID);
 
             assertionFilter =
-                    new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false,
-                            false, true, INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_ASSERTION_FILTER.get());
-            assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
-            argParser.addArgument(assertionFilter);
+                    StringArgument.builder(OPTION_LONG_ASSERTION_FILE)
+                            .description(INFO_DESCRIPTION_ASSERTION_FILTER.get())
+                            .valuePlaceholder(INFO_ASSERTION_FILTER_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
-            controlStr = CommonArguments.getControl();
+            controlStr = controlArgument();
             argParser.addArgument(controlStr);
 
-            version = CommonArguments.getLdapVersion();
+            version = ldapVersionArgument();
             argParser.addArgument(version);
 
-            encodingStr = CommonArguments.getEncoding();
+            encodingStr = encodingArgument();
             argParser.addArgument(encodingStr);
 
-            continueOnError = CommonArguments.getContinueOnError();
+            continueOnError = continueOnErrorArgument();
             argParser.addArgument(continueOnError);
 
-            noop = CommonArguments.getNoOp();
+            noop = noOpArgument();
             argParser.addArgument(noop);
 
-            verbose = CommonArguments.getVerbose();
+            verbose = verboseArgument();
             argParser.addArgument(verbose);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
index c87a3dd0d..8ad5c11aa 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
@@ -1,36 +1,29 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
 import static com.forgerock.opendj.ldap.tools.Utils.printErrorMessage;
 import static com.forgerock.opendj.ldap.tools.Utils.printPasswordPolicyResults;
+import static com.forgerock.opendj.cli.CommonArguments.*;
+
 import static org.forgerock.util.Utils.closeSilently;
 
 import java.io.FileInputStream;
@@ -72,7 +65,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConnectionFactoryProvider;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.IntegerArgument;
@@ -251,7 +243,7 @@ int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_LDAPMODIFY_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser =
                 new ArgumentParser(LDAPModify.class.getName(), toolDescription, false);
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDAPMODIFY.get());
 
         ConnectionFactoryProvider connectionFactoryProvider;
@@ -259,14 +251,11 @@ int run(final String[] args) {
         BindRequest bindRequest;
 
         BooleanArgument continueOnError;
-        // TODO: Remove this due to new LDIF reader api?
-        BooleanArgument defaultAdd;
         BooleanArgument noop;
         BooleanArgument showUsage;
         IntegerArgument version;
         StringArgument assertionFilter;
         StringArgument controlStr;
-        StringArgument encodingStr;
         StringArgument filename;
         StringArgument postReadAttributes;
         StringArgument preReadAttributes;
@@ -277,82 +266,62 @@ int run(final String[] args) {
         try {
             connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
 
-            propertiesFileArgument = CommonArguments.getPropertiesFile();
+            propertiesFileArgument = propertiesFileArgument();
             argParser.addArgument(propertiesFileArgument);
             argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-            noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+            noPropertiesFileArgument = noPropertiesFileArgument();
             argParser.addArgument(noPropertiesFileArgument);
             argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
-            defaultAdd =
-                    new BooleanArgument("defaultAdd", 'a', "defaultAdd",
-                            INFO_MODIFY_DESCRIPTION_DEFAULT_ADD.get());
-            argParser.addArgument(defaultAdd);
-
             filename =
-                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
-                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
-                            INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get());
-            filename.setPropertyName(OPTION_LONG_FILENAME);
-            argParser.addArgument(filename);
-
+                    StringArgument.builder(OPTION_LONG_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_FILENAME)
+                            .description(INFO_LDAPMODIFY_DESCRIPTION_FILENAME.get())
+                            .valuePlaceholder(INFO_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             proxyAuthzID =
-                    new StringArgument("proxy_authzid", OPTION_SHORT_PROXYAUTHID,
-                            OPTION_LONG_PROXYAUTHID, false, false, true,
-                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_PROXY_AUTHZID.get());
-            proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
-            argParser.addArgument(proxyAuthzID);
-
+                    StringArgument.builder(OPTION_LONG_PROXYAUTHID)
+                            .shortIdentifier(OPTION_SHORT_PROXYAUTHID)
+                            .description(INFO_DESCRIPTION_PROXY_AUTHZID.get())
+                            .valuePlaceholder(INFO_PROXYAUTHID_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             assertionFilter =
-                    new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false,
-                            false, true, INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_ASSERTION_FILTER.get());
-            assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
-            argParser.addArgument(assertionFilter);
-
+                    StringArgument.builder(OPTION_LONG_ASSERTION_FILE)
+                            .description(INFO_DESCRIPTION_ASSERTION_FILTER.get())
+                            .valuePlaceholder(INFO_ASSERTION_FILTER_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             preReadAttributes =
-                    new StringArgument("prereadattrs", null, "preReadAttributes", false, false,
-                            true, INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_PREREAD_ATTRS.get());
-            preReadAttributes.setPropertyName("preReadAttributes");
-            argParser.addArgument(preReadAttributes);
-
+                    StringArgument.builder("preReadAttributes")
+                            .description(INFO_DESCRIPTION_PREREAD_ATTRS.get())
+                            .valuePlaceholder(INFO_ATTRIBUTE_LIST_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             postReadAttributes =
-                    new StringArgument("postreadattrs", null, "postReadAttributes", false, false,
-                            true, INFO_ATTRIBUTE_LIST_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_POSTREAD_ATTRS.get());
-            postReadAttributes.setPropertyName("postReadAttributes");
-            argParser.addArgument(postReadAttributes);
-
+                    StringArgument.builder("postReadAttributes")
+                            .description(INFO_DESCRIPTION_POSTREAD_ATTRS.get())
+                            .valuePlaceholder(INFO_ATTRIBUTE_LIST_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             controlStr =
-                    new StringArgument("control", 'J', "control", false, true, true,
-                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_CONTROLS.get());
-            controlStr.setPropertyName("control");
-            argParser.addArgument(controlStr);
-
-            version = CommonArguments.getLdapVersion();
+                    StringArgument.builder("control")
+                            .shortIdentifier('J')
+                            .description(INFO_DESCRIPTION_CONTROLS.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_LDAP_CONTROL_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            version = ldapVersionArgument();
             argParser.addArgument(version);
 
-            encodingStr =
-                    new StringArgument("encoding", 'i', "encoding", false, false, true,
-                            INFO_ENCODING_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_ENCODING
-                                    .get());
-            encodingStr.setPropertyName("encoding");
-            argParser.addArgument(encodingStr);
-
-            continueOnError = CommonArguments.getContinueOnError();
+            continueOnError = continueOnErrorArgument();
             argParser.addArgument(continueOnError);
 
-            noop = CommonArguments.getNoOp();
+            noop = noOpArgument();
             argParser.addArgument(noop);
 
-            verbose = CommonArguments.getVerbose();
+            verbose = verboseArgument();
             argParser.addArgument(verbose);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
index 22ed97ad0..18713648c 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPPasswordModify.java
@@ -1,33 +1,26 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
+import static com.forgerock.opendj.cli.CliMessages.INFO_FILE_PLACEHOLDER;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
+import static com.forgerock.opendj.cli.CommonArguments.*;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.ByteString;
@@ -44,7 +37,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConnectionFactoryProvider;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.FileBasedArgument;
@@ -98,7 +90,7 @@ private int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_LDAPPWMOD_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser =
                 new ArgumentParser(LDAPPasswordModify.class.getName(), toolDescription, false);
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDAPPASSWORDMODIFY.get());
 
         ConnectionFactoryProvider connectionFactoryProvider;
@@ -118,63 +110,59 @@ private int run(final String[] args) {
         try {
             connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
 
-            propertiesFileArgument = CommonArguments.getPropertiesFile();
+            propertiesFileArgument = propertiesFileArgument();
             argParser.addArgument(propertiesFileArgument);
             argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-            noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+            noPropertiesFileArgument = noPropertiesFileArgument();
             argParser.addArgument(noPropertiesFileArgument);
             argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
             newPW =
-                    new StringArgument("newpw", 'n', "newPassword", false, false, true,
-                            INFO_NEW_PASSWORD_PLACEHOLDER.get(), null, null,
-                            INFO_LDAPPWMOD_DESCRIPTION_NEWPW.get());
-            newPW.setPropertyName("newPassword");
-            argParser.addArgument(newPW);
-
+                    StringArgument.builder("newPassword")
+                            .shortIdentifier('n')
+                            .description(INFO_LDAPPWMOD_DESCRIPTION_NEWPW.get())
+                            .valuePlaceholder(INFO_NEW_PASSWORD_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             newPWFile =
-                    new FileBasedArgument("newpwfile", 'F', "newPasswordFile", false, false,
-                            INFO_FILE_PLACEHOLDER.get(), null, null,
-                            INFO_LDAPPWMOD_DESCRIPTION_NEWPWFILE.get());
-            newPWFile.setPropertyName("newPasswordFile");
-            argParser.addArgument(newPWFile);
-
+                    FileBasedArgument.builder("newPasswordFile")
+                            .shortIdentifier('F')
+                            .description(INFO_LDAPPWMOD_DESCRIPTION_NEWPWFILE.get())
+                            .valuePlaceholder(INFO_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             currentPW =
-                    new StringArgument("currentpw", 'c', "currentPassword", false, false, true,
-                            INFO_CURRENT_PASSWORD_PLACEHOLDER.get(), null, null,
-                            INFO_LDAPPWMOD_DESCRIPTION_CURRENTPW.get());
-            currentPW.setPropertyName("currentPassword");
-            argParser.addArgument(currentPW);
-
+                    StringArgument.builder("currentPassword")
+                            .shortIdentifier('c')
+                            .description(INFO_LDAPPWMOD_DESCRIPTION_CURRENTPW.get())
+                            .valuePlaceholder(INFO_CURRENT_PASSWORD_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             currentPWFile =
-                    new FileBasedArgument("currentpwfile", 'C', "currentPasswordFile", false,
-                            false, INFO_FILE_PLACEHOLDER.get(), null, null,
-                            INFO_LDAPPWMOD_DESCRIPTION_CURRENTPWFILE.get());
-            currentPWFile.setPropertyName("currentPasswordFile");
-            argParser.addArgument(currentPWFile);
-
+                    FileBasedArgument.builder("currentPasswordFile")
+                            .shortIdentifier('C')
+                            .description(INFO_LDAPPWMOD_DESCRIPTION_CURRENTPWFILE.get())
+                            .valuePlaceholder(INFO_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             proxyAuthzID =
-                    new StringArgument("authzid", 'a', "authzID", false, false, true,
-                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-                            INFO_LDAPPWMOD_DESCRIPTION_AUTHZID.get());
-            proxyAuthzID.setPropertyName("authzID");
-            argParser.addArgument(proxyAuthzID);
-
+                    StringArgument.builder("authzID")
+                            .shortIdentifier('a')
+                            .description(INFO_LDAPPWMOD_DESCRIPTION_AUTHZID.get())
+                            .valuePlaceholder(INFO_PROXYAUTHID_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             controlStr =
-                    new StringArgument("control", 'J', "control", false, true, true,
-                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_CONTROLS.get());
-            controlStr.setPropertyName("control");
-            argParser.addArgument(controlStr);
-
-            version = CommonArguments.getLdapVersion();
+                    StringArgument.builder("control")
+                            .shortIdentifier('J')
+                            .description(INFO_DESCRIPTION_CONTROLS.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_LDAP_CONTROL_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            version = ldapVersionArgument();
             argParser.addArgument(version);
 
-            verbose = CommonArguments.getVerbose();
+            verbose = verboseArgument();
             argParser.addArgument(verbose);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
index f062e0b08..07819229e 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPSearch.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
@@ -75,7 +65,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConnectionFactoryProvider;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.IntegerArgument;
@@ -84,6 +73,8 @@
 import com.forgerock.opendj.ldap.controls.AccountUsabilityResponseControl;
 import com.forgerock.opendj.util.StaticUtils;
 
+import static com.forgerock.opendj.cli.CliMessages.INFO_NUM_ENTRIES_PLACEHOLDER;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.Utils.printErrorMessage;
 import static com.forgerock.opendj.ldap.tools.Utils.printPasswordPolicyResults;
 import static org.forgerock.util.Utils.*;
@@ -91,6 +82,7 @@
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
+import static com.forgerock.opendj.cli.CommonArguments.*;
 
 /** A tool that can be used to issue Search requests to the Directory Server. */
 public final class LDAPSearch extends ConsoleApplication {
@@ -192,7 +184,7 @@ public boolean handleReference(final SearchResultReference reference) {
      */
 
     public static void main(final String[] args) {
-        final int retCode = new LDAPSearch().run(args, false);
+        final int retCode = new LDAPSearch().run(args);
         System.exit(filterExitCode(retCode));
     }
 
@@ -225,13 +217,13 @@ public boolean isVerbose() {
     }
 
     /** Run ldapsearch with provided command-line arguments. */
-    int run(final String[] args, final boolean returnMatchingEntries) {
+    int run(final String[] args) {
         // Create the command-line argument parser for use with this program.
         final LocalizableMessage toolDescription = INFO_LDAPSEARCH_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser =
                 new ArgumentParser(LDAPSearch.class.getName(), toolDescription, false, true, 0, 0,
                         "[filter] [attributes ...]");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDAPSEARCH.get());
 
         ConnectionFactoryProvider connectionFactoryProvider;
@@ -262,166 +254,146 @@ int run(final String[] args, final boolean returnMatchingEntries) {
         try {
             connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
             final StringArgument propertiesFileArgument =
-                CommonArguments.getPropertiesFile();
+                propertiesFileArgument();
             argParser.addArgument(propertiesFileArgument);
             argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-            final BooleanArgument noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+            final BooleanArgument noPropertiesFileArgument = noPropertiesFileArgument();
             argParser.addArgument(noPropertiesFileArgument);
             argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
             baseDN =
-                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, true,
-                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
-                            INFO_SEARCH_DESCRIPTION_BASEDN.get());
-            baseDN.setPropertyName(OPTION_LONG_BASEDN);
-            argParser.addArgument(baseDN);
-
-            searchScope = CommonArguments.getSearchScope();
+                    StringArgument.builder(OPTION_LONG_BASEDN)
+                            .shortIdentifier(OPTION_SHORT_BASEDN)
+                            .description(INFO_SEARCH_DESCRIPTION_BASEDN.get())
+                            .required()
+                            .valuePlaceholder(INFO_BASEDN_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            searchScope = searchScopeArgument();
             argParser.addArgument(searchScope);
 
             filename =
-                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
-                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
-                            INFO_SEARCH_DESCRIPTION_FILENAME.get());
-            searchScope.setPropertyName(OPTION_LONG_FILENAME);
-            argParser.addArgument(filename);
-
+                    StringArgument.builder(OPTION_LONG_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_FILENAME)
+                            .description(INFO_SEARCH_DESCRIPTION_FILENAME.get())
+                            .valuePlaceholder(INFO_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             proxyAuthzID =
-                    new StringArgument("proxy_authzid", OPTION_SHORT_PROXYAUTHID,
-                            OPTION_LONG_PROXYAUTHID, false, false, true,
-                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_PROXY_AUTHZID.get());
-            proxyAuthzID.setPropertyName(OPTION_LONG_PROXYAUTHID);
-            argParser.addArgument(proxyAuthzID);
-
+                    StringArgument.builder(OPTION_LONG_PROXYAUTHID)
+                            .shortIdentifier(OPTION_SHORT_PROXYAUTHID)
+                            .description(INFO_DESCRIPTION_PROXY_AUTHZID.get())
+                            .valuePlaceholder(INFO_PROXYAUTHID_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             pSearchInfo =
-                    new StringArgument("psearchinfo", 'C', "persistentSearch", false, false, true,
-                            INFO_PSEARCH_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_PSEARCH_INFO.get());
-            pSearchInfo.setPropertyName("persistentSearch");
-            pSearchInfo.setDocDescriptionSupplement(SUPPLEMENT_DESCRIPTION_PSEARCH_INFO.get());
-            argParser.addArgument(pSearchInfo);
-
+                    StringArgument.builder("persistentSearch")
+                            .shortIdentifier('C')
+                            .description(INFO_DESCRIPTION_PSEARCH_INFO.get())
+                            .docDescriptionSupplement(SUPPLEMENT_DESCRIPTION_PSEARCH_INFO.get())
+                            .valuePlaceholder(INFO_PSEARCH_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             simplePageSize =
-                    new IntegerArgument("simplepagesize", null, "simplePageSize", false, false,
-                            true, INFO_NUM_ENTRIES_PLACEHOLDER.get(), 1000, null, true, 1, false,
-                            0, INFO_DESCRIPTION_SIMPLE_PAGE_SIZE.get());
-            simplePageSize.setPropertyName("simplePageSize");
-            argParser.addArgument(simplePageSize);
-
+                    IntegerArgument.builder("simplePageSize")
+                            .description(INFO_DESCRIPTION_SIMPLE_PAGE_SIZE.get())
+                            .lowerBound(1)
+                            .defaultValue(1000)
+                            .valuePlaceholder(INFO_NUM_ENTRIES_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             assertionFilter =
-                    new StringArgument("assertionfilter", null, OPTION_LONG_ASSERTION_FILE, false,
-                            false, true, INFO_ASSERTION_FILTER_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_ASSERTION_FILTER.get());
-            assertionFilter.setPropertyName(OPTION_LONG_ASSERTION_FILE);
-            argParser.addArgument(assertionFilter);
-
+                    StringArgument.builder(OPTION_LONG_ASSERTION_FILE)
+                            .description(INFO_DESCRIPTION_ASSERTION_FILTER.get())
+                            .valuePlaceholder(INFO_ASSERTION_FILTER_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             matchedValuesFilter =
-                    new StringArgument("matchedvalues", null, "matchedValuesFilter", false, true,
-                            true, INFO_FILTER_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_MATCHED_VALUES_FILTER.get());
-            matchedValuesFilter.setPropertyName("matchedValuesFilter");
-            argParser.addArgument(matchedValuesFilter);
-
+                    StringArgument.builder("matchedValuesFilter")
+                            .description(INFO_DESCRIPTION_MATCHED_VALUES_FILTER.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_FILTER_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             sortOrder =
-                    new StringArgument("sortorder", 'S', "sortOrder", false, false, true,
-                            INFO_SORT_ORDER_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_SORT_ORDER.get());
-            sortOrder.setPropertyName("sortOrder");
-            argParser.addArgument(sortOrder);
-
+                    StringArgument.builder("sortOrder")
+                            .shortIdentifier('S')
+                            .description(INFO_DESCRIPTION_SORT_ORDER.get())
+                            .valuePlaceholder(INFO_SORT_ORDER_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             vlvDescriptor =
-                    new StringArgument("vlvdescriptor", 'G', "virtualListView", false, false, true,
-                            INFO_VLV_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_VLV.get());
-            vlvDescriptor.setPropertyName("virtualListView");
-            argParser.addArgument(vlvDescriptor);
-
+                    StringArgument.builder("virtualListView")
+                            .shortIdentifier('G')
+                            .description(INFO_DESCRIPTION_VLV.get())
+                            .valuePlaceholder(INFO_VLV_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             controlStr =
-                    new StringArgument("control", 'J', "control", false, true, true,
-                            INFO_LDAP_CONTROL_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_CONTROLS.get());
-            controlStr.setPropertyName("control");
-            controlStr.setDocDescriptionSupplement(SUPPLEMENT_DESCRIPTION_CONTROLS.get());
-            argParser.addArgument(controlStr);
-
+                    StringArgument.builder("control")
+                            .shortIdentifier('J')
+                            .description(INFO_DESCRIPTION_CONTROLS.get())
+                            .docDescriptionSupplement(SUPPLEMENT_DESCRIPTION_CONTROLS.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_LDAP_CONTROL_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             effectiveRightsUser =
-                    new StringArgument("effectiveRightsUser", OPTION_SHORT_EFFECTIVERIGHTSUSER,
-                            OPTION_LONG_EFFECTIVERIGHTSUSER, false, false, true,
-                            INFO_PROXYAUTHID_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_EFFECTIVERIGHTS_USER.get());
-            effectiveRightsUser.setPropertyName(OPTION_LONG_EFFECTIVERIGHTSUSER);
-            argParser.addArgument(effectiveRightsUser);
-
+                    StringArgument.builder(OPTION_LONG_EFFECTIVERIGHTSUSER)
+                            .shortIdentifier(OPTION_SHORT_EFFECTIVERIGHTSUSER)
+                            .description(INFO_DESCRIPTION_EFFECTIVERIGHTS_USER.get())
+                            .valuePlaceholder(INFO_PROXYAUTHID_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             effectiveRightsAttrs =
-                    new StringArgument("effectiveRightsAttrs", OPTION_SHORT_EFFECTIVERIGHTSATTR,
-                            OPTION_LONG_EFFECTIVERIGHTSATTR, false, true, true,
-                            INFO_ATTRIBUTE_PLACEHOLDER.get(), null, null,
-                            INFO_DESCRIPTION_EFFECTIVERIGHTS_ATTR.get());
-            effectiveRightsAttrs.setPropertyName(OPTION_LONG_EFFECTIVERIGHTSATTR);
-            argParser.addArgument(effectiveRightsAttrs);
-
-            version = CommonArguments.getLdapVersion();
+                    StringArgument.builder(OPTION_LONG_EFFECTIVERIGHTSATTR)
+                            .shortIdentifier(OPTION_SHORT_EFFECTIVERIGHTSATTR)
+                            .description(INFO_DESCRIPTION_EFFECTIVERIGHTS_ATTR.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_ATTRIBUTE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            version = ldapVersionArgument();
             argParser.addArgument(version);
 
-            final StringArgument encodingStr =
-                    new StringArgument("encoding", 'i', "encoding", false, false, true,
-                            INFO_ENCODING_PLACEHOLDER.get(), null, null, INFO_DESCRIPTION_ENCODING
-                                    .get());
-            encodingStr.setPropertyName("encoding");
-            argParser.addArgument(encodingStr);
-
             dereferencePolicy =
-                    new MultiChoiceArgument<>("derefpolicy", 'a',
-                            "dereferencePolicy", false, true, INFO_DEREFERENCE_POLICE_PLACEHOLDER
-                                    .get(), DereferenceAliasesPolicy.values(), false,
-                            INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get());
-            dereferencePolicy.setPropertyName("dereferencePolicy");
-            dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER);
-            argParser.addArgument(dereferencePolicy);
-
+                    MultiChoiceArgument.builder("dereferencePolicy")
+                            .shortIdentifier('a')
+                            .description(INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get())
+                            .allowedValues(DereferenceAliasesPolicy.values())
+                            .defaultValue(DereferenceAliasesPolicy.NEVER)
+                            .valuePlaceholder(INFO_DEREFERENCE_POLICE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             typesOnly =
-                    new BooleanArgument("typesOnly", 'A', "typesOnly", INFO_DESCRIPTION_TYPES_ONLY
-                            .get());
-            typesOnly.setPropertyName("typesOnly");
-            argParser.addArgument(typesOnly);
-
+                    BooleanArgument.builder("typesOnly")
+                            .shortIdentifier('A')
+                            .description(INFO_DESCRIPTION_TYPES_ONLY.get())
+                            .buildAndAddToParser(argParser);
             sizeLimit =
-                    new IntegerArgument("sizeLimit", 'z', "sizeLimit", false, false, true,
-                            INFO_SIZE_LIMIT_PLACEHOLDER.get(), 0, null,
-                            INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get());
-            sizeLimit.setPropertyName("sizeLimit");
-            argParser.addArgument(sizeLimit);
-
+                    IntegerArgument.builder("sizeLimit")
+                            .shortIdentifier('z')
+                            .description(INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get())
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_SIZE_LIMIT_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             timeLimit =
-                    new IntegerArgument("timeLimit", 'l', "timeLimit", false, false, true,
-                            INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null,
-                            INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get());
-            timeLimit.setPropertyName("timeLimit");
-            argParser.addArgument(timeLimit);
-
+                    IntegerArgument.builder("timeLimit")
+                            .shortIdentifier('l')
+                            .description(INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get())
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_TIME_LIMIT_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             dontWrap =
-                    new BooleanArgument("dontwrap", 't', "dontWrap", INFO_DESCRIPTION_DONT_WRAP
-                            .get());
-            dontWrap.setPropertyName("dontWrap");
-            argParser.addArgument(dontWrap);
-
+                    BooleanArgument.builder("dontWrap")
+                            .shortIdentifier('t')
+                            .description(INFO_DESCRIPTION_DONT_WRAP.get())
+                            .buildAndAddToParser(argParser);
             countEntries =
-                    new BooleanArgument("countentries", null, "countEntries",
-                            INFO_DESCRIPTION_COUNT_ENTRIES.get());
-            countEntries.setPropertyName("countEntries");
-            argParser.addArgument(countEntries);
+                    BooleanArgument.builder("countEntries")
+                            .description(INFO_DESCRIPTION_COUNT_ENTRIES.get())
+                            .buildAndAddToParser(argParser);
 
-            final BooleanArgument continueOnError = CommonArguments.getContinueOnError();
+            final BooleanArgument continueOnError = continueOnErrorArgument();
             argParser.addArgument(continueOnError);
 
-            noop = CommonArguments.getNoOp();
+            noop = noOpArgument();
             argParser.addArgument(noop);
 
-            verbose = CommonArguments.getVerbose();
+            verbose = verboseArgument();
             argParser.addArgument(verbose);
 
-            final BooleanArgument showUsage = CommonArguments.getShowUsage();
+            final BooleanArgument showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
@@ -471,18 +443,14 @@ int run(final String[] args, final boolean returnMatchingEntries) {
 
         if (filename.isPresent()) {
             // Read the filter strings.
-            BufferedReader in = null;
-            try {
-                in = new BufferedReader(new FileReader(filename.getValue()));
+            try (BufferedReader in = new BufferedReader(new FileReader(filename.getValue()))) {
                 String line = null;
-
                 while ((line = in.readLine()) != null) {
                     if ("".equals(line.trim())) {
                         // ignore empty lines.
                         continue;
                     }
-                    final Filter ldapFilter = Filter.valueOf(line);
-                    filters.add(ldapFilter);
+                    filters.add(Filter.valueOf(line));
                 }
             } catch (final LocalizedIllegalArgumentException e) {
                 errPrintln(e.getMessageObject());
@@ -490,14 +458,6 @@ int run(final String[] args, final boolean returnMatchingEntries) {
             } catch (final IOException e) {
                 errPrintln(LocalizableMessage.raw(e.toString()));
                 return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-            } finally {
-                if (in != null) {
-                    try {
-                        in.close();
-                    } catch (final IOException ioe) {
-                        // Ignored.
-                    }
-                }
             }
         }
 
@@ -685,7 +645,7 @@ int run(final String[] args, final boolean returnMatchingEntries) {
         }
 
         if (matchedValuesFilter.isPresent()) {
-            final LinkedList mvFilterStrings = matchedValuesFilter.getValues();
+            final List mvFilterStrings = matchedValuesFilter.getValues();
             final List mvFilters = new ArrayList<>();
             for (final String s : mvFilterStrings) {
                 try {
@@ -783,9 +743,7 @@ int run(final String[] args, final boolean returnMatchingEntries) {
             return 0;
         }
 
-        Connection connection = null;
-        try {
-            connection = connectionFactory.getConnection();
+        try (Connection connection = connectionFactory.getConnection()) {
             if (bindRequest != null) {
                 printPasswordPolicyResults(this, connection.bind(bindRequest));
             }
@@ -874,12 +832,11 @@ int run(final String[] args, final boolean returnMatchingEntries) {
                 println(INFO_LDAPSEARCH_MATCHING_ENTRY_COUNT.get(resultHandler.entryCount));
                 println();
             }
+            return 0;
         } catch (final LdapException ere) {
             return printErrorMessage(this, ere);
         } finally {
-            closeSilently(ldifWriter, connection);
+            closeSilently(ldifWriter);
         }
-
-        return 0;
     }
 }
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java
index e69259a2a..0a906707d 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFDiff.java
@@ -1,35 +1,28 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2012-2013 ForgeRock AS
- *      Portions Copyright 2014-2015 ForgeRock AS.
+ * Copyright 2012-2016 ForgeRock AS.
+ * Portions Copyright 2014-2015 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_OUTPUT_LDIF_FILENAME;
 import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_SHORT_OUTPUT_LDIF_FILENAME;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
+import static com.forgerock.opendj.cli.CommonArguments.*;
+
 import static org.forgerock.util.Utils.closeSilently;
 
 import java.io.FileInputStream;
@@ -50,7 +43,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.StringArgument;
 
@@ -80,21 +72,22 @@ private int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_LDIFDIFF_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser = new ArgumentParser(
             LDIFDiff.class.getName(), toolDescription, false, true, 2, 2, "source target");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDIFDIFF.get());
 
         final BooleanArgument showUsage;
         final StringArgument outputFilename;
         try {
             outputFilename =
-                    new StringArgument("outputFilename", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
-                            OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true,
-                            INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(), "stdout", null,
-                            INFO_LDIFDIFF_DESCRIPTION_OUTPUT_FILENAME
-                                    .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
-            argParser.addArgument(outputFilename);
-
-            showUsage = CommonArguments.getShowUsage();
+                    StringArgument.builder(OPTION_LONG_OUTPUT_LDIF_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_OUTPUT_LDIF_FILENAME)
+                            .description(INFO_LDIFDIFF_DESCRIPTION_OUTPUT_FILENAME.get(
+                                    INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()))
+                            .defaultValue("stdout")
+                            .valuePlaceholder(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
@@ -119,9 +112,6 @@ private int run(final String[] args) {
         InputStream sourceInputStream = null;
         InputStream targetInputStream = null;
         OutputStream outputStream = null;
-        LDIFEntryReader sourceReader = null;
-        LDIFEntryReader targetReader = null;
-        LDIFChangeRecordWriter outputWriter = null;
 
         try {
             // First source file.
@@ -186,10 +176,11 @@ private int run(final String[] args) {
             }
 
             // Perform the diff.
-            sourceReader = new LDIFEntryReader(sourceInputStream);
-            targetReader = new LDIFEntryReader(targetInputStream);
-            outputWriter = new LDIFChangeRecordWriter(outputStream);
-            LDIF.copyTo(LDIF.diff(sourceReader, targetReader), outputWriter);
+            try (LDIFEntryReader sourceReader = new LDIFEntryReader(sourceInputStream);
+                LDIFEntryReader targetReader = new LDIFEntryReader(targetInputStream);
+                LDIFChangeRecordWriter outputWriter = new LDIFChangeRecordWriter(outputStream)) {
+                LDIF.copyTo(LDIF.diff(sourceReader, targetReader), outputWriter);
+            }
         } catch (final IOException e) {
             if (e instanceof LocalizableException) {
                 errPrintln(ERR_LDIFDIFF_DIFF_FAILED.get(((LocalizableException) e).getMessageObject()));
@@ -198,7 +189,6 @@ private int run(final String[] args) {
             }
             return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
         } finally {
-            closeSilently(sourceReader, targetReader, outputWriter);
             closeSilently(sourceInputStream, targetInputStream, outputStream);
         }
 
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java
index f5a1ec12e..5e6a3bc7f 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFModify.java
@@ -1,35 +1,27 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2012-2015 ForgeRock AS.
+ * Copyright 2012-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_LONG_OUTPUT_LDIF_FILENAME;
 import static com.forgerock.opendj.cli.ArgumentConstants.OPTION_SHORT_OUTPUT_LDIF_FILENAME;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
 import static org.forgerock.util.Utils.closeSilently;
+import static com.forgerock.opendj.cli.CommonArguments.*;
 
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
@@ -57,7 +49,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.StringArgument;
 
@@ -86,7 +77,7 @@ private int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_LDIFMODIFY_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser = new ArgumentParser(
             LDIFModify.class.getName(), toolDescription, false, true, 1, 2, "source [changes]");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDIFMODIFY.get());
 
         final BooleanArgument continueOnError;
@@ -94,17 +85,18 @@ private int run(final String[] args) {
         final StringArgument outputFilename;
         try {
             outputFilename =
-                    new StringArgument("outputFilename", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
-                            OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true,
-                            INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(), "stdout", null,
-                            INFO_LDIFMODIFY_DESCRIPTION_OUTPUT_FILENAME
-                                    .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
-            argParser.addArgument(outputFilename);
+                    StringArgument.builder(OPTION_LONG_OUTPUT_LDIF_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_OUTPUT_LDIF_FILENAME)
+                            .description(INFO_LDIFMODIFY_DESCRIPTION_OUTPUT_FILENAME.get(
+                                    INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()))
+                            .defaultValue("stdout")
+                            .valuePlaceholder(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
-            continueOnError = CommonArguments.getContinueOnError();
+            continueOnError = continueOnErrorArgument();
             argParser.addArgument(continueOnError);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
index da5c13ee7..a844af6f0 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDIFSearch.java
@@ -1,33 +1,26 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2012-2015 ForgeRock AS.
+ * Copyright 2012-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
+import static com.forgerock.opendj.cli.CommonArguments.*;
+
 import static org.forgerock.util.Utils.closeSilently;
 
 import java.io.BufferedReader;
@@ -57,7 +50,6 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.IntegerArgument;
 import com.forgerock.opendj.cli.MultiChoiceArgument;
@@ -85,7 +77,7 @@ private int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_LDIFSEARCH_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser = new ArgumentParser(
             LDIFSearch.class.getName(), toolDescription, false, true, 1, 0, "source [filter] [attributes ...]");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_LDIFSEARCH.get());
 
         final BooleanArgument showUsage;
@@ -98,51 +90,51 @@ private int run(final String[] args) {
         final IntegerArgument sizeLimit;
         try {
             outputFilename =
-                    new StringArgument("outputFilename", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
-                            OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true,
-                            INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get(), "stdout", null,
-                            INFO_LDIFSEARCH_DESCRIPTION_OUTPUT_FILENAME
-                                    .get(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()));
-            argParser.addArgument(outputFilename);
-
+                    StringArgument.builder(OPTION_LONG_OUTPUT_LDIF_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_OUTPUT_LDIF_FILENAME)
+                            .description(INFO_LDIFSEARCH_DESCRIPTION_OUTPUT_FILENAME.get(
+                                    INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get()))
+                            .defaultValue("stdout")
+                            .valuePlaceholder(INFO_OUTPUT_LDIF_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             baseDN =
-                    new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, true,
-                            false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null,
-                            INFO_SEARCH_DESCRIPTION_BASEDN.get());
-            baseDN.setPropertyName(OPTION_LONG_BASEDN);
-            argParser.addArgument(baseDN);
+                    StringArgument.builder(OPTION_LONG_BASEDN)
+                            .shortIdentifier(OPTION_SHORT_BASEDN)
+                            .description(INFO_SEARCH_DESCRIPTION_BASEDN.get())
+                            .required()
+                            .valuePlaceholder(INFO_BASEDN_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
-            searchScope = CommonArguments.getSearchScope();
+            searchScope = searchScopeArgument();
             argParser.addArgument(searchScope);
 
             filename =
-                    new StringArgument("filename", OPTION_SHORT_FILENAME, OPTION_LONG_FILENAME,
-                            false, false, true, INFO_FILE_PLACEHOLDER.get(), null, null,
-                            INFO_SEARCH_DESCRIPTION_FILENAME.get());
-            searchScope.setPropertyName(OPTION_LONG_FILENAME);
-            argParser.addArgument(filename);
-
+                    StringArgument.builder(OPTION_LONG_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_FILENAME)
+                            .description(INFO_SEARCH_DESCRIPTION_FILENAME.get())
+                            .valuePlaceholder(INFO_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             typesOnly =
-                    new BooleanArgument("typesOnly", 'A', "typesOnly", INFO_DESCRIPTION_TYPES_ONLY
-                            .get());
-            typesOnly.setPropertyName("typesOnly");
-            argParser.addArgument(typesOnly);
-
+                    BooleanArgument.builder("typesOnly")
+                            .shortIdentifier('A')
+                            .description(INFO_DESCRIPTION_TYPES_ONLY.get())
+                            .buildAndAddToParser(argParser);
             sizeLimit =
-                    new IntegerArgument("sizeLimit", 'z', "sizeLimit", false, false, true,
-                            INFO_SIZE_LIMIT_PLACEHOLDER.get(), 0, null,
-                            INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get());
-            sizeLimit.setPropertyName("sizeLimit");
-            argParser.addArgument(sizeLimit);
-
+                    IntegerArgument.builder("sizeLimit")
+                            .shortIdentifier('z')
+                            .description(INFO_SEARCH_DESCRIPTION_SIZE_LIMIT.get())
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_SIZE_LIMIT_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
             timeLimit =
-                    new IntegerArgument("timeLimit", 'l', "timeLimit", false, false, true,
-                            INFO_TIME_LIMIT_PLACEHOLDER.get(), 0, null,
-                            INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get());
-            timeLimit.setPropertyName("timeLimit");
-            argParser.addArgument(timeLimit);
+                    IntegerArgument.builder("timeLimit")
+                            .shortIdentifier('l')
+                            .description(INFO_SEARCH_DESCRIPTION_TIME_LIMIT.get())
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_TIME_LIMIT_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (final ArgumentException ae) {
@@ -191,11 +183,8 @@ private int run(final String[] args) {
 
         if (filename.isPresent()) {
             // Read the filter strings.
-            BufferedReader in = null;
-            try {
-                in = new BufferedReader(new FileReader(filename.getValue()));
+            try (BufferedReader in = new BufferedReader(new FileReader(filename.getValue()))) {
                 String line = null;
-
                 while ((line = in.readLine()) != null) {
                     if ("".equals(line.trim())) {
                         // ignore empty lines.
@@ -209,8 +198,6 @@ private int run(final String[] args) {
             } catch (final IOException e) {
                 errPrintln(LocalizableMessage.raw(e.toString()));
                 return ResultCode.CLIENT_SIDE_FILTER_ERROR.intValue();
-            } finally {
-                closeSilently(in);
             }
         }
 
@@ -234,8 +221,6 @@ private int run(final String[] args) {
 
         InputStream sourceInputStream = null;
         OutputStream outputStream = null;
-        LDIFEntryReader sourceReader = null;
-        LDIFEntryWriter outputWriter = null;
 
         try {
             // First source file.
@@ -275,9 +260,10 @@ private int run(final String[] args) {
             }
 
             // Perform the search.
-            sourceReader = new LDIFEntryReader(sourceInputStream);
-            outputWriter = new LDIFEntryWriter(outputStream);
-            LDIF.copyTo(LDIF.search(sourceReader, search), outputWriter);
+            try (LDIFEntryReader sourceReader = new LDIFEntryReader(sourceInputStream);
+                LDIFEntryWriter outputWriter = new LDIFEntryWriter(outputStream)) {
+                LDIF.copyTo(LDIF.search(sourceReader, search), outputWriter);
+            }
         } catch (final IOException e) {
             if (e instanceof LocalizableException) {
                 errPrintln(ERR_LDIFSEARCH_FAILED.get(((LocalizableException) e).getMessageObject()));
@@ -286,7 +272,6 @@ private int run(final String[] args) {
             }
             return ResultCode.CLIENT_SIDE_LOCAL_ERROR.intValue();
         } finally {
-            closeSilently(sourceReader, outputWriter);
             closeSilently(sourceInputStream, outputStream);
         }
 
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MakeLDIF.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MakeLDIF.java
index 7347a0f28..a150056fb 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MakeLDIF.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/MakeLDIF.java
@@ -1,34 +1,26 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2006-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2013-2015 ForgeRock AS.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
+ * Portions Copyright 2013-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 import static com.forgerock.opendj.cli.Utils.filterExitCode;
+import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_MAKELDIF_WRAP_COLUMN_PLACEHOLDER;
 import static org.forgerock.util.Utils.closeSilently;
 
 import java.io.BufferedWriter;
@@ -80,7 +72,7 @@ int run(final String[] args) {
         final LocalizableMessage toolDescription = INFO_MAKELDIF_TOOL_DESCRIPTION.get();
         final ArgumentParser argParser = new ArgumentParser(MakeLDIF.class.getName(), toolDescription,
                 false, true, 1, 1, "template-file-path");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_MAKELDIF.get());
         argParser.setDocToolDescriptionSupplement(SUPPLEMENT_DESCRIPTION_MAKELDIF.get());
 
@@ -89,29 +81,50 @@ int run(final String[] args) {
         StringArgument ldifFile;
         StringArgument resourcePath;
         StringArgument constants;
+        IntegerArgument wrapColumn;
         try {
-            resourcePath = new StringArgument("resourcepath", 'r', OPTION_LONG_RESOURCE_PATH, false, false, true,
-                    INFO_PATH_PLACEHOLDER.get(), null, null, INFO_MAKELDIF_DESCRIPTION_RESOURCE_PATH.get());
-            resourcePath.setDocDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RESOURCE_PATH.get());
-            argParser.addArgument(resourcePath);
-
-            ldifFile = new StringArgument("ldiffile", OPTION_SHORT_OUTPUT_LDIF_FILENAME,
-                    OPTION_LONG_OUTPUT_LDIF_FILENAME, false, false, true, INFO_FILE_PLACEHOLDER.get(),
-                    null, null, INFO_MAKELDIF_DESCRIPTION_LDIF.get());
-            argParser.addArgument(ldifFile);
-
-            randomSeed = new IntegerArgument("randomseed", OPTION_SHORT_RANDOM_SEED, OPTION_LONG_RANDOM_SEED, false,
-                    false, true, INFO_SEED_PLACEHOLDER.get(), 0, null, INFO_MAKELDIF_DESCRIPTION_SEED.get());
-            argParser.addArgument(randomSeed);
-
-            constants = new StringArgument("constant", 'c', OPTION_LONG_CONSTANT, false, true, true,
-                    INFO_CONSTANT_PLACEHOLDER.get(),
-                    null, null, INFO_MAKELDIF_DESCRIPTION_CONSTANT.get());
-            argParser.addArgument(constants);
-
-            showUsage = new BooleanArgument("help", OPTION_SHORT_HELP, OPTION_LONG_HELP,
-                    INFO_MAKELDIF_DESCRIPTION_HELP.get());
-            argParser.addArgument(showUsage);
+            resourcePath =
+                    StringArgument.builder(OPTION_LONG_RESOURCE_PATH)
+                            .shortIdentifier('r')
+                            .description(INFO_MAKELDIF_DESCRIPTION_RESOURCE_PATH.get())
+                            .docDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RESOURCE_PATH.get())
+                            .valuePlaceholder(INFO_PATH_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+            ldifFile =
+                    StringArgument.builder(OPTION_LONG_OUTPUT_LDIF_FILENAME)
+                            .shortIdentifier(OPTION_SHORT_OUTPUT_LDIF_FILENAME)
+                            .description(INFO_MAKELDIF_DESCRIPTION_LDIF.get())
+                            .valuePlaceholder(INFO_FILE_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+            randomSeed =
+                    IntegerArgument.builder(OPTION_LONG_RANDOM_SEED)
+                            .shortIdentifier(OPTION_SHORT_RANDOM_SEED)
+                            .description(INFO_MAKELDIF_DESCRIPTION_SEED.get())
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_SEED_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+            constants =
+                    StringArgument.builder(OPTION_LONG_CONSTANT)
+                            .shortIdentifier('c')
+                            .description(INFO_MAKELDIF_DESCRIPTION_CONSTANT.get())
+                            .multiValued()
+                            .valuePlaceholder(INFO_CONSTANT_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+            showUsage =
+                    BooleanArgument.builder(OPTION_LONG_HELP)
+                            .shortIdentifier(OPTION_SHORT_HELP)
+                            .description(INFO_MAKELDIF_DESCRIPTION_HELP.get())
+                            .buildAndAddToParser(argParser);
+
+            wrapColumn =
+                    IntegerArgument.builder("wrapColumn")
+                            .shortIdentifier('w')
+                            .description(INFO_MAKELDIF_DESCRIPTION_WRAP_COLUMN.get())
+                            .lowerBound(0)
+                            .defaultValue(0)
+                            .valuePlaceholder(INFO_MAKELDIF_WRAP_COLUMN_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
             argParser.setUsageArgument(showUsage, getOutputStream());
         } catch (ArgumentException ae) {
             errPrintln(ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage()));
@@ -130,12 +143,12 @@ int run(final String[] args) {
             return 0;
         }
         final String templatePath = argParser.getTrailingArguments().get(0);
-        return run(templatePath, resourcePath, ldifFile, randomSeed, constants);
+        return run(templatePath, resourcePath, ldifFile, randomSeed, constants, wrapColumn);
     }
 
     /** Run Make LDIF with provided arguments. */
-    private int run(final String templatePath, final StringArgument resourcePath,
-            final StringArgument ldifFile, final IntegerArgument randomSeedArg, final StringArgument constants) {
+    private int run(final String templatePath, final StringArgument resourcePath, final StringArgument ldifFile,
+            final IntegerArgument randomSeedArg, final StringArgument constants, final IntegerArgument wrapColumn) {
         LDIFEntryWriter writer = null;
         try (EntryGenerator generator = createGenerator(templatePath, resourcePath, randomSeedArg, constants)) {
             if (generator == null) {
@@ -148,15 +161,14 @@ private int run(final String templatePath, final StringArgument resourcePath,
                 }
             }
 
-            if (ldifFile.isPresent()) {
-                try {
-                    writer = new LDIFEntryWriter(new BufferedWriter(new FileWriter(new File(ldifFile.getValue()))));
-                } catch (IOException e) {
-                    errPrintln(ERR_MAKELDIF_UNABLE_TO_CREATE_LDIF.get(ldifFile.getValue(), e.getMessage()));
-                    return EXIT_CODE_FAILURE;
-                }
-            } else {
-                writer = new LDIFEntryWriter(getOutputStream());
+            try {
+                writer = createLdifWriter(ldifFile, wrapColumn);
+            } catch (final IOException e) {
+                errPrintln(ERR_MAKELDIF_UNABLE_TO_CREATE_LDIF.get(ldifFile.getValue(), e.getMessage()));
+                return EXIT_CODE_FAILURE;
+            } catch (final ArgumentException e) {
+                errPrintln(ERR_ERROR_PARSING_ARGS.get(e.getMessageObject()));
+                return EXIT_CODE_FAILURE;
             }
 
             if (!generateEntries(generator, writer, ldifFile)) {
@@ -171,6 +183,17 @@ private int run(final String templatePath, final StringArgument resourcePath,
         }
     }
 
+    private LDIFEntryWriter createLdifWriter(final StringArgument ldifFile, final IntegerArgument wrapColumn)
+            throws IOException, ArgumentException {
+        final LDIFEntryWriter writer;
+        if (ldifFile.isPresent()) {
+            writer = new LDIFEntryWriter(new BufferedWriter(new FileWriter(ldifFile.getValue())));
+        } else {
+            writer = new LDIFEntryWriter(getOutputStream());
+        }
+        return writer.setWrapColumn(wrapColumn.getIntValue());
+    }
+
     static EntryGenerator createGenerator(final String templatePath, final StringArgument resourcePath,
                                             final IntegerArgument randomSeedArg, final StringArgument constants,
                                             final boolean generateBranches, final ConsoleApplication app) {
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
index 52947ee79..102ea9f28 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/ModRate.java
@@ -1,28 +1,18 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
@@ -41,14 +31,15 @@
 import com.forgerock.opendj.cli.ArgumentException;
 import com.forgerock.opendj.cli.ArgumentParser;
 import com.forgerock.opendj.cli.BooleanArgument;
-import com.forgerock.opendj.cli.CommonArguments;
 import com.forgerock.opendj.cli.ConnectionFactoryProvider;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.StringArgument;
 
 import static com.forgerock.opendj.cli.ArgumentConstants.*;
+import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler;
 import static com.forgerock.opendj.cli.Utils.*;
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
+import static com.forgerock.opendj.cli.CommonArguments.*;
 
 /**
  * A load generation tool that can be used to load a Directory Server with
@@ -67,12 +58,12 @@ private ModifyWorkerThread(final Connection connection,
 
             @Override
             public Promise performOperation(final Connection connection,
-                    final DataSource[] dataSources, final long startTime) {
+                    final DataSource[] dataSources, final long currentTimeNs) {
                 if (dataSources != null) {
                     data = DataSource.generateData(dataSources, data);
                 }
                 mr = newModifyRequest(data);
-                LdapResultHandler modRes = new UpdateStatsResultHandler<>(startTime);
+                LdapResultHandler modRes = new UpdateStatsResultHandler<>(currentTimeNs);
 
                 incrementIterationCount();
                 return connection.modifyAsync(mr).thenOnResult(modRes).thenOnException(modRes);
@@ -118,8 +109,8 @@ WorkerThread newWorkerThread(final Connection connection,
         }
 
         @Override
-        StatsThread newStatsThread() {
-            return new StatsThread(new String[0]);
+        StatsThread newStatsThread(final PerformanceRunner performanceRunner, final ConsoleApplication app) {
+            return new StatsThread(performanceRunner, app);
         }
     }
 
@@ -162,7 +153,7 @@ private int run(final String[] args) {
         final ArgumentParser argParser =
                 new ArgumentParser(ModRate.class.getName(), toolDescription, false, true, 1, 0,
                         "[(attribute:value format string) ...]");
-        argParser.setVersionHandler(new SdkVersionHandler());
+        argParser.setVersionHandler(newSdkVersionHandler());
         argParser.setShortToolDescription(REF_SHORT_DESC_MODRATE.get());
         argParser.setDocToolDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RATE_TOOLS.get());
 
@@ -180,33 +171,34 @@ private int run(final String[] args) {
             connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this);
             runner = new ModifyPerformanceRunner(new PerformanceRunnerOptions(argParser, this));
 
-            propertiesFileArgument = CommonArguments.getPropertiesFile();
+            propertiesFileArgument = propertiesFileArgument();
             argParser.addArgument(propertiesFileArgument);
             argParser.setFilePropertiesArgument(propertiesFileArgument);
 
-            noPropertiesFileArgument = CommonArguments.getNoPropertiesFile();
+            noPropertiesFileArgument = noPropertiesFileArgument();
             argParser.addArgument(noPropertiesFileArgument);
             argParser.setNoPropertiesFileArgument(noPropertiesFileArgument);
 
             baseDN =
-                    new StringArgument("targetDN", OPTION_SHORT_BASEDN, OPTION_LONG_TARGETDN, true,
-                            false, true, INFO_TARGETDN_PLACEHOLDER.get(), null, null,
-                            INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get());
-            baseDN.setPropertyName(OPTION_LONG_BASEDN);
-            argParser.addArgument(baseDN);
-
-            verbose = CommonArguments.getVerbose();
+                    StringArgument.builder(OPTION_LONG_TARGETDN)
+                            .shortIdentifier(OPTION_SHORT_BASEDN)
+                            .description(INFO_MODRATE_TOOL_DESCRIPTION_TARGETDN.get())
+                            .required()
+                            .valuePlaceholder(INFO_TARGETDN_PLACEHOLDER.get())
+                            .buildAndAddToParser(argParser);
+
+            verbose = verboseArgument();
             argParser.addArgument(verbose);
 
-            showUsage = CommonArguments.getShowUsage();
+            showUsage = showUsageArgument();
             argParser.addArgument(showUsage);
             argParser.setUsageArgument(showUsage, getOutputStream());
 
             scriptFriendly =
-                    new BooleanArgument("scriptFriendly", 'S', "scriptFriendly",
-                            INFO_DESCRIPTION_SCRIPT_FRIENDLY.get());
-            scriptFriendly.setPropertyName("scriptFriendly");
-            argParser.addArgument(scriptFriendly);
+                    BooleanArgument.builder("scriptFriendly")
+                            .shortIdentifier('S')
+                            .description(INFO_DESCRIPTION_SCRIPT_FRIENDLY.get())
+                            .buildAndAddToParser(argParser);
         } catch (final ArgumentException ae) {
             final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage());
             errPrintln(message);
diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
index 6d7c17b08..bd119ef22 100644
--- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
+++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunner.java
@@ -1,33 +1,22 @@
 /*
- * CDDL HEADER START
+ * The contents of this file are subject to the terms of the Common Development and
+ * Distribution License (the License). You may not use this file except in compliance with the
+ * License.
  *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
+ * specific language governing permission and limitations under the License.
  *
- * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
- * or http://forgerock.org/license/CDDLv1.0.html.
- * See the License for the specific language governing permissions
- * and limitations under the License.
+ * When distributing Covered Software, include this CDDL Header Notice in each file and include
+ * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
+ * Header, with the fields enclosed by brackets [] replaced by your own identifying
+ * information: "Portions Copyright [year] [name of copyright owner]".
  *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at legal-notices/CDDLv1_0.txt.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information:
- *      Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- *
- *
- *      Copyright 2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS.
+ * Copyright 2010 Sun Microsystems, Inc.
+ * Portions Copyright 2011-2016 ForgeRock AS.
  */
 package com.forgerock.opendj.ldap.tools;
 
 import static com.forgerock.opendj.ldap.tools.Utils.printErrorMessage;
-import static java.util.Locale.ENGLISH;
 import static java.util.concurrent.TimeUnit.*;
 
 import static org.forgerock.util.Utils.*;
@@ -35,19 +24,9 @@
 import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
 
 import java.io.IOException;
-import java.io.PrintStream;
-import java.lang.management.GarbageCollectorMXBean;
-import java.lang.management.ManagementFactory;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
-import java.util.LinkedList;
 import java.util.List;
-import java.util.Map.Entry;
-import java.util.Queue;
-import java.util.concurrent.ConcurrentSkipListMap;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
 
 import org.forgerock.i18n.LocalizableMessage;
 import org.forgerock.opendj.ldap.Connection;
@@ -65,423 +44,12 @@
 import com.forgerock.opendj.cli.BooleanArgument;
 import com.forgerock.opendj.cli.ConsoleApplication;
 import com.forgerock.opendj.cli.IntegerArgument;
-import com.forgerock.opendj.cli.MultiColumnPrinter;
 import com.forgerock.opendj.cli.StringArgument;
 import com.forgerock.opendj.util.StaticUtils;
 
 /** Benchmark application framework. */
 abstract class PerformanceRunner implements ConnectionEventListener {
-    static final class ResponseTimeBuckets {
-        private static final long NS_1_US = NANOSECONDS.convert(1, MICROSECONDS);
-        private static final long NS_100_US = NANOSECONDS.convert(100, MICROSECONDS);
-        private static final long NS_1_MS = NANOSECONDS.convert(1, MILLISECONDS);
-        private static final long NS_10_MS = NANOSECONDS.convert(10, MILLISECONDS);
-        private static final long NS_100_MS = NANOSECONDS.convert(100, MILLISECONDS);
-        private static final long NS_1_S = NANOSECONDS.convert(1, SECONDS);
-        private static final long NS_5_S = NANOSECONDS.convert(5, SECONDS);
-
-        private static final int NB_INDEX = 2120;
-        private static final int RANGE_100_MICROSECONDS_START_INDEX = 1000;
-        private static final int RANGE_1_MILLISECOND_START_INDEX = 1090;
-        private static final int RANGE_100_MILLISECONDS_START_INDEX = 2080;
-
-        /**
-         * Array of response time buckets.
-         *
-         * 
-         * index    0 ->  999: 1000 buckets for    0ms -    1ms  interval with       1 µs increments
-         * index 1000 -> 1089:   90 buckets for    1ms -   10ms  interval with     100 µs increments
-         * index 1090 -> 2079:  990 buckets for   10ms - 1000ms  interval with    1000 µs increments
-         * index 2080 -> 2119:   40 buckets for 1000ms - 5000ms  interval with 100 000 µs increments
-         * 
- */ - private final AtomicLong[] index2Frequency = new AtomicLong[NB_INDEX]; - - /** - * Store the lower bounds (in microseconds) of the eTime buckets. - */ - private final long[] index2Etime = new long[NB_INDEX]; - - /** - * Sorted map used for storing response times from 5s+ with 500 millisecond increments. - * - * Keys (Long in microseconds) of this map must respect this pattern: n * 500 000 + 5 000 000, - * where n is a natural integer. - */ - private final ConcurrentSkipListMap bigEtimes = new ConcurrentSkipListMap<>(); - - /** - * Initialize both index2Frequency and index2Etime arrays. - */ - private ResponseTimeBuckets() { - // Helpful variables to compute index2Etime values. - long rangeWidthMicroSecs; - long rangeStart = 0; - long initialTimeMicroSecs = 0; - - for (int i = 0; i < NB_INDEX; i++) { - index2Frequency[i] = new AtomicLong(); - if (i < RANGE_100_MICROSECONDS_START_INDEX) { - // 0ms-1ms in 1 us increments - rangeWidthMicroSecs = 1; - } else if (i < RANGE_1_MILLISECOND_START_INDEX) { - // 1ms-10ms in 100 us increments - rangeWidthMicroSecs = 100; - rangeStart = RANGE_100_MICROSECONDS_START_INDEX; - initialTimeMicroSecs = MICROSECONDS.convert(1, MILLISECONDS); - } else if (i < RANGE_100_MILLISECONDS_START_INDEX) { - // 10ms-1000ms in 1000 us increments - rangeWidthMicroSecs = MICROSECONDS.convert(1, MILLISECONDS); - rangeStart = RANGE_1_MILLISECOND_START_INDEX; - initialTimeMicroSecs = MICROSECONDS.convert(10, MILLISECONDS); - } else { - // 1000ms-5000ms with 100 000 us increments - rangeWidthMicroSecs = MICROSECONDS.convert(100, MILLISECONDS); - rangeStart = RANGE_100_MILLISECONDS_START_INDEX; - initialTimeMicroSecs = MICROSECONDS.convert(1, SECONDS); - } - index2Etime[i] = (i - rangeStart) * rangeWidthMicroSecs + initialTimeMicroSecs; - } - } - - /** - * Compute the closest response time values for each percentile given in - * parameter. Percentiles array has to be sorted from lower to higher - * percentiles. - * - * @param percentiles - * array of {@code double} - * - * @param nbData - * number of response times recorded. - * - * @return array of response times in microseconds corresponding to - * percentiles. - */ - List getPercentile(double[] percentiles, long nbData) { - List responseTimes = new ArrayList<>(); - Queue nbDataThresholds = new LinkedList<>(); - long nbDataSum = nbData; - - for (int i = percentiles.length - 1; i >= 0; i--) { - nbDataThresholds.add((long) (percentiles[i] * nbData) / 100); - } - - Iterator> iter = bigEtimes.descendingMap().entrySet().iterator(); - while (iter.hasNext() && !nbDataThresholds.isEmpty()) { - Entry currentETime = iter.next(); - nbDataSum -= currentETime.getValue().get(); - computePercentiles(nbDataThresholds, responseTimes, nbDataSum, currentETime.getKey()); - } - - int stdTimeIndex = NB_INDEX - 1; - while (stdTimeIndex >= 0 && !nbDataThresholds.isEmpty()) { - long currentETime = index2Etime[stdTimeIndex]; - nbDataSum -= index2Frequency[stdTimeIndex].get(); - computePercentiles(nbDataThresholds, responseTimes, nbDataSum, currentETime); - stdTimeIndex--; - } - - return responseTimes; - } - - private void computePercentiles(Queue currentDataThreshold, List responseTimes, long currentSum, - long currentETime) { - while (currentDataThreshold.peek() != null && currentDataThreshold.peek() >= currentSum) { - responseTimes.add(currentETime); - currentDataThreshold.poll(); - } - } - - void addTimeToInterval(long responseTimeNanoSecs) { - if (responseTimeNanoSecs >= NS_5_S) { - long matchingKey = responseTimeNanoSecs / NS_100_MS; - matchingKey -= matchingKey % 5; - matchingKey = matchingKey * MICROSECONDS.convert(100, MILLISECONDS); - // We now have a key corresponding to pattern 5 000 000 + n * 500 000 µs - AtomicLong existingKey = bigEtimes.putIfAbsent(matchingKey, new AtomicLong(1)); - if (existingKey != null) { - existingKey.getAndIncrement(); - } - return; - } - - final int startRangeIndex; - final long rangeWidthNanoSecs; - if (responseTimeNanoSecs < NS_1_MS) { - rangeWidthNanoSecs = NS_1_US; - startRangeIndex = 0; - } else if (responseTimeNanoSecs < NS_10_MS) { - rangeWidthNanoSecs = NS_100_US; - startRangeIndex = RANGE_100_MICROSECONDS_START_INDEX - 10; - } else if (responseTimeNanoSecs < NS_1_S) { - rangeWidthNanoSecs = NS_1_MS; - startRangeIndex = RANGE_1_MILLISECOND_START_INDEX - 10; - } else { - rangeWidthNanoSecs = NS_100_MS; - startRangeIndex = RANGE_100_MILLISECONDS_START_INDEX - 10; - } - final int intervalIndex = ((int) (responseTimeNanoSecs / rangeWidthNanoSecs)) + startRangeIndex; - index2Frequency[intervalIndex].getAndIncrement(); - } - } - - /** To allow tests. */ - static ResponseTimeBuckets getResponseTimeBuckets() { - return new ResponseTimeBuckets(); - } - - - /** Statistics thread base implementation. */ - class StatsThread extends Thread { - protected long totalResultCount; - protected long totalOperationCount; - protected double totalDurationSec; - protected long totalWaitTimeNs; - - protected int intervalSuccessCount; - protected int intervalOperationCount; - protected int intervalFailedCount; - protected double intervalDurationSec; - protected long intervalWaitTimeNs; - - protected long lastStatTimeMs; - protected long lastGCDurationMs; - - private final int numColumns; - private final String[] additionalColumns; - private final double[] percentiles; - private final List gcBeans; - private final boolean isScriptFriendly = app.isScriptFriendly(); - private MultiColumnPrinter printer; - - public StatsThread(final String... additionalColumns) { - super("Stats Thread"); - - this.additionalColumns = additionalColumns; - if (!percentilesArgument.isPresent()) { - this.percentiles = new double[] { 99.9, 99.99, 99.999 }; - } else { - this.percentiles = new double[percentilesArgument.getValues().size()]; - int index = 0; - for (final String percentile : percentilesArgument.getValues()) { - percentiles[index++] = Double.parseDouble(percentile); - } - Arrays.sort(percentiles); - } - - this.numColumns = 5 + this.percentiles.length + additionalColumns.length + (isAsync ? 1 : 0); - this.gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); - } - - private void printResultsTitle() { - if (isScriptFriendly) { - printResultsTitleScriptFriendly(); - return; - } - - printer = new MultiColumnPrinter(numColumns, 2, "-", MultiColumnPrinter.RIGHT, app); - printer.setTitleAlign(MultiColumnPrinter.RIGHT); - printResultTitleHeaders(); - printResultTitleDetails(); - } - - private void printResultTitleHeaders() { - final String[][] titleHeaders = new String[2][numColumns]; - for (final String[] titleLine : titleHeaders) { - Arrays.fill(titleLine, ""); - } - - titleHeaders[0][0] = "Throughput"; - titleHeaders[0][2] = "Response Time"; - - titleHeaders[1][0] = "(ops/second)"; - titleHeaders[1][2] = "(milliseconds)"; - - final int[] span = new int[numColumns]; - span[0] = 2; - span[1] = 0; - span[2] = 2 + this.percentiles.length; - Arrays.fill(span, 3, 4 + this.percentiles.length, 0); - Arrays.fill(span, 4 + this.percentiles.length, span.length, 1); - - for (final String[] titleLine : titleHeaders) { - printer.addTitle(titleLine, span); - } - } - - private void printResultTitleDetails() { - final String[] titleDetails = new String[numColumns]; - titleDetails[0] = "recent"; - titleDetails[1] = "average"; - titleDetails[2] = "recent"; - titleDetails[3] = "average"; - int i = 4; - for (double percentile :percentiles) { - titleDetails[i++] = percentile + "%"; - } - titleDetails[i++] = "err/sec"; - if (isAsync) { - titleDetails[i++] = "req/res"; - } - for (final String column : additionalColumns) { - titleDetails[i++] = column; - } - - final int[] span = new int[numColumns]; - Arrays.fill(span, 1); - - printer.addTitle(titleDetails, span); - printer.printTitle(); - } - - private void printResultsTitleScriptFriendly() { - final PrintStream out = app.getOutputStream(); - out.print("Time (seconds)"); - out.print(","); - out.print("Recent throughput (ops/second)"); - out.print(","); - out.print("Average throughput (ops/second)"); - out.print(","); - out.print("Recent response time (milliseconds)"); - out.print(","); - out.print("Average response time (milliseconds)"); - for (final double percentile : this.percentiles) { - out.print(","); - out.print(percentile); - out.print("% response time (milliseconds)"); - } - out.print(","); - out.print("Errors/second"); - if (isAsync) { - out.print(","); - out.print("Requests/response"); - } - for (final String column : additionalColumns) { - out.print(","); - out.print(column); - } - out.println(); - } - - @Override - public void run() { - printResultsTitle(); - - long totalStatTimeMs = System.currentTimeMillis(); - long gcDurationMs = getGCDuration(); - - while (!stopRequested) { - try { - sleep(statsInterval); - } catch (final InterruptedException ie) { - // Ignore. - } - lastStatTimeMs = totalStatTimeMs; - totalStatTimeMs = System.currentTimeMillis(); - - lastGCDurationMs = gcDurationMs; - gcDurationMs = getGCDuration(); - final long gcIntervalDurationMs = gcDurationMs - lastGCDurationMs; - - computeStatsForInterval(totalStatTimeMs, gcIntervalDurationMs); - final long intervalResultCount = intervalSuccessCount + intervalFailedCount; - - final String[] printableStats = new String[numColumns]; - Arrays.fill(printableStats, "-"); - printableStats[0] = getDivisionResult(intervalResultCount, intervalDurationSec, 1); - printableStats[1] = getDivisionResult(totalResultCount, totalDurationSec, 1); - - final long intervalWaitTimeMs = NANOSECONDS.toMillis(intervalWaitTimeNs) - gcIntervalDurationMs; - printableStats[2] = getDivisionResult(intervalWaitTimeMs, intervalResultCount, 3); - - final long totalWaitTimeMs = NANOSECONDS.toMillis(totalWaitTimeNs) - gcDurationMs; - printableStats[3] = getDivisionResult(totalWaitTimeMs, totalResultCount, 3); - - int i = 4; - final List computedPercentiles = eTimesBuckets.getPercentile(percentiles, totalOperationCount); - for (int j = computedPercentiles.size() - 1; j >= 0; j--) { - printableStats[i++] = getDivisionResult(computedPercentiles.get(j) , 1000.0, 2); - } - i = 4 + percentiles.length; - printableStats[i++] = intervalFailedCount == 0 - ? "0.0" - : getDivisionResult(intervalFailedCount, intervalDurationSec, 1); - if (isAsync) { - printableStats[i++] = getDivisionResult(intervalOperationCount, intervalResultCount, 1); - } - - for (final String column : getAdditionalColumns()) { - printableStats[i++] = column; - } - - if (isScriptFriendly) { - printScriptFriendlyStats(printableStats); - } else { - printer.printRow(printableStats); - } - } - } - - private void computeStatsForInterval(final long statTime, final long gcIntervalDurationMs) { - intervalOperationCount = operationRecentCount.getAndSet(0); - intervalSuccessCount = successRecentCount.getAndSet(0); - intervalFailedCount = failedRecentCount.getAndSet(0); - intervalWaitTimeNs = waitRecentTimeNs.getAndSet(0); - - totalOperationCount += intervalOperationCount; - totalResultCount += intervalSuccessCount + intervalFailedCount; - totalWaitTimeNs += intervalWaitTimeNs; - - final long intervalDurationMs = statTime - lastStatTimeMs; - intervalDurationSec = (intervalDurationMs - gcIntervalDurationMs) / 1000.0; - totalDurationSec += intervalDurationSec; - } - - private long getGCDuration() { - long gcDuration = 0; - for (final GarbageCollectorMXBean bean : gcBeans) { - gcDuration += bean.getCollectionTime(); - } - - return gcDuration; - } - - private String getDivisionResult(final long numerator, final double denominator, final int precision) { - return getDivisionResult(numerator, denominator, precision, "-"); - } - - protected String getDivisionResult( - final long numerator, final double denominator, final int precision, final String fallBack) { - return denominator > 0 ? String.format(ENGLISH, "%." + precision + "f", numerator / denominator) - : fallBack; - } - - private void printScriptFriendlyStats(String[] printableStats) { - final PrintStream out = app.getOutputStream(); - out.print(String.format(ENGLISH, "%.3f", totalDurationSec)); - for (final String s : printableStats) { - out.print(","); - out.print(s); - } - out.println(); - } - - String[] getAdditionalColumns() { - return EMPTY_STRINGS; - } - - /** Resets both general and recent statistic indicators. */ - void resetStats() { - intervalFailedCount = 0; - intervalOperationCount = 0; - intervalSuccessCount = 0; - operationRecentCount.set(0); - successRecentCount.set(0); - failedRecentCount.set(0); - waitRecentTimeNs.set(0); - } - } + private static final double[] DEFAULT_PERCENTILES = new double[] { 99.9, 99.99, 99.999 }; class TimerThread extends Thread { private final long timeToWait; @@ -491,7 +59,7 @@ class TimerThread extends Thread { } void performStopOperations() { - stopRequested = true; + stopTool(); } @Override @@ -513,31 +81,31 @@ public void run() { * The type of expected result. */ class UpdateStatsResultHandler implements LdapResultHandler { - protected final long currentTime; + protected final long operationStartTimeNs; - UpdateStatsResultHandler(final long currentTime) { - this.currentTime = currentTime; + UpdateStatsResultHandler(final long currentTimeNs) { + this.operationStartTimeNs = currentTimeNs; } @Override - public void handleException(final LdapException exception) { - failedRecentCount.getAndIncrement(); - updateStats(); + public final void handleException(final LdapException exception) { + statsThread.incrementFailedCount(); + updateResponseTime(); app.errPrintVerboseMessage(LocalizableMessage.raw(exception.getResult().toString())); } @Override - public void handleResult(final S result) { - successRecentCount.getAndIncrement(); - updateStats(); + public final void handleResult(final S result) { + statsThread.incrementSuccessCount(); + updateResponseTime(); + updateAdditionalStatsOnResult(); } - private void updateStats() { - if (!isWarmingUp) { - final long eTime = System.nanoTime() - currentTime; - waitRecentTimeNs.getAndAdd(eTime); - eTimesBuckets.addTimeToInterval(eTime); - } + /** Do nothing by default, child classes which manage additional stats need to override this method. */ + void updateAdditionalStatsOnResult() { } + + private void updateResponseTime() { + statsThread.addResponseTime(System.nanoTime() - operationStartTimeNs); } } @@ -555,7 +123,7 @@ abstract class WorkerThread extends Thread { } public abstract Promise performOperation( - Connection connection, DataSource[] dataSources, long startTime); + Connection connection, DataSource[] dataSources, long currentTimeNs); @Override public void run() { @@ -566,61 +134,37 @@ public void run() { while (!stopRequested && !localStopRequested && (maxIterations <= 0 || count < maxIterations)) { - if (this.connection == null) { - try { - connection = connectionFactory.getConnectionAsync().getOrThrow(); - } catch (final InterruptedException e) { - // Ignore and check stop requested - continue; - } catch (final LdapException e) { - app.errPrintln(LocalizableMessage.raw(e.getResult().getDiagnosticMessage())); - if (e.getCause() != null && app.isVerbose()) { - e.getCause().printStackTrace(app.getErrorStream()); - } - stopRequested = true; - break; - } - } else { - connection = this.connection; - if (!noRebind && bindRequest != null) { - try { - connection.bindAsync(bindRequest).getOrThrow(); - } catch (final InterruptedException e) { - // Ignore and check stop requested - continue; - } catch (final LdapException e) { - app.errPrintln(LocalizableMessage.raw(e.getResult().toString())); - if (e.getCause() != null && app.isVerbose()) { - e.getCause().printStackTrace(app.getErrorStream()); - } - stopRequested = true; - break; - } - } + try { + connection = getConnectionToUse(); + } catch (final InterruptedException e) { + // Ignore and check stop requested + continue; + } catch (final LdapException e) { + handleConnectionError(false, e); + break; } long startTimeNs = System.nanoTime(); promise = performOperation(connection, dataSources.get(), startTimeNs); - operationRecentCount.getAndIncrement(); - if (!isAsync) { - try { - promise.getOrThrow(); - } catch (final InterruptedException e) { - // Ignore and check stop requested - continue; - } catch (final LdapException e) { - if (e.getCause() instanceof IOException) { - e.getCause().printStackTrace(app.getErrorStream()); - stopRequested = true; - break; - } - // Ignore. Handled by result handler - } finally { - if (this.connection == null) { - connection.close(); - } + statsThread.incrementOperationCount(); + try { + promise.getOrThrow(); + } catch (final InterruptedException e) { + // Ignore and check stop requested + continue; + } catch (final LdapException e) { + if (!stopRequested && e.getCause() instanceof IOException) { + e.getCause().printStackTrace(app.getErrorStream()); + stopTool(true); + break; + } + // Ignore. Handled by result handler + } finally { + if (this.connection == null) { + connection.close(); } } + if (targetThroughput > 0) { try { if (sleepTimeMs > 1) { @@ -640,25 +184,28 @@ public void run() { } } + private Connection getConnectionToUse() throws InterruptedException, LdapException { + if (this.connection == null) { + return connectionFactory.getConnectionAsync().getOrThrow(); + } else { + final Connection resultConnection = this.connection; + if (!noRebind && bindRequest != null) { + resultConnection.bindAsync(bindRequest).getOrThrow(); + } + return resultConnection; + } + } + void incrementIterationCount() { count++; } } - private static final String[] EMPTY_STRINGS = new String[0]; - private final AtomicInteger operationRecentCount = new AtomicInteger(); - protected final AtomicInteger successRecentCount = new AtomicInteger(); - protected final AtomicInteger failedRecentCount = new AtomicInteger(); - private final AtomicLong waitRecentTimeNs = new AtomicLong(); - private final ResponseTimeBuckets eTimesBuckets = new ResponseTimeBuckets(); - - private final ConsoleApplication app; private DataSource[] dataSourcePrototypes; /** Thread local copies of the data sources. */ private final ThreadLocal dataSources = new ThreadLocal() { - /** {@inheritDoc} */ @Override protected DataSource[] initialValue() { final DataSource[] prototypes = getDataSources(); @@ -674,18 +221,17 @@ protected DataSource[] initialValue() { int numThreads; int numConnections; - volatile boolean stopRequested; - private volatile boolean isWarmingUp; + private boolean stopRequested; + private int targetThroughput; private int maxIterations; - /** Warm-up duration time in ms. **/ - private long warmUpDuration; - /** Max duration time in ms, 0 for unlimited. **/ - private long maxDurationTime; - private boolean isAsync; + /** Warm-up duration time in ms. */ + private long warmUpDurationMs; + /** Max duration time in ms, 0 for unlimited. */ + private long maxDurationTimeMs; private boolean noRebind; private BindRequest bindRequest; - private int statsInterval; + private int statsIntervalMs; private final IntegerArgument numThreadsArgument; private final IntegerArgument maxDurationArgument; private final IntegerArgument statsIntervalArgument; @@ -694,22 +240,26 @@ protected DataSource[] initialValue() { private final IntegerArgument percentilesArgument; private final BooleanArgument keepConnectionsOpen; private final BooleanArgument noRebindArgument; - private final BooleanArgument asyncArgument; private final StringArgument arguments; protected final IntegerArgument maxIterationsArgument; protected final IntegerArgument warmUpArgument; private final List workerThreads = new ArrayList<>(); + StatsThread statsThread; PerformanceRunner(final PerformanceRunnerOptions options) throws ArgumentException { ArgumentParser argParser = options.getArgumentParser(); this.app = options.getConsoleApplication(); + numThreadsArgument = - new IntegerArgument("numThreads", 't', "numThreads", false, false, true, - LocalizableMessage.raw("{numThreads}"), 1, null, true, 1, false, 0, - LocalizableMessage.raw("Number of worker threads per connection")); - numThreadsArgument.setPropertyName("numThreads"); + IntegerArgument.builder("numThreads") + .shortIdentifier('t') + .description(LocalizableMessage.raw("Number of worker threads per connection")) + .lowerBound(1) + .defaultValue(1) + .valuePlaceholder(LocalizableMessage.raw("{numThreads}")) + .buildArgument(); if (options.supportsMultipleThreadsPerConnection()) { argParser.addArgument(numThreadsArgument); } else { @@ -717,96 +267,87 @@ protected DataSource[] initialValue() { } numConnectionsArgument = - new IntegerArgument("numConnections", 'c', "numConnections", false, false, true, - LocalizableMessage.raw("{numConnections}"), 1, null, true, 1, false, 0, - LocalizableMessage.raw("Number of connections")); - numConnectionsArgument.setPropertyName("numConnections"); - argParser.addArgument(numConnectionsArgument); - + IntegerArgument.builder("numConnections") + .shortIdentifier('c') + .description(LocalizableMessage.raw("Number of connections")) + .lowerBound(1) + .defaultValue(1) + .valuePlaceholder(LocalizableMessage.raw("{numConnections}")) + .buildAndAddToParser(argParser); maxIterationsArgument = - new IntegerArgument("maxIterations", 'm', "maxIterations", false, false, true, - LocalizableMessage.raw("{maxIterations}"), 0, null, - LocalizableMessage.raw("Max iterations, 0 for unlimited")); - maxIterationsArgument.setPropertyName("maxIterations"); - argParser.addArgument(maxIterationsArgument); - + IntegerArgument.builder("maxIterations") + .shortIdentifier('m') + .description(LocalizableMessage.raw("Max iterations, 0 for unlimited")) + .defaultValue(0) + .valuePlaceholder(LocalizableMessage.raw("{maxIterations}")) + .buildAndAddToParser(argParser); maxDurationArgument = - new IntegerArgument("maxDuration", 'd', "maxDuration", false, false, true, - LocalizableMessage.raw("{maxDuration}"), 0, null, true, 1, false, 0, - LocalizableMessage.raw("Maximum duration in seconds, 0 for unlimited")); - argParser.addArgument(maxDurationArgument); - + IntegerArgument.builder("maxDuration") + .shortIdentifier('d') + .description(LocalizableMessage.raw("Maximum duration in seconds, 0 for unlimited")) + .lowerBound(1) + .defaultValue(0) + .valuePlaceholder(LocalizableMessage.raw("{maxDuration}")) + .buildAndAddToParser(argParser); warmUpArgument = - new IntegerArgument("warmUpDuration", 'B', "warmUpDuration", false, false, true, - LocalizableMessage.raw("{warmUpDuration}"), 0, null, - LocalizableMessage.raw("Warm up duration in seconds")); - argParser.addArgument(warmUpArgument); - + IntegerArgument.builder("warmUpDuration") + .shortIdentifier('B') + .description(LocalizableMessage.raw("Warm up duration in seconds")) + .defaultValue(0) + .valuePlaceholder(LocalizableMessage.raw("{warmUpDuration}")) + .buildAndAddToParser(argParser); statsIntervalArgument = - new IntegerArgument("statInterval", 'i', "statInterval", false, false, true, - LocalizableMessage.raw("{statInterval}"), 5, null, true, 1, false, 0, - LocalizableMessage.raw("Display results each specified number of seconds")); - statsIntervalArgument.setPropertyName("statInterval"); - argParser.addArgument(statsIntervalArgument); - + IntegerArgument.builder("statInterval") + .shortIdentifier('i') + .description(LocalizableMessage.raw("Display results each specified number of seconds")) + .lowerBound(1) + .defaultValue(5) + .valuePlaceholder(LocalizableMessage.raw("{statInterval}")) + .buildAndAddToParser(argParser); targetThroughputArgument = - new IntegerArgument("targetThroughput", 'M', "targetThroughput", false, false, - true, LocalizableMessage.raw("{targetThroughput}"), 0, null, - LocalizableMessage.raw("Target average throughput to achieve")); - targetThroughputArgument.setPropertyName("targetThroughput"); - argParser.addArgument(targetThroughputArgument); - + IntegerArgument.builder("targetThroughput") + .shortIdentifier('M') + .description(LocalizableMessage.raw("Target average throughput to achieve")) + .defaultValue(0) + .valuePlaceholder(LocalizableMessage.raw("{targetThroughput}")) + .buildAndAddToParser(argParser); percentilesArgument = - new IntegerArgument("percentile", 'e', "percentile", false, true, - LocalizableMessage.raw("{percentile}"), true, 0, true, 100, - LocalizableMessage.raw("Calculate max response time for a " - + "percentile of operations")); - percentilesArgument.setPropertyName("percentile"); - percentilesArgument.setMultiValued(true); - argParser.addArgument(percentilesArgument); - + IntegerArgument.builder("percentile") + .shortIdentifier('e') + .description( + LocalizableMessage.raw("Calculate max response time for a percentile of operations")) + .multiValued() + .range(0, 100) + .valuePlaceholder(LocalizableMessage.raw("{percentile}")) + .buildAndAddToParser(argParser); keepConnectionsOpen = - new BooleanArgument("keepConnectionsOpen", 'f', "keepConnectionsOpen", - LocalizableMessage.raw("Keep connections open")); - keepConnectionsOpen.setPropertyName("keepConnectionsOpen"); - argParser.addArgument(keepConnectionsOpen); - + BooleanArgument.builder("keepConnectionsOpen") + .shortIdentifier('f') + .description(LocalizableMessage.raw("Keep connections open")) + .buildAndAddToParser(argParser); noRebindArgument = - new BooleanArgument("noRebind", 'F', "noRebind", LocalizableMessage - .raw("Keep connections open and do not rebind")); - noRebindArgument.setPropertyName("noRebind"); + BooleanArgument.builder("noRebind") + .shortIdentifier('F') + .description(LocalizableMessage.raw("Keep connections open and do not rebind")) + .buildArgument(); if (options.supportsRebind()) { argParser.addArgument(noRebindArgument); } - asyncArgument = - new BooleanArgument("asynchronous", 'A', "asynchronous", LocalizableMessage - .raw("Use asynchronous mode and do not " - + "wait for results before sending the next request")); - asyncArgument.setPropertyName("asynchronous"); - if (options.supportsAsynchronousRequests()) { - argParser.addArgument(asyncArgument); - } - arguments = - new StringArgument( - "argument", - 'g', - "argument", - false, - true, - true, - LocalizableMessage.raw("{generator function or static string}"), - null, - null, - LocalizableMessage + StringArgument.builder("argument") + .shortIdentifier('g') + .description(LocalizableMessage .raw("Argument used to evaluate the Java " + "style format strings in program parameters (ie. Base DN, " + "Search Filter). The set of all arguments provided form the " + "the argument list in order. Besides static string " + "arguments, they can be generated per iteration with the " + "following functions: " + StaticUtils.EOL - + DataSource.getUsage())); + + DataSource.getUsage())) + .multiValued() + .valuePlaceholder(LocalizableMessage.raw("{generator function or static string}")) + .buildArgument(); if (options.supportsGeneratorArgument()) { argParser.addArgument(arguments); } @@ -820,12 +361,11 @@ public void handleConnectionClosed() { @Override public synchronized void handleConnectionError(final boolean isDisconnectNotification, final LdapException error) { if (!stopRequested) { - app.errPrintln(LocalizableMessage.raw("Error occurred on one or more connections: " - + error.getResult())); + app.errPrintln(ERROR_RATE_TOOLS_CANNOT_GET_CONNECTION.get(error.getMessage())); if (error.getCause() != null && app.isVerbose()) { error.getCause().printStackTrace(app.getErrorStream()); } - stopRequested = true; + stopTool(true); } } @@ -837,13 +377,12 @@ public void handleUnsolicitedNotification(final ExtendedResult notification) { public final void validate() throws ArgumentException { numConnections = numConnectionsArgument.getIntValue(); numThreads = numThreadsArgument.getIntValue(); - warmUpDuration = warmUpArgument.getIntValue() * 1000L; + warmUpDurationMs = warmUpArgument.getIntValue() * 1000L; maxIterations = maxIterationsArgument.getIntValue() / numConnections / numThreads; - maxDurationTime = maxDurationArgument.getIntValue() * 1000L; - statsInterval = statsIntervalArgument.getIntValue() * 1000; + maxDurationTimeMs = maxDurationArgument.getIntValue() * 1000L; + statsIntervalMs = statsIntervalArgument.getIntValue() * 1000; targetThroughput = targetThroughputArgument.getIntValue(); - isAsync = asyncArgument.isPresent(); noRebind = noRebindArgument.isPresent(); if (!noRebindArgument.isPresent() && this.numThreads > 1) { @@ -851,11 +390,6 @@ public final void validate() throws ArgumentException { "--" + noRebindArgument.getLongIdentifier(), "--" + numThreadsArgument.getLongIdentifier(), "> 1")); } - if (!noRebindArgument.isPresent() && asyncArgument.isPresent()) { - throw new ArgumentException(ERR_TOOL_ARG_NEEDED_WHEN_USING_ARG.get( - "--" + noRebindArgument.getLongIdentifier(), asyncArgument.getLongIdentifier())); - } - if (maxIterationsArgument.isPresent() && maxIterations <= 0) { throw new ArgumentException(ERR_TOOL_NOT_ENOUGH_ITERATIONS.get( "--" + maxIterationsArgument.getLongIdentifier(), numConnections * numThreads, @@ -873,21 +407,22 @@ final DataSource[] getDataSources() { } abstract WorkerThread newWorkerThread(final Connection connection, final ConnectionFactory connectionFactory); - abstract StatsThread newStatsThread(); + abstract StatsThread newStatsThread(final PerformanceRunner performanceRunner, final ConsoleApplication app); - TimerThread newEndTimerThread(final long timeTowait) { - return new TimerThread(timeTowait); + TimerThread newEndTimerThread(final long timeToWait) { + return new TimerThread(timeToWait); } final int run(final ConnectionFactory connectionFactory) { final List connections = new ArrayList<>(); + statsThread = newStatsThread(this, app); - Connection connection = null; try { - isWarmingUp = warmUpDuration > 0; + validateCanConnectToServer(connectionFactory); for (int i = 0; i < numConnections; i++) { + Connection connection = null; if (keepConnectionsOpen.isPresent() || noRebindArgument.isPresent()) { - connection = connectionFactory.getConnectionAsync().getOrThrow(); + connection = connectionFactory.getConnection(); connection.addConnectionEventListener(this); connections.add(connection); } @@ -898,29 +433,17 @@ final int run(final ConnectionFactory connectionFactory) { } } - if (maxDurationTime > 0) { - newEndTimerThread(maxDurationTime).start(); + if (maxDurationTimeMs > 0) { + newEndTimerThread(maxDurationTimeMs).start(); } - final StatsThread statsThread = newStatsThread(); - - if (isWarmingUp) { - if (!app.isScriptFriendly()) { - app.println(INFO_TOOL_WARMING_UP.get(warmUpDuration / 1000)); - } - Thread.sleep(warmUpDuration); - statsThread.resetStats(); - isWarmingUp = false; - } - - statsThread.start(); + statsThread.startReporting(); joinAllWorkerThreads(); - stopRequested = true; - statsThread.join(); + stopTool(); } catch (final InterruptedException e) { - stopRequested = true; + stopTool(true); } catch (final LdapException e) { - stopRequested = true; + stopTool(true); printErrorMessage(app, e); return e.getResult().getResultCode().intValue(); } finally { @@ -930,12 +453,24 @@ final int run(final ConnectionFactory connectionFactory) { return 0; } - void setBindRequest(final BindRequest request) { - this.bindRequest = request; + // detects wrong bind parameters, server unreachable (server down, network problem?), etc. + private void validateCanConnectToServer(ConnectionFactory connectionFactory) throws LdapException { + connectionFactory.getConnection().close(); } - BindRequest getBindRequest() { - return bindRequest; + synchronized void stopTool() { + stopTool(false); + } + + synchronized void stopTool(final boolean stoppedByError) { + if (!stopRequested) { + stopRequested = true; + statsThread.stopRecording(stoppedByError); + } + } + + void setBindRequest(final BindRequest request) { + this.bindRequest = request; } protected void joinAllWorkerThreads() throws InterruptedException { @@ -943,4 +478,26 @@ protected void joinAllWorkerThreads() throws InterruptedException { t.join(); } } + + double[] getPercentiles() { + if (percentilesArgument.isPresent()) { + double[] percentiles = new double[percentilesArgument.getValues().size()]; + int index = 0; + for (final String percentile : percentilesArgument.getValues()) { + percentiles[index++] = Double.parseDouble(percentile); + } + Arrays.sort(percentiles); + return percentiles; + } + + return DEFAULT_PERCENTILES; + } + + long getWarmUpDurationMs() { + return warmUpDurationMs; + } + + long getStatsInterval() { + return statsIntervalMs; + } } diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerOptions.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerOptions.java index f4585deda..42b4032f6 100644 --- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerOptions.java +++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerOptions.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Portions Copyright 2014-2015 ForgeRock AS + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; @@ -37,7 +27,6 @@ class PerformanceRunnerOptions { private ConsoleApplication app; private boolean supportsRebind = true; - private boolean supportAsynchronousRequests = true; private boolean supportsMultipleThreadsPerConnection = true; private boolean supportsGeneratorArgument = true; @@ -54,14 +43,6 @@ void setSupportsRebind(boolean supportsRebind) { this.supportsRebind = supportsRebind; } - boolean supportsAsynchronousRequests() { - return supportAsynchronousRequests; - } - - void setSupportsAsynchronousRequests(boolean supportAsynchronousRequests) { - this.supportAsynchronousRequests = supportAsynchronousRequests; - } - boolean supportsMultipleThreadsPerConnection() { return supportsMultipleThreadsPerConnection; } diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SdkVersionHandler.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SdkVersionHandler.java deleted file mode 100644 index 867878104..000000000 --- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SdkVersionHandler.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2015 ForgeRock AS - */ -package com.forgerock.opendj.ldap.tools; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Enumeration; -import java.util.jar.Attributes; -import java.util.jar.Manifest; - -import com.forgerock.opendj.cli.VersionHandler; - -/** Class that prints the version of the SDK to System.out. */ -public class SdkVersionHandler implements VersionHandler { - - @Override - public void printVersion() { - System.out.println(getVersion()); - } - - @Override - public String toString() { - return getClass().getSimpleName() + "(" + getVersion() + ")"; - } - - private String getVersion() { - try { - final Enumeration manifests = getClass().getClassLoader().getResources("META-INF/MANIFEST.MF"); - while (manifests.hasMoreElements()) { - final URL manifestUrl = manifests.nextElement(); - if (manifestUrl.toString().contains("/opendj-core-")) { - try (InputStream manifestStream = manifestUrl.openStream()) { - final Attributes attrs = new Manifest(manifestStream).getMainAttributes(); - return attrs.getValue("Bundle-Version") + " (revision " + attrs.getValue("SCM-Revision") + ")"; - } - } - } - return null; - } catch (IOException e) { - throw new RuntimeException("IOException while determining SDK version", e); - } - } -} diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java index 509d33880..b0f839b70 100644 --- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java +++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/SearchRate.java @@ -1,40 +1,35 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; import static com.forgerock.opendj.cli.ArgumentConstants.*; +import static com.forgerock.opendj.cli.MultiColumnPrinter.column; +import static com.forgerock.opendj.cli.ToolVersionHandler.newSdkVersionHandler; import static com.forgerock.opendj.cli.Utils.*; import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; +import static com.forgerock.opendj.cli.CommonArguments.*; import java.util.ArrayList; +import java.util.Collections; import java.util.LinkedList; import java.util.List; -import java.util.concurrent.atomic.AtomicInteger; +import com.codahale.metrics.RatioGauge; +import com.forgerock.opendj.cli.MultiColumnPrinter; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.opendj.ldap.Connection; import org.forgerock.opendj.ldap.ConnectionFactory; @@ -53,7 +48,6 @@ import com.forgerock.opendj.cli.ArgumentException; import com.forgerock.opendj.cli.ArgumentParser; import com.forgerock.opendj.cli.BooleanArgument; -import com.forgerock.opendj.cli.CommonArguments; import com.forgerock.opendj.cli.ConnectionFactoryProvider; import com.forgerock.opendj.cli.ConsoleApplication; import com.forgerock.opendj.cli.MultiChoiceArgument; @@ -65,15 +59,14 @@ */ public final class SearchRate extends ConsoleApplication { private final class SearchPerformanceRunner extends PerformanceRunner { - private final class SearchStatsHandler extends UpdateStatsResultHandler implements - SearchResultHandler { + private final class SearchStatsHandler extends UpdateStatsResultHandler implements SearchResultHandler { private SearchStatsHandler(final long startTime) { super(startTime); } @Override public boolean handleEntry(final SearchResultEntry entry) { - entryRecentCount.getAndIncrement(); + entryCount.inc(); return true; } @@ -84,23 +77,28 @@ public boolean handleReference(final SearchResultReference reference) { } private final class SearchStatsThread extends StatsThread { - private final String[] extraColumn = new String[1]; + private static final int ENTRIES_PER_SEARCH_COLUMN_WIDTH = 5; + private static final String ENTRIES_PER_SEARCH = STAT_ID_PREFIX + "entries_per_search"; - private SearchStatsThread() { - super("Entries/Srch"); + private SearchStatsThread(final PerformanceRunner perfRunner, final ConsoleApplication app) { + super(perfRunner, app); } @Override - void resetStats() { - super.resetStats(); - entryRecentCount.set(0); + void resetAdditionalStats() { + entryCount = newIntervalCounter(); } @Override - String[] getAdditionalColumns() { - final int entryCount = entryRecentCount.getAndSet(0); - extraColumn[0] = getDivisionResult(entryCount, intervalSuccessCount, 1, "0.0"); - return extraColumn; + List registerAdditionalColumns() { + registry.register(ENTRIES_PER_SEARCH, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of(entryCount.refreshIntervalCount(), successCount.getLastIntervalCount()); + } + }); + return Collections.singletonList( + column(ENTRIES_PER_SEARCH, "Entries/Srch", ENTRIES_PER_SEARCH_COLUMN_WIDTH, 1)); } } @@ -115,7 +113,7 @@ private SearchWorkerThread(final Connection connection, @Override public Promise performOperation(final Connection connection, - final DataSource[] dataSources, final long startTime) { + final DataSource[] dataSources, final long currentTimeNs) { if (sr == null) { if (dataSources == null) { sr = Requests.newSearchRequest(baseDN, scope, filter, attributes); @@ -132,7 +130,7 @@ public Promise performOperation(final Connection connection, sr.setName(String.format(baseDN, data)); } - final SearchStatsHandler handler = new SearchStatsHandler(startTime); + final SearchStatsHandler handler = new SearchStatsHandler(currentTimeNs); incrementIterationCount(); return connection.searchAsync(sr, handler).thenOnResult(handler).thenOnException(handler); } @@ -156,8 +154,8 @@ WorkerThread newWorkerThread(final Connection connection, } @Override - StatsThread newStatsThread() { - return new SearchStatsThread(); + StatsThread newStatsThread(final PerformanceRunner performanceRunner, final ConsoleApplication app) { + return new SearchStatsThread(performanceRunner, app); } } @@ -167,17 +165,14 @@ StatsThread newStatsThread() { * @param args * The command-line arguments provided to this program. */ - public static void main(final String[] args) { final int retCode = new SearchRate().run(args); System.exit(filterExitCode(retCode)); } private BooleanArgument verbose; - private BooleanArgument scriptFriendly; - - private final AtomicInteger entryRecentCount = new AtomicInteger(); + private StatsThread.IntervalCounter entryCount = StatsThread.newIntervalCounter(); private SearchRate() { // Nothing to do. @@ -204,7 +199,7 @@ private int run(final String[] args) { final ArgumentParser argParser = new ArgumentParser(SearchRate.class.getName(), toolDescription, false, true, 1, 0, "[filter format string] [attributes ...]"); - argParser.setVersionHandler(new SdkVersionHandler()); + argParser.setVersionHandler(newSdkVersionHandler()); argParser.setShortToolDescription(REF_SHORT_DESC_SEARCHRATE.get()); argParser.setDocToolDescriptionSupplement(SUPPLEMENT_DESCRIPTION_RATE_TOOLS.get()); @@ -224,45 +219,46 @@ private int run(final String[] args) { connectionFactoryProvider = new ConnectionFactoryProvider(argParser, this); runner = new SearchPerformanceRunner(new PerformanceRunnerOptions(argParser, this)); - propertiesFileArgument = CommonArguments.getPropertiesFile(); + propertiesFileArgument = propertiesFileArgument(); argParser.addArgument(propertiesFileArgument); argParser.setFilePropertiesArgument(propertiesFileArgument); - noPropertiesFileArgument = CommonArguments.getNoPropertiesFile(); + noPropertiesFileArgument = noPropertiesFileArgument(); argParser.addArgument(noPropertiesFileArgument); argParser.setNoPropertiesFileArgument(noPropertiesFileArgument); - showUsage = CommonArguments.getShowUsage(); + showUsage = showUsageArgument(); argParser.addArgument(showUsage); argParser.setUsageArgument(showUsage, getOutputStream()); baseDN = - new StringArgument("baseDN", OPTION_SHORT_BASEDN, OPTION_LONG_BASEDN, true, - false, true, INFO_BASEDN_PLACEHOLDER.get(), null, null, - INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get()); - baseDN.setPropertyName(OPTION_LONG_BASEDN); - argParser.addArgument(baseDN); - - searchScope = CommonArguments.getSearchScope(); + StringArgument.builder(OPTION_LONG_BASEDN) + .shortIdentifier(OPTION_SHORT_BASEDN) + .description(INFO_SEARCHRATE_TOOL_DESCRIPTION_BASEDN.get()) + .required() + .valuePlaceholder(INFO_BASEDN_PLACEHOLDER.get()) + .buildAndAddToParser(argParser); + + searchScope = searchScopeArgument(); argParser.addArgument(searchScope); dereferencePolicy = - new MultiChoiceArgument<>("derefpolicy", 'a', - "dereferencePolicy", false, true, INFO_DEREFERENCE_POLICE_PLACEHOLDER - .get(), DereferenceAliasesPolicy.values(), false, - INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get()); - dereferencePolicy.setPropertyName("dereferencePolicy"); - dereferencePolicy.setDefaultValue(DereferenceAliasesPolicy.NEVER); - argParser.addArgument(dereferencePolicy); - - verbose = CommonArguments.getVerbose(); + MultiChoiceArgument.builder("dereferencePolicy") + .shortIdentifier('a') + .description(INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY.get()) + .allowedValues(DereferenceAliasesPolicy.values()) + .defaultValue(DereferenceAliasesPolicy.NEVER) + .valuePlaceholder(INFO_DEREFERENCE_POLICE_PLACEHOLDER.get()) + .buildAndAddToParser(argParser); + + verbose = verboseArgument(); argParser.addArgument(verbose); scriptFriendly = - new BooleanArgument("scriptFriendly", 'S', "scriptFriendly", - INFO_DESCRIPTION_SCRIPT_FRIENDLY.get()); - scriptFriendly.setPropertyName("scriptFriendly"); - argParser.addArgument(scriptFriendly); + BooleanArgument.builder("scriptFriendly") + .shortIdentifier('S') + .description(INFO_DESCRIPTION_SCRIPT_FRIENDLY.get()) + .buildAndAddToParser(argParser); } catch (final ArgumentException ae) { final LocalizableMessage message = ERR_CANNOT_INITIALIZE_ARGS.get(ae.getMessage()); errPrintln(message); diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StatsThread.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StatsThread.java new file mode 100644 index 000000000..573ca8736 --- /dev/null +++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/StatsThread.java @@ -0,0 +1,418 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2016 ForgeRock AS. + */ +package com.forgerock.opendj.ldap.tools; + +import static com.forgerock.opendj.cli.MultiColumnPrinter.column; +import static com.forgerock.opendj.cli.MultiColumnPrinter.separatorColumn; +import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_TOOL_WARMING_UP; +import static java.util.concurrent.TimeUnit.MILLISECONDS; + +import java.lang.management.GarbageCollectorMXBean; +import java.lang.management.ManagementFactory; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.SortedMap; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +import com.codahale.metrics.Counter; +import com.codahale.metrics.Gauge; +import com.codahale.metrics.Histogram; +import com.codahale.metrics.Meter; +import com.codahale.metrics.MetricFilter; +import com.codahale.metrics.MetricRegistry; +import com.codahale.metrics.RatioGauge; +import com.codahale.metrics.ScheduledReporter; +import com.codahale.metrics.Timer; +import com.forgerock.opendj.cli.ConsoleApplication; +import com.forgerock.opendj.cli.MultiColumnPrinter; +import org.mpierce.metrics.reservoir.hdrhistogram.HdrHistogramReservoir; + +/** + * Statistics thread base implementation. + *

+ * The goal of this class is to compute and print rate tool general statistics. + */ +class StatsThread extends Thread { + + static final String STAT_ID_PREFIX = "org.forgerock.opendj."; + + private static final String TIME_NOW = STAT_ID_PREFIX + "current_time"; + private static final String RECENT_THROUGHPUT = STAT_ID_PREFIX + "recent_throughput"; + private static final String AVERAGE_THROUGHPUT = STAT_ID_PREFIX + "average_throughput"; + private static final String RECENT_RESPONSE_TIME_MS = STAT_ID_PREFIX + "recent_response_time"; + private static final String AVERAGE_RESPONSE_TIME_MS = STAT_ID_PREFIX + "average_response_time"; + private static final String PERCENTILES = STAT_ID_PREFIX + "percentiles"; + private static final String ERROR_PER_SECOND = STAT_ID_PREFIX + "error_per_second"; + + public static final double MS_IN_S = TimeUnit.SECONDS.toMillis(1); + public static final double NS_IN_MS = TimeUnit.MILLISECONDS.toNanos(1); + + private abstract class RateReporter extends ScheduledReporter { + final MultiColumnPrinter printer; + + private RateReporter() { + super(registry, "", MetricFilter.ALL, TimeUnit.SECONDS, TimeUnit.MILLISECONDS); + printer = createPrinter(); + } + + abstract MultiColumnPrinter createPrinter(); + abstract void printTitle(); + + @Override + @SuppressWarnings({ "rawtypes", "unchecked" }) + public void report(final SortedMap gauges, + final SortedMap counters, + final SortedMap histograms, + final SortedMap meters, + final SortedMap timers) { + int percentileIndex = 0; + for (final MultiColumnPrinter.Column column : printer.getColumns()) { + final String statKey = column.getId(); + if (gauges.containsKey(statKey)) { + printer.printData(((Gauge) gauges.get(statKey)).getValue()); + } else if (statKey.startsWith(PERCENTILES)) { + final double quantile = percentiles[percentileIndex++] / 100.0; + printer.printData( + histograms.get(PERCENTILES).getSnapshot().getValue(quantile) / MILLISECONDS.toNanos(1)); + } else { + printer.printData("-"); + } + } + } + } + + private final class ConsoleRateReporter extends RateReporter { + private static final int STANDARD_WIDTH = 8; + private List additionalColumns; + + @Override + void printTitle() { + final int throughputRawSpan = 2; + final int responseTimeRawSpan = 2 + percentiles.length; + final int additionalStatsRawSpan = 1 + additionalColumns.size(); + + printer.printDashedLine(); + printer.printTitleSection("Throughput", throughputRawSpan); + printer.printTitleSection("Response Time", responseTimeRawSpan); + printer.printTitleSection(additionalStatsRawSpan > 1 ? "Additional" : "", additionalStatsRawSpan); + printer.printTitleSection("(ops/second)", throughputRawSpan); + printer.printTitleSection("(milliseconds)", responseTimeRawSpan); + printer.printTitleSection(additionalStatsRawSpan > 1 ? "Statistics" : "", additionalStatsRawSpan); + printer.printTitleLine(); + printer.printDashedLine(); + } + + @Override + MultiColumnPrinter createPrinter() { + final List columns = new ArrayList<>(); + // Throughput (ops/sec) + columns.add(separatorColumn()); + columns.add(column(RECENT_THROUGHPUT, "recent", STANDARD_WIDTH, 1)); + columns.add(column(AVERAGE_THROUGHPUT, "average", STANDARD_WIDTH, 1)); + // Response Time (ms) + columns.add(separatorColumn()); + columns.add(column(RECENT_RESPONSE_TIME_MS, "recent", STANDARD_WIDTH, 3)); + columns.add(column(AVERAGE_RESPONSE_TIME_MS, "average", STANDARD_WIDTH, 3)); + for (double percentile : percentiles) { + columns.add(column(PERCENTILES + percentile, percentile + "%", STANDARD_WIDTH, 2)); + } + // Additional stats + columns.add(separatorColumn()); + columns.add(column(ERROR_PER_SECOND, "err/sec", STANDARD_WIDTH, 1)); + additionalColumns = registerAdditionalColumns(); + if (!additionalColumns.isEmpty()) { + columns.addAll(additionalColumns); + } + columns.add(separatorColumn()); + + + return MultiColumnPrinter.builder(app.getOutputStream(), columns) + .format(true) + .titleAlignment(MultiColumnPrinter.Alignment.CENTER) + .build(); + } + } + + private final class CsvRateReporter extends RateReporter { + @Override + void printTitle() { + printer.printTitleLine(); + } + + @Override + MultiColumnPrinter createPrinter() { + final List columns = new ArrayList<>(); + columns.add(column(TIME_NOW, "time", 3)); + columns.add(column(RECENT_THROUGHPUT, "recent throughput", 1)); + columns.add(column(AVERAGE_THROUGHPUT, "average throughput", 1)); + columns.add(column(RECENT_RESPONSE_TIME_MS, "recent response time", 3)); + columns.add(column(AVERAGE_RESPONSE_TIME_MS, "average response time", 3)); + for (double percentile : percentiles) { + columns.add(column( + PERCENTILES + percentile, percentile + "% response time", 2)); + } + columns.add(column(ERROR_PER_SECOND, "errors/second", 1)); + columns.addAll(registerAdditionalColumns()); + + + return MultiColumnPrinter.builder(app.getOutputStream(), columns) + .columnSeparator(",") + .build(); + } + } + + /** A timer to prevent adding temporary variables in {@link StatsThread#run()}. **/ + private static abstract class StatsTimer { + private long startTimeMeasure; + private long elapsed; + + abstract long getInstantTime(); + + private void start() { + startTimeMeasure = getInstantTime(); + } + + private long reset() { + final long time = getInstantTime(); + elapsed = time - this.startTimeMeasure; + this.startTimeMeasure = time; + + return elapsed; + } + + private long elapsed() { + return elapsed; + } + } + + /** A counter to prevent adding temporary variables in {@link StatsThread#run()}. **/ + static final class IntervalCounter extends Counter { + private long lastIntervalCount; + private long lastTotalCount; + + long refreshIntervalCount() { + final long totalCount = getCount(); + lastIntervalCount = totalCount - lastTotalCount; + lastTotalCount = totalCount; + return lastIntervalCount; + } + + long getLastIntervalCount() { + return lastIntervalCount; + } + + long getLastTotalCount() { + return lastTotalCount; + } + } + + static final IntervalCounter newIntervalCounter() { + return new IntervalCounter(); + } + + + final MetricRegistry registry = new MetricRegistry(); + private final Histogram responseTimes = new Histogram(new HdrHistogramReservoir()); + + private final StatsTimer gcTimerMs = new StatsTimer() { + private final List gcBeans = ManagementFactory.getGarbageCollectorMXBeans(); + + @Override + long getInstantTime() { + long gcDurationMs = 0; + for (final GarbageCollectorMXBean bean : gcBeans) { + gcDurationMs += bean.getCollectionTime(); + } + + return gcDurationMs; + } + }; + + private final StatsTimer timerMs = new StatsTimer() { + @Override + long getInstantTime() { + return System.currentTimeMillis(); + } + }; + + IntervalCounter waitDurationNsCount; + IntervalCounter successCount; + private IntervalCounter operationCount; + private IntervalCounter errorCount; + private IntervalCounter durationMsCount; + + private final ConsoleApplication app; + private final double[] percentiles; + private final PerformanceRunner performanceRunner; + private final RateReporter reporter; + private long startTimeMs; + private volatile boolean warmingUp; + private final ScheduledExecutorService statThreadScheduler = Executors.newSingleThreadScheduledExecutor(); + + StatsThread(final PerformanceRunner performanceRunner, final ConsoleApplication application) { + super("Stats Thread"); + resetStats(); + this.performanceRunner = performanceRunner; + this.app = application; + this.percentiles = performanceRunner.getPercentiles(); + this.reporter = app.isScriptFriendly() ? new CsvRateReporter() + : new ConsoleRateReporter(); + registerStats(); + } + + /** Resets both general and recent statistic indicators. */ + final void resetStats() { + errorCount = newIntervalCounter(); + operationCount = newIntervalCounter(); + successCount = newIntervalCounter(); + waitDurationNsCount = newIntervalCounter(); + durationMsCount = newIntervalCounter(); + resetAdditionalStats(); + } + + private void registerStats() { + if (app.isScriptFriendly()) { + registry.register(TIME_NOW, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of(System.currentTimeMillis() - startTimeMs, MS_IN_S); + } + }); + } + + registry.register(RECENT_THROUGHPUT, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of(successCount.getLastIntervalCount() + errorCount.getLastIntervalCount(), + durationMsCount.getLastIntervalCount() / MS_IN_S); + } + }); + + registry.register(AVERAGE_THROUGHPUT, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of(successCount.getLastTotalCount() + errorCount.getLastTotalCount(), + durationMsCount.getLastTotalCount() / MS_IN_S); + } + }); + + registry.register(RECENT_RESPONSE_TIME_MS, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of((waitDurationNsCount.getLastIntervalCount() / NS_IN_MS) - gcTimerMs.elapsed(), + successCount.getLastIntervalCount() + errorCount.getLastIntervalCount()); + } + }); + + registry.register(AVERAGE_RESPONSE_TIME_MS, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of((waitDurationNsCount.getLastTotalCount() / NS_IN_MS) - gcTimerMs.getInstantTime(), + successCount.getLastTotalCount() + errorCount.getLastTotalCount()); + } + }); + + registry.register(ERROR_PER_SECOND, new RatioGauge() { + @Override + protected Ratio getRatio() { + return Ratio.of(errorCount.getLastIntervalCount(), durationMsCount.getLastIntervalCount() / MS_IN_S); + } + }); + registry.register(PERCENTILES, responseTimes); + } + + void startReporting() throws InterruptedException { + warmUp(); + init(); + final long statsIntervalMs = performanceRunner.getStatsInterval(); + statThreadScheduler.scheduleAtFixedRate(this, statsIntervalMs, statsIntervalMs, TimeUnit.MILLISECONDS); + } + + private void warmUp() throws InterruptedException { + final long warmUpDurationMs = performanceRunner.getWarmUpDurationMs(); + if (warmUpDurationMs > 0) { + if (!app.isScriptFriendly()) { + app.println(INFO_TOOL_WARMING_UP.get(warmUpDurationMs / TimeUnit.SECONDS.toMillis(1))); + } + Thread.sleep(warmUpDurationMs); + resetStats(); + } + warmingUp = false; + } + + private void init() { + reporter.printTitle(); + timerMs.start(); + gcTimerMs.start(); + startTimeMs = System.currentTimeMillis(); + } + + public void stopRecording(final boolean stoppedByError) { + statThreadScheduler.shutdown(); + if (!stoppedByError) { + // If stats thread is printing stats, wait for it to finish and print a last line of stats. + try { + statThreadScheduler.awaitTermination(50, TimeUnit.MILLISECONDS); + } catch (InterruptedException ignored) { + // Do nothing. + } + run(); + } + } + + /** Performs stat snapshots and reports results to application. */ + @Override + public void run() { + durationMsCount.inc(timerMs.reset() - gcTimerMs.reset()); + durationMsCount.refreshIntervalCount(); + operationCount.refreshIntervalCount(); + successCount.refreshIntervalCount(); + errorCount.refreshIntervalCount(); + waitDurationNsCount.refreshIntervalCount(); + + reporter.report(); + } + + void addResponseTime(final long responseTimeNs) { + if (!warmingUp) { + waitDurationNsCount.inc(responseTimeNs); + responseTimes.update(responseTimeNs); + } + } + + void incrementFailedCount() { + errorCount.inc(); + } + + void incrementSuccessCount() { + successCount.inc(); + } + + void incrementOperationCount() { + operationCount.inc(); + } + + /** Child classes which manage additional stats need to override this method. */ + List registerAdditionalColumns() { + return Collections.emptyList(); + } + + /** Do nothing by default, child classes which manage additional stats need to override this method. */ + void resetAdditionalStats() { } +} diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java index 7467ccca1..8b0a85396 100644 --- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java +++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/Utils.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; @@ -141,7 +131,7 @@ static GenericControl getControl(final String argString) throws DecodeException final String valString = remainder.substring(idx + 1, remainder.length()); if (valString.charAt(0) == ':') { - controlValue = ByteString.valueOfUtf8(valString.substring(1, valString.length())); + controlValue = ByteString.valueOfBase64(valString.substring(1, valString.length())); } else if (valString.charAt(0) == '<') { // Read data from the file. final String filePath = valString.substring(1, valString.length()); diff --git a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java old mode 100755 new mode 100644 index fdb5da3a2..1b7848b56 --- a/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java +++ b/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/package-info.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ /** diff --git a/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties b/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties old mode 100755 new mode 100644 index 827f83f03..eb1b3ca40 --- a/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties +++ b/opendj-ldap-toolkit/src/main/resources/com/forgerock/opendj/ldap/tools/tools.properties @@ -1,149 +1,20 @@ # -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2010 Sun Microsystems, Inc. -# Portions copyright 2012-2015 ForgeRock AS. -# -# -# Utility messages -# -ERR_ARG_NO_IDENTIFIER=The %s argument does not have either a \ - single-character or a long identifier that may be used to specify it. At \ - least one of these must be specified for each argument -ERR_ARG_NO_VALUE_PLACEHOLDER=The %s argument is configured to take \ - a value but no value placeholder has been defined for it -ERR_ARG_NO_INT_VALUE=The %s argument does not have any value that \ - may be retrieved as an integer -ERR_ARG_CANNOT_DECODE_AS_INT=The provided value "%s" for the %s \ - argument cannot be decoded as an integer -ERR_ARG_INT_MULTIPLE_VALUES=The %s argument has multiple values and \ - therefore cannot be decoded as a single integer value -ERR_ARG_NO_BOOLEAN_VALUE=The %s argument does not have any value \ - that may be retrieved as a Boolean -ERR_ARG_CANNOT_DECODE_AS_BOOLEAN=The provided value "%s" for the %s \ - argument cannot be decoded as a Boolean -ERR_ARG_BOOLEAN_MULTIPLE_VALUES=The %s argument has multiple values \ - and therefore cannot be decoded as a single Boolean value -ERR_INTARG_LOWER_BOUND_ABOVE_UPPER_BOUND=The %s argument \ - configuration is invalid because the lower bound of %d is greater than the \ - upper bound of %d -ERR_INTARG_VALUE_BELOW_LOWER_BOUND=The provided %s value %d is \ - unacceptable because it is below the lower bound of %d -ERR_INTARG_VALUE_ABOVE_UPPER_BOUND=The provided %s value %d is \ - unacceptable because it is above the upper bound of %d -ERR_BOOLEANARG_NO_VALUE_ALLOWED=The provided %s value is \ - unacceptable because Boolean arguments are never allowed to have values -ERR_MCARG_VALUE_NOT_ALLOWED=The provided %s value %s is \ - unacceptable because it is not included in the set of allowed values for that \ - argument -ERR_FILEARG_NO_SUCH_FILE=The file %s specified for argument %s does \ - not exist -ERR_FILEARG_CANNOT_VERIFY_FILE_EXISTENCE=An error occurred while \ - trying to verify the existence of file %s specified for argument %s: %s -ERR_FILEARG_CANNOT_OPEN_FILE=An error occurred while trying to open \ - file %s specified for argument %s for reading: %s -ERR_FILEARG_CANNOT_READ_FILE=An error occurred while trying to read \ - from file %s specified for argument %s: %s -ERR_FILEARG_EMPTY_FILE=The file %s specified for argument %s exists \ - but is empty -ERR_ARGPARSER_DUPLICATE_SHORT_ID=Cannot add argument %s to the \ - argument list because its short identifier -%s conflicts with the %s argument \ - that has already been defined -ERR_ARGPARSER_DUPLICATE_LONG_ID=Cannot add argument %s to the \ - argument list because its long identifier --%s conflicts with the %s argument \ - that has already been defined -ERR_ARGPARSER_CANNOT_READ_PROPERTIES_FILE=An error occurred while \ - attempting to read the contents of the argument properties file %s: %s -ERR_ARGPARSER_TOO_MANY_TRAILING_ARGS=The provided set of \ - command-line arguments contained too many unnamed trailing arguments. The \ - maximum number of allowed trailing arguments is %d -ERR_ARGPARSER_LONG_ARG_WITHOUT_NAME=The provided argument "%s" is \ - invalid because it does not include the argument name -ERR_ARGPARSER_NO_ARGUMENT_WITH_LONG_ID=Argument --%s is not allowed \ - for use with this program -ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_LONG_ID=Argument --%s \ - requires a value but none was provided -ERR_ARGPARSER_VALUE_UNACCEPTABLE_FOR_LONG_ID=The provided value \ - "%s" for argument --%s is not acceptable: %s -ERR_ARGPARSER_NOT_MULTIVALUED_FOR_LONG_ID=The argument --%s was \ - included multiple times in the provided set of arguments but it does not \ - allow multiple values -ERR_ARGPARSER_ARG_FOR_LONG_ID_DOESNT_TAKE_VALUE=A value was \ - provided for argument --%s but that argument does not take a value -ERR_ARGPARSER_INVALID_DASH_AS_ARGUMENT=The dash character by itself \ - is invalid for use as an argument name -ERR_ARGPARSER_NO_ARGUMENT_WITH_SHORT_ID=Argument -%s is not allowed \ - for use with this program -ERR_ARGPARSER_NO_VALUE_FOR_ARGUMENT_WITH_SHORT_ID=Argument -%s \ - requires a value but none was provided -ERR_ARGPARSER_VALUE_UNACCEPTABLE_FOR_SHORT_ID=The provided value \ - "%s" for argument -%s is not acceptable: %s -ERR_ARGPARSER_NOT_MULTIVALUED_FOR_SHORT_ID=The argument -%s was \ - included multiple times in the provided set of arguments but it does not \ - allow multiple values -ERR_ARGPARSER_CANT_MIX_ARGS_WITH_VALUES=The provided argument block \ - '-%s%s' is illegal because the '%s' argument requires a value but is in the \ - same block as at least one other argument that doesn't require a value -ERR_ARGPARSER_DISALLOWED_TRAILING_ARGUMENT=Argument "%s" does not \ - start with one or two dashes and unnamed trailing arguments are not allowed -ERR_ARGPARSER_TOO_FEW_TRAILING_ARGUMENTS=At least %d unnamed \ - trailing arguments are required in the argument list, but too few were \ - provided -ERR_ARGPARSER_NO_VALUE_FOR_REQUIRED_ARG=The argument %s is required \ - to have a value but none was provided in the argument list and no default \ - value is available -INFO_TIME_IN_SECONDS=%d seconds -INFO_TIME_IN_MINUTES_SECONDS=%d minutes, %d seconds -INFO_TIME_IN_HOURS_MINUTES_SECONDS=%d hours, %d minutes, %d seconds -INFO_TIME_IN_DAYS_HOURS_MINUTES_SECONDS=%d days, %d hours, %d minutes, %d \ - seconds -INFO_SUBCMDPARSER_WHERE_OPTIONS_INCLUDE=Command options: -ERR_MENU_BAD_CHOICE_SINGLE=Invalid response. Please enter a valid \ -menu option -INFO_MENU_PROMPT_SINGLE=Enter choice: -INFO_MENU_PROMPT_RETURN_TO_CONTINUE=Press RETURN to continue -ERR_CONSOLE_INPUT_ERROR=The response could not be read from the console due to the following error: %s -INFO_LDAP_CONN_PROMPT_SECURITY_SERVER_CERTIFICATE=Server Certificate: -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE=%s -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION=Do you trust this server certificate? -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_NO=No -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_SESSION=Yes, for this session only -INFO_LDAP_CONN_PROMPT_SECURITY_TRUST_OPTION_ALWAYS=Yes, also add it to a truststore -INFO_LDAP_CONN_PROMPT_SECURITY_CERTIFICATE_DETAILS=View certificate details -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_USER_DN=User DN : %s -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_VALIDITY=Validity : From '%s'%n To '%s' -INFO_LDAP_CONN_SECURITY_SERVER_CERTIFICATE_ISSUER=Issuer : %s -INFO_PROMPT_SINGLE_DEFAULT=%s [%s]: -INFO_ARGPARSER_USAGE_JAVA_CLASSNAME=Usage: java %s {options} -INFO_ARGPARSER_USAGE_JAVA_SCRIPTNAME=Usage: %s {options} -INFO_ARGPARSER_USAGE_TRAILINGARGS={trailing-arguments} -INFO_ARGPARSER_USAGE_DEFAULT_VALUE=Default value: %s -# -# Extension messages -# -# -# Tools messages +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2010 Sun Microsystems, Inc. +# Portions copyright 2012-2016 ForgeRock AS. + +ERROR_RATE_TOOLS_CANNOT_GET_CONNECTION=%s\nStopping... ERR_CANNOT_INITIALIZE_ARGS=An unexpected error occurred while \ attempting to initialize the command-line arguments: %s ERR_ERROR_PARSING_ARGS=An error occurred while parsing the \ @@ -157,50 +28,19 @@ INFO_COMPARE_OPERATION_RESULT_FALSE=Compare operation returned false for \ entry %s INFO_COMPARE_OPERATION_RESULT_TRUE=Compare operation returned true for \ entry %s -INFO_DESCRIPTION_TRUSTALL=Trust all server SSL certificates -INFO_DESCRIPTION_BINDDN=DN to use to bind to the server -INFO_DESCRIPTION_BINDPASSWORD=Password to use to bind to \ - the server -INFO_DESCRIPTION_BINDPASSWORDFILE=Bind password file -INFO_DESCRIPTION_ENCODING=Use the specified character set for \ - command-line input -INFO_DESCRIPTION_VERBOSE=Use verbose mode -INFO_DESCRIPTION_KEYSTOREPATH=Certificate key store path -INFO_DESCRIPTION_TRUSTSTOREPATH=Certificate trust store path -INFO_DESCRIPTION_KEYSTOREPASSWORD=Certificate key store PIN -INFO_DESCRIPTION_HOST=Directory server hostname or IP address -INFO_DESCRIPTION_PORT=Directory server port number -INFO_DESCRIPTION_SHOWUSAGE=Display this usage information INFO_DESCRIPTION_CONTROLS=Use a request control with the provided \ information -INFO_DESCRIPTION_CONTINUE_ON_ERROR=Continue processing even if there are \ - errors -INFO_DESCRIPTION_USE_SSL=Use SSL for secure communication with the server -INFO_DESCRIPTION_START_TLS=Use StartTLS to secure communication with the \ - server -INFO_MODIFY_DESCRIPTION_DEFAULT_ADD=Treat records with no changetype as \ - add operations INFO_SEARCH_DESCRIPTION_BASEDN=Search base DN INFO_SEARCH_DESCRIPTION_SIZE_LIMIT=Maximum number of entries to return \ from the search INFO_SEARCH_DESCRIPTION_TIME_LIMIT=Maximum length of time in seconds to \ allow for the search -INFO_SEARCH_DESCRIPTION_SEARCH_SCOPE=Search scope ('base', 'one', 'sub', \ - or 'subordinate'). Note: 'subordinate' is an LDAP extension \ - that might not work with all LDAP servers INFO_SEARCH_DESCRIPTION_DEREFERENCE_POLICY=Alias dereference policy \ ('never', 'always', 'search', or 'find') -ERR_LDAPAUTH_UNSUPPORTED_SASL_MECHANISM=The requested SASL mechanism \ - "%s" is not supported by this client -ERR_LDAPAUTH_SASL_AUTHID_REQUIRED=The "authid" SASL property is \ - required for use with the %s mechanism -INFO_DESCRIPTION_VERSION=LDAP protocol version number ERR_DESCRIPTION_INVALID_VERSION=Invalid LDAP version number '%s'. \ Allowed values are 2 and 3 ERR_SEARCH_NO_FILTERS=No filters specified for the search request INFO_DESCRIPTION_DONT_WRAP=Do not wrap long lines -INFO_DESCRIPTION_NOOP=Show what would be done but do not perform any \ - operation INFO_DESCRIPTION_TYPES_ONLY=Only retrieve attribute names but not their \ values INFO_DESCRIPTION_ASSERTION_FILTER=Use the LDAP assertion control with the \ @@ -230,7 +70,6 @@ ERR_PSEARCH_INVALID_RETURN_ECS=The provided returnECs value %s is \ invalid. Allowed values are 1 to request that the entry change notification \ control be included in updated entries, or 0 to exclude the control from \ matching entries -INFO_DESCRIPTION_REPORT_AUTHZID=Use the authorization identity control INFO_BIND_AUTHZID_RETURNED=# Bound with authorization ID %s INFO_SEARCH_DESCRIPTION_FILENAME=File containing a list of search filter \ strings @@ -250,7 +89,6 @@ INFO_BIND_ACCOUNT_LOCKED=# Your account has been locked INFO_BIND_MUST_CHANGE_PASSWORD=# You must change your password before any \ other operations will be allowed INFO_BIND_GRACE_LOGINS_REMAINING=# You have %d grace logins remaining -INFO_DESCRIPTION_USE_PWP_CONTROL=Use the password policy request control INFO_LDAPPWMOD_DESCRIPTION_AUTHZID=Authorization ID for the \ user entry whose password should be changed. \ The authorization ID is a string having either \ @@ -295,18 +133,12 @@ INFO_LDAPPWMOD_TOOL_DESCRIPTION=This utility can be used to perform LDAP \ password modify operations in the Directory Server INFO_LDAPSEARCH_TOOL_DESCRIPTION=This utility can be used to perform LDAP \ search operations in the Directory Server -ERR_TOOL_CONFLICTING_ARGS=You may not provide both the --%s and \ - the --%s arguments ERR_LDAPCOMPARE_NO_ATTR=No attribute was specified to use as the \ target for the comparison ERR_LDAPCOMPARE_INVALID_ATTR_STRING=Invalid attribute string '%s'. \ The attribute string must be in one of the following forms: \ 'attribute:value', 'attribute::base64value', or 'attribute: diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AddRateITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AddRateITCase.java index 709dea726..996780706 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AddRateITCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AddRateITCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; @@ -40,6 +30,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +@SuppressWarnings("javadoc") public class AddRateITCase extends ToolsITCase { private static final String TEMPLATE_NAME = "addrate.template"; diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AuthRateITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AuthRateITCase.java index 0f43b80c7..67a817ee7 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AuthRateITCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/AuthRateITCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; @@ -29,7 +19,6 @@ import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_ERROR_PARSING_ARGS; import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_TOOL_WARMING_UP; import static org.fest.assertions.Assertions.assertThat; -import static org.forgerock.util.Utils.closeSilently; import java.io.PrintStream; @@ -38,9 +27,10 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +@SuppressWarnings("javadoc") public class AuthRateITCase extends ToolsITCase { - private static final String THROUGHPUT_TEXT = "Recent throughput (ops/second)"; + private static final String THROUGHPUT_TEXT = "recent throughput"; @DataProvider public Object[][] authRateArgs() throws Exception { @@ -70,10 +60,8 @@ public void testITAuthRate(String[] arguments, Object expectedOut, Object expect ByteStringBuilder out = new ByteStringBuilder(); ByteStringBuilder err = new ByteStringBuilder(); - PrintStream outStream = new PrintStream(out.asOutputStream()); - PrintStream errStream = new PrintStream(err.asOutputStream()); - - try { + try (PrintStream outStream = new PrintStream(out.asOutputStream()); + PrintStream errStream = new PrintStream(err.asOutputStream())) { AuthRate authRate = new AuthRate(outStream, errStream); authRate.run(arguments); @@ -88,10 +76,7 @@ public void testITAuthRate(String[] arguments, Object expectedOut, Object expect String[] authRateLineData = authRateResLines[i].split(","); assertThat(authRateLineData[authRateLineData.length - 1].trim()).isEqualTo("0.0"); } - } - } finally { - closeSilently(outStream, errStream); } } } diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProviderTest.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProviderTest.java index 634a13b73..b3050ce3b 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProviderTest.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ConnectionFactoryProviderTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java index 71b84e5be..0efba742e 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPCompareITCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; @@ -29,7 +19,6 @@ import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_COMPARE_OPERATION_RESULT_FALSE; import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_COMPARE_OPERATION_RESULT_TRUE; import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_LDAPCOMPARE_TOOL_DESCRIPTION; -import static org.forgerock.util.Utils.closeSilently; import java.io.PrintStream; import java.util.Random; @@ -40,6 +29,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; +@SuppressWarnings("javadoc") public class LDAPCompareITCase extends ToolsITCase { private static final int NB_RAND_SIMPLE_COMPARE = 10; @@ -93,16 +83,12 @@ public void testITLDAPSearch(String[] arguments, Object expectedOut, Object expe ByteStringBuilder out = new ByteStringBuilder(); ByteStringBuilder err = new ByteStringBuilder(); - PrintStream outStream = new PrintStream(out.asOutputStream()); - PrintStream errStream = new PrintStream(err.asOutputStream()); - - try { + try (PrintStream outStream = new PrintStream(out.asOutputStream()); + PrintStream errStream = new PrintStream(err.asOutputStream())) { LDAPCompare ldapCompare = new LDAPCompare(outStream, errStream); ldapCompare.run(arguments); checkOuputStreams(out, err, expectedOut, expectedErr); - } finally { - closeSilently(outStream, errStream); } } } diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java index 2fa67a9aa..545c6f0c1 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/LDAPSearchITCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; @@ -30,7 +20,6 @@ import static com.forgerock.opendj.ldap.tools.ToolsMessages.ERR_TOOL_RESULT_CODE; import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_LDAPSEARCH_MATCHING_ENTRY_COUNT; import static com.forgerock.opendj.ldap.tools.ToolsMessages.INFO_LDAPSEARCH_TOOL_DESCRIPTION; -import static org.forgerock.util.Utils.closeSilently; import java.io.PrintStream; import java.util.Random; @@ -42,9 +31,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Simple integration tests to check the ldapsearch command. - */ +/** Simple integration tests to check the ldapsearch command. */ @SuppressWarnings("javadoc") public class LDAPSearchITCase extends ToolsITCase { private static final int NB_RAND_SIMPLE_SEARCH = 10; @@ -90,16 +77,11 @@ public void testITLDAPSearch(String[] arguments, Object expectedOut, Object expe ByteStringBuilder out = new ByteStringBuilder(); ByteStringBuilder err = new ByteStringBuilder(); - PrintStream outStream = new PrintStream(out.asOutputStream()); - PrintStream errStream = new PrintStream(err.asOutputStream()); - try { + try (PrintStream outStream = new PrintStream(out.asOutputStream()); + PrintStream errStream = new PrintStream(err.asOutputStream())) { LDAPSearch ldapSearch = new LDAPSearch(outStream, errStream); - - ldapSearch.run(arguments, false); + ldapSearch.run(arguments); checkOuputStreams(out, err, expectedOut, expectedErr); - } finally { - closeSilently(outStream, errStream); } } - } diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java index a8c6be437..8018c2ea6 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/MakeLDIFITCase.java @@ -1,37 +1,32 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; import static org.fest.assertions.Assertions.*; import static org.forgerock.util.Utils.*; +import static com.forgerock.opendj.ldap.CoreMessages.*; import static com.forgerock.opendj.ldap.tools.ToolsMessages.*; import static com.forgerock.opendj.cli.CliMessages.INFO_GLOBAL_HELP_REFERENCE; +import java.io.IOException; import java.io.PrintStream; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import org.forgerock.i18n.LocalizableMessage; import org.forgerock.opendj.ldap.ByteStringBuilder; @@ -43,6 +38,13 @@ @SuppressWarnings("javadoc") public class MakeLDIFITCase extends ToolsITCase { + private static final String TEMP_OUTPUT_FILE = ".temp_test_file.ldif"; + private static final String TEST_RESOURCE_PATH = "src/test/resources"; + private static final String VALID_TEMPLATE_FILE_PATH = + Paths.get(TEST_RESOURCE_PATH, "valid_test_template.ldif").toString(); + private static final boolean SUCCESS = true; + private static final boolean FAILURE = false; + private ByteStringBuilder out; private ByteStringBuilder err; private PrintStream outStream; @@ -103,13 +105,47 @@ Object[][] invalidArguments() throws Exception { @Test(dataProvider = "validArguments") public void testMakeLDIFValidUseCases(final String[] arguments, final LocalizableMessage expectedOut) throws Exception { - run(arguments, true, expectedOut); + run(arguments, SUCCESS, expectedOut); } @Test(dataProvider = "invalidArguments") public void testMakeLDIFInvalidUseCases(final String[] arguments, final LocalizableMessage expectedErr) throws Exception { - run(arguments, false, expectedErr); + run(arguments, FAILURE, expectedErr); + } + + /** See OPENDJ-2505 */ + @Test + public void testMakeLDIFInvalidLineFolding() throws Exception { + final LocalizableMessage expectedOutput = ERR_LDIF_GEN_TOOL_EXCEPTION_DURING_PARSE.get( + ERR_TEMPLATE_FILE_INVALID_LEADING_SPACE.get( + 27, " \"lineFoldingTest\":\\[\"This line should not be accepted by the parser\"\\],")); + run(args("src/test/resources/invalid_test_template.ldif"), FAILURE, expectedOutput); + } + + /** See OPENDJ-2505 */ + @Test + public void testMakeLDIFSupportsLineFolding() throws Exception { + final Path tempOutputFile = Paths.get(TEST_RESOURCE_PATH, TEMP_OUTPUT_FILE); + run(args("-o", tempOutputFile.toString(), VALID_TEMPLATE_FILE_PATH), + SUCCESS, INFO_MAKELDIF_PROCESSING_COMPLETE.get(2)); + assertFilesAreEquals(TEMP_OUTPUT_FILE, "expected_output.ldif"); + Files.delete(tempOutputFile); + } + + /** See OPENDJ-2505 and OPENDJ-2754 */ + @Test + public void testMakeLDIFSupportsLineFoldingAndLineWrapping() throws Exception { + final Path tempOutputFile = Paths.get(TEST_RESOURCE_PATH, TEMP_OUTPUT_FILE); + run(args("-o", tempOutputFile.toString(), "-w", "80", VALID_TEMPLATE_FILE_PATH), + SUCCESS, INFO_MAKELDIF_PROCESSING_COMPLETE.get(2)); + assertFilesAreEquals(TEMP_OUTPUT_FILE, "expected_output_80_column.ldif"); + Files.delete(tempOutputFile); + } + + private void assertFilesAreEquals(final String outputFile, final String expectedOutputFileName) throws IOException { + assertThat(Files.readAllBytes(Paths.get(TEST_RESOURCE_PATH, outputFile))).isEqualTo( + Files.readAllBytes(Paths.get(TEST_RESOURCE_PATH, expectedOutputFileName))); } private void run(final String[] arguments, final boolean expectsSuccess, final LocalizableMessage expectedOutput) diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerStatsTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerStatsTestCase.java deleted file mode 100644 index b95ee59ea..000000000 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/PerformanceRunnerStatsTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. - * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. - */ -package com.forgerock.opendj.ldap.tools; - -import org.testng.annotations.Test; - -import com.forgerock.opendj.ldap.tools.PerformanceRunner.ResponseTimeBuckets; - -import static org.fest.assertions.Assertions.*; - -public class PerformanceRunnerStatsTestCase extends ToolsTestCase { - @Test - public void testResponseTimeBuckets() throws Exception { - ResponseTimeBuckets rtb = PerformanceRunner.getResponseTimeBuckets(); - for (long etime = 100L; etime <= 6000000L; etime += 10L) { - rtb.addTimeToInterval(etime * 1000L); - } - double[] percentiles = new double[] { 0.0025, 0.0050, 0.0075, 0.05, 0.075, 0.1, 1.0, 2.0, 5.5, 10.0, 30.0, - 50.0, 80.0, 99.9, 99.99, 99.999 }; - long[] expectedResult = new long[] { 240L, 390L, 540L, 3000L, 4500L, 6000L, 60000L, 120000L, 330000L, - 600000L, 1800000L, 3000000L, 4800000L, 5500000L, 5500000L, 5500000L }; - int count = expectedResult.length; - for (Long computedPercentile : rtb.getPercentile(percentiles, 599991)) { - assertThat(computedPercentile).isEqualTo(expectedResult[--count]); - } - } -} diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsITCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsITCase.java index c2793dfad..ca2c09cd1 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsITCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsITCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2015 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; diff --git a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java index c1e0300ac..2ea2c2ebc 100644 --- a/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java +++ b/opendj-ldap-toolkit/src/test/java/com/forgerock/opendj/ldap/tools/ToolsTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package com.forgerock.opendj.ldap.tools; diff --git a/opendj-ldap-toolkit/src/test/resources/expected_output.ldif b/opendj-ldap-toolkit/src/test/resources/expected_output.ldif new file mode 100644 index 000000000..e5095ca30 --- /dev/null +++ b/opendj-ldap-toolkit/src/test/resources/expected_output.ldif @@ -0,0 +1,11 @@ +dn: dc=example,dc=com +dc: example + +dn: coretokenid=tokenId,dc=example,dc=com +coretokenid: tokenId +objectClass: top +objectClass: frCoreToken +coretokenstring08: /myrealm +coretokenstring07: Bearer +coretokenobject: {"redirectURI":["http://fake.com"],"acr":[],"clientID":["clientOIDC"],"lineFoldingTest":["This line should have been correctly folded"],"tokenName":["refresh_token"],"authModules":["LDAP"],"realm":["/myrealm"],"id":["fakeid"],"userName":["johndoe"],"tokenType":["Bearer"]} + diff --git a/opendj-ldap-toolkit/src/test/resources/expected_output_80_column.ldif b/opendj-ldap-toolkit/src/test/resources/expected_output_80_column.ldif new file mode 100644 index 000000000..45e611cc9 --- /dev/null +++ b/opendj-ldap-toolkit/src/test/resources/expected_output_80_column.ldif @@ -0,0 +1,14 @@ +dn: dc=example,dc=com +dc: example + +dn: coretokenid=tokenId,dc=example,dc=com +coretokenid: tokenId +objectClass: top +objectClass: frCoreToken +coretokenstring08: /myrealm +coretokenstring07: Bearer +coretokenobject: {"redirectURI":["http://fake.com"],"acr":[],"clientID":["client + OIDC"],"lineFoldingTest":["This line should have been correctly folded"],"token + Name":["refresh_token"],"authModules":["LDAP"],"realm":["/myrealm"],"id":["fake + id"],"userName":["johndoe"],"tokenType":["Bearer"]} + diff --git a/opendj-ldap-toolkit/src/test/resources/invalid_test_template.ldif b/opendj-ldap-toolkit/src/test/resources/invalid_test_template.ldif new file mode 100644 index 000000000..d62975414 --- /dev/null +++ b/opendj-ldap-toolkit/src/test/resources/invalid_test_template.ldif @@ -0,0 +1,29 @@ +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. + +branch: dc=example,dc=com +subordinateTemplate: refreshToken:10 + +template: refreshToken +rdnAttr: coreTokenId +coreTokenId: ---- +objectClass: top +objectClass: frCoreToken +coreTokenString08: /myrealm +coreTokenString07: Bearer +coreTokenObject: \{"redirectURI":\["http://fake.com"\],"acr":\[\],"clientID":\["clientOIDC"\], + + "lineFoldingTest":\["This line should not be accepted by the parser"\], + "tokenName":\["refresh_token"\],"authModules":\["LDAP"\],"realm":\["{coreTokenString08}"\], + "id":\["fakeid"\],"userName":\["johndoe"\],"tokenType":\["Bearer"\]\} \ No newline at end of file diff --git a/opendj-ldap-toolkit/src/test/resources/valid_test_template.ldif b/opendj-ldap-toolkit/src/test/resources/valid_test_template.ldif new file mode 100644 index 000000000..fa3f0c3b7 --- /dev/null +++ b/opendj-ldap-toolkit/src/test/resources/valid_test_template.ldif @@ -0,0 +1,28 @@ +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2016 ForgeRock AS. + +branch: dc=example,dc=com +subordinateTemplate: refreshToken:1 + +template: refreshToken +rdnAttr: coreTokenId +coreTokenId: tokenId +objectClass: top +objectClass: frCoreToken +coreTokenString08: /myrealm +coreTokenString07: Bearer +coreTokenObject: \{"redirectURI":\["http://fake.com"\],"acr":\[\],"clientID":\["clientOIDC"\], + "lineFoldingTest":\["This line should have been correctly folded"\], + "tokenName":\["refresh_token"\],"authModules":\["LDAP"\],"realm":\["{coreTokenString08}"\], + "id":\["fakeid"\],"userName":\["johndoe"\],"tokenType":\["Bearer"\]\} \ No newline at end of file diff --git a/opendj-rest2ldap/pom.xml b/opendj-rest2ldap/pom.xml index 2c69d289b..f58b6ac9d 100644 --- a/opendj-rest2ldap/pom.xml +++ b/opendj-rest2ldap/pom.xml @@ -1,19 +1,18 @@ 4.0.0 @@ -21,8 +20,7 @@ opendj-sdk-parent org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml + 4.0.0-SNAPSHOT opendj-rest2ldap @@ -32,7 +30,6 @@ bundle - org/forgerock/checkstyle/default-java-header org.forgerock.opendj.*;provide:=true, org.forgerock.json.*;provide:=true @@ -43,7 +40,7 @@ org.forgerock.opendj - opendj-core + opendj-sdk-core diff --git a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RequestState.java b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RequestState.java index 5adcc5ae8..486d6f6c4 100644 --- a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RequestState.java +++ b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/RequestState.java @@ -11,7 +11,7 @@ * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions Copyright [year] [name of copyright owner]". * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.rest2ldap; @@ -73,7 +73,7 @@ final class RequestState implements Closeable { private static final class CachedRead implements SearchResultHandler, LdapResultHandler { private SearchResultEntry cachedEntry; private final String cachedFilterString; - /** Guarded by cachedPromiseLatch.*/ + /** Guarded by cachedPromiseLatch. */ private LdapPromise cachedPromise; private final CountDownLatch cachedPromiseLatch = new CountDownLatch(1); private final SearchRequest cachedRequest; @@ -164,7 +164,6 @@ private void invokeResultHandler(final SearchResultHandler searchResultHandler) searchResultHandler.handleEntry(cachedEntry); } } - } /** @@ -191,10 +190,7 @@ protected boolean removeEldestEntry(final Map.Entry eldest) { this.config = config; this.context = context; - /* - * Re-use the pre-authenticated connection if available and the - * authorization policy allows. - */ + /* Re-use the pre-authenticated connection if available and the authorization policy allows. */ if (config.getAuthorizationPolicy() != AuthorizationPolicy.NONE && context.containsContext(AuthenticatedConnectionContext.class)) { this.connection = wrap(context.asContext(AuthenticatedConnectionContext.class).getConnection()); @@ -203,7 +199,6 @@ protected boolean removeEldestEntry(final Map.Entry eldest) { } } - /** {@inheritDoc} */ @Override public void close() { connection.close(); @@ -283,9 +278,7 @@ public final void handleException(final LdapException exception) { * if needed. */ private Connection wrap(final Connection connection) { - /* - * We only use async methods so no need to wrap sync methods. - */ + /* We only use async methods so no need to wrap sync methods. */ return new AbstractAsynchronousConnection() { @Override public LdapPromise abandonAsync(final AbandonRequest request) { @@ -439,5 +432,4 @@ private R withControls(final R request) { } }; } - } diff --git a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java index 10b8ee0df..8782d366f 100644 --- a/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java +++ b/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAP.java @@ -11,7 +11,7 @@ * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions copyright [year] [name of copyright owner]". * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.rest2ldap; @@ -21,7 +21,7 @@ import static org.forgerock.opendj.ldap.Connections.newFailoverLoadBalancer; import static org.forgerock.opendj.ldap.Connections.newRoundRobinLoadBalancer; import static org.forgerock.opendj.ldap.LDAPConnectionFactory.*; -import static org.forgerock.opendj.ldap.LoadBalancingAlgorithm.LOAD_BALANCER_MONITORING_INTERVAL; +import static org.forgerock.opendj.ldap.Connections.LOAD_BALANCER_MONITORING_INTERVAL; import static org.forgerock.opendj.ldap.requests.Requests.newSearchRequest; import static org.forgerock.opendj.ldap.schema.CoreSchema.getEntryUUIDAttributeType; import static org.forgerock.opendj.rest2ldap.ReadOnUpdatePolicy.CONTROLS; diff --git a/opendj-rest2ldap/src/site/xdoc/index.xml.vm b/opendj-rest2ldap/src/site/xdoc/index.xml.vm index 49225621d..b210923ad 100644 --- a/opendj-rest2ldap/src/site/xdoc/index.xml.vm +++ b/opendj-rest2ldap/src/site/xdoc/index.xml.vm @@ -1,28 +1,18 @@ diff --git a/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/AuthzIdTemplateTest.java b/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/AuthzIdTemplateTest.java index 24a9d8b72..b79103626 100644 --- a/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/AuthzIdTemplateTest.java +++ b/opendj-rest2ldap/src/test/java/org/forgerock/opendj/rest2ldap/AuthzIdTemplateTest.java @@ -11,7 +11,7 @@ * Header, with the fields enclosed by brackets [] replaced by your own identifying * information: "Portions copyright [year] [name of copyright owner]". * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.rest2ldap; @@ -45,7 +45,7 @@ public Object[][] templateData() { { // Should perform DN quoting. "dn:uid={uid},ou={realm},dc=example,dc=com", - "dn:uid=test.user,ou=test\\+cn\\=quoting,dc=example,dc=com", + "dn:uid=test.user,ou=test\\+cn=quoting,dc=example,dc=com", map("uid", "test.user", "realm", "test+cn=quoting") }, { diff --git a/opendj-sdk-bom/pom.xml b/opendj-sdk-bom/pom.xml new file mode 100644 index 000000000..680ddfb03 --- /dev/null +++ b/opendj-sdk-bom/pom.xml @@ -0,0 +1,101 @@ + + + + 4.0.0 + + + org.forgerock + forgerock-parent + 2.0.6 + ../forgerock-parent + + + org.forgerock.opendj + opendj-sdk-bom + 4.0.0-SNAPSHOT + + pom + + OpenDJ SDK BOM + + Provides a list of OpenDJ SDK dependencies which are known to be compatible with each other. + + + + 4.0.0-SNAPSHOT + 1.4.2 + + + + + + + org.forgerock.commons + forgerock-bom + 4.1.1 + import + pom + + + + + org.forgerock.commons + i18n-core + ${i18n-framework.version} + + + + org.forgerock.commons + i18n-slf4j + ${i18n-framework.version} + + + + + + org.forgerock.opendj + opendj-sdk-core + ${opendj.sdk.version} + + + + org.forgerock.opendj + opendj-cli + ${opendj.sdk.version} + + + + org.forgerock.opendj + opendj-sdk-grizzly + ${opendj.sdk.version} + + + + org.forgerock.opendj + opendj-rest2ldap + ${opendj.sdk.version} + + + + + com.github.stephenc.jcip + jcip-annotations + 1.0-1 + + + + diff --git a/opendj-sdk-core/clirr-ignored-api-changes.xml b/opendj-sdk-core/clirr-ignored-api-changes.xml new file mode 100644 index 000000000..26c8257e1 --- /dev/null +++ b/opendj-sdk-core/clirr-ignored-api-changes.xml @@ -0,0 +1,35 @@ + + + + + diff --git a/opendj-core/pom.xml b/opendj-sdk-core/pom.xml similarity index 76% rename from opendj-core/pom.xml rename to opendj-sdk-core/pom.xml index a7e81c830..eafab9a3a 100644 --- a/opendj-core/pom.xml +++ b/opendj-sdk-core/pom.xml @@ -1,28 +1,18 @@ 4.0.0 @@ -30,12 +20,11 @@ opendj-sdk-parent org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml + 4.0.0-SNAPSHOT - opendj-core - OpenDJ Core APIs + opendj-sdk-core + OpenDJ SDK Core APIs This module provides the core APIs required for implementing LDAP Directory client and server applications. Unlike the SDK this module does not @@ -65,6 +54,11 @@ i18n-slf4j + + com.github.stephenc.jcip + jcip-annotations + + org.forgerock forgerock-build-tools @@ -101,18 +95,10 @@ + org.codehaus.mojo buildnumber-maven-plugin - 1.4 - - - validate - - create - - - @@ -128,7 +114,7 @@ org.forgerock.opendj.ldif Apache Maven ${maven.version} - ${buildNumber} + ${buildRevision} ${scmBranch} ${maven.build.timestamp} ${java.version} @@ -174,39 +160,39 @@ - - org.codehaus.mojo - clirr-maven-plugin - ${clirrPluginVersion} - true - - - - ${project.groupId} - opendj-ldap-sdk - - 2.6.0 - - - - com/** - - clirr-ignored-api-changes.xml - + + + + + + + + + + + + + + + + + + + - - - mvn clirr:check - + + + + - - mvn verify - - check - - - - + + + + + + + + diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java similarity index 76% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java index 22989777f..acdf3bbc9 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; @@ -44,9 +35,7 @@ * @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; @@ -56,13 +45,11 @@ public final class AccountUsabilityRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public AccountUsabilityRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -86,6 +73,7 @@ public AccountUsabilityRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -110,27 +98,26 @@ private AccountUsabilityRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java similarity index 90% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java index 7c1f5325a..69157bc09 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; @@ -70,18 +60,14 @@ public final class AccountUsabilityResponseControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public AccountUsabilityResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -157,21 +143,16 @@ public AccountUsabilityResponseControl decodeControl(final Control 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; /** @@ -273,16 +254,10 @@ public static AccountUsabilityResponseControl newControl(final int secondsBefore /** 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; @@ -303,7 +278,7 @@ private AccountUsabilityResponseControl(final boolean isCritical, final boolean this.secondsBeforeExpiration = secondsBeforeExpiration; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } @@ -344,7 +319,7 @@ public int getSecondsBeforeUnlock() { return secondsBeforeUnlock; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); final ASN1Writer writer = ASN1.getWriter(buffer); @@ -381,12 +356,12 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } @@ -444,7 +419,6 @@ public boolean isUsable() { return isUsable; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java similarity index 75% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java index 69ddf7394..d4df79337 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/RealAttributesOnlyRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; @@ -42,9 +33,7 @@ * 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 = @@ -53,13 +42,11 @@ public final class RealAttributesOnlyRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public RealAttributesOnlyRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -83,6 +70,7 @@ public RealAttributesOnlyRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -108,27 +96,26 @@ private RealAttributesOnlyRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/TransactionIdControl.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/TransactionIdControl.java similarity index 79% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/TransactionIdControl.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/TransactionIdControl.java index ca89caf8e..1ef43fc51 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/TransactionIdControl.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/TransactionIdControl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java similarity index 76% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java index a0567750d..88892896b 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/VirtualAttributesOnlyRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; @@ -42,9 +33,7 @@ * 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 = @@ -53,13 +42,11 @@ public final class VirtualAttributesOnlyRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public VirtualAttributesOnlyRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -83,6 +70,7 @@ public VirtualAttributesOnlyRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -108,27 +96,26 @@ private VirtualAttributesOnlyRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java new file mode 100644 index 000000000..c18c197a5 --- /dev/null +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/controls/package-info.java @@ -0,0 +1,21 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +/** + * Classes implementing Sun proprietary LDAP controls. + */ +package com.forgerock.opendj.ldap.controls; + diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java similarity index 65% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java index e476adc9c..ecacb65ba 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedRequest.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ - package com.forgerock.opendj.ldap.extensions; import java.io.IOException; @@ -55,6 +44,7 @@ public final class GetConnectionIDExtendedRequest extends private static final class RequestDecoder implements ExtendedRequestDecoder { + @Override public GetConnectionIDExtendedRequest decodeExtendedRequest( final ExtendedRequest request, final DecodeOptions options) throws DecodeException { @@ -70,7 +60,7 @@ public GetConnectionIDExtendedRequest decodeExtendedRequest( private static final class ResultDecoder extends AbstractExtendedResultDecoder { - /** {@inheritDoc} */ + @Override public GetConnectionIDExtendedResult newExtendedErrorResult(final ResultCode resultCode, final String matchedDN, final String diagnosticMessage) { if (!resultCode.isExceptional()) { @@ -83,35 +73,36 @@ public GetConnectionIDExtendedResult newExtendedErrorResult(final ResultCode res .setDiagnosticMessage(diagnosticMessage); } + @Override public GetConnectionIDExtendedResult decodeExtendedResult(final ExtendedResult result, final DecodeOptions options) throws DecodeException { if (result instanceof GetConnectionIDExtendedResult) { return (GetConnectionIDExtendedResult) result; - } else { - final ResultCode resultCode = result.getResultCode(); - final GetConnectionIDExtendedResult newResult = - GetConnectionIDExtendedResult.newResult(resultCode).setMatchedDN( - result.getMatchedDN()).setDiagnosticMessage( - result.getDiagnosticMessage()); - - final ByteString responseValue = result.getValue(); - if (!resultCode.isExceptional() && responseValue == null) { - throw DecodeException.error(LocalizableMessage.raw("Empty response value")); - } - if (responseValue != null) { - try { - final ASN1Reader reader = ASN1.getReader(responseValue); - newResult.setConnectionID((int) reader.readInteger()); - } catch (final IOException e) { - throw DecodeException.error(LocalizableMessage - .raw("Error decoding response value"), e); - } - } - for (final Control control : result.getControls()) { - newResult.addControl(control); + } + + final ResultCode resultCode = result.getResultCode(); + final GetConnectionIDExtendedResult newResult = + GetConnectionIDExtendedResult.newResult(resultCode) + .setMatchedDN(result.getMatchedDN()) + .setDiagnosticMessage(result.getDiagnosticMessage()); + + final ByteString responseValue = result.getValue(); + if (!resultCode.isExceptional() && responseValue == null) { + throw DecodeException.error(LocalizableMessage.raw("Empty response value")); + } + if (responseValue != null) { + try { + final ASN1Reader reader = ASN1.getReader(responseValue); + newResult.setConnectionID((int) reader.readInteger()); + } catch (final IOException e) { + throw DecodeException.error(LocalizableMessage + .raw("Error decoding response value"), e); } - return newResult; } + for (final Control control : result.getControls()) { + newResult.addControl(control); + } + return newResult; } } @@ -125,10 +116,7 @@ public GetConnectionIDExtendedResult decodeExtendedResult(final ExtendedResult r 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. */ @@ -148,31 +136,26 @@ private GetConnectionIDExtendedRequest() { // Nothing to do. } - /** {@inheritDoc} */ @Override public String getOID() { return OID; } - /** {@inheritDoc} */ @Override public ExtendedResultDecoder 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(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java similarity index 75% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java index ba1e60d69..6341b744e 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetConnectionIDExtendedResult.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package com.forgerock.opendj.ldap.extensions; import java.io.IOException; @@ -75,13 +64,11 @@ public int getConnectionID() { return connectionID; } - /** {@inheritDoc} */ @Override public String getOID() { return GetConnectionIDExtendedRequest.OID; } - /** {@inheritDoc} */ @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(6); @@ -97,7 +84,6 @@ public ByteString getValue() { return buffer.toByteString(); } - /** {@inheritDoc} */ @Override public boolean hasValue() { return true; @@ -115,7 +101,6 @@ public GetConnectionIDExtendedResult setConnectionID(final int connectionID) { return this; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java similarity index 83% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java index b0f4a6fa1..7958b97dd 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/GetSymmetricKeyExtendedRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.extensions; @@ -49,14 +39,12 @@ import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder; import org.forgerock.opendj.ldap.responses.Responses; -/** - * Get symmetric key extended request. - */ +/** Get symmetric key extended request. */ public final class GetSymmetricKeyExtendedRequest extends AbstractExtendedRequest { private static final class RequestDecoder implements ExtendedRequestDecoder { - + @Override public GetSymmetricKeyExtendedRequest decodeExtendedRequest( final ExtendedRequest request, final DecodeOptions options) throws DecodeException { @@ -101,13 +89,14 @@ public GetSymmetricKeyExtendedRequest decodeExtendedRequest( } private static final class ResultDecoder extends AbstractExtendedResultDecoder { - + @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; @@ -116,28 +105,14 @@ public ExtendedResult decodeExtendedResult(final ExtendedResult result, private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); - /** - * The request OID for the get symmetric key extended operation. - */ + /** The request OID for the get symmetric key extended operation. */ public static final String OID = "1.3.6.1.4.1.26027.1.6.3"; - - /** - * The BER type value for the symmetric key element of the operation value. - */ + /** The BER type value for the symmetric key element of the operation value. */ private static final byte TYPE_SYMMETRIC_KEY_ELEMENT = (byte) 0x80; - - /** - * The BER type value for the instance key ID element of the operation - * value. - */ + /** The BER type value for the instance key ID element of the operation value. */ private static final byte TYPE_INSTANCE_KEY_ID_ELEMENT = (byte) 0x81; - - /** - * A decoder which can be used to decode get symmetric key extended - * operation requests. - */ + /** A decoder which can be used to decode get symmetric key extended operation requests. */ public static final RequestDecoder REQUEST_DECODER = new RequestDecoder(); - /** No need to expose this. */ private static final ResultDecoder RESULT_DECODER = new ResultDecoder(); @@ -166,7 +141,6 @@ public String getInstanceKeyID() { return instanceKeyID; } - /** {@inheritDoc} */ @Override public String getOID() { return OID; @@ -181,13 +155,11 @@ public String getRequestSymmetricKey() { return requestSymmetricKey; } - /** {@inheritDoc} */ @Override public ExtendedResultDecoder getResultDecoder() { return RESULT_DECODER; } - /** {@inheritDoc} */ @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); @@ -210,7 +182,6 @@ public ByteString getValue() { return buffer.toByteString(); } - /** {@inheritDoc} */ @Override public boolean hasValue() { return true; @@ -240,7 +211,6 @@ public GetSymmetricKeyExtendedRequest setRequestSymmetricKey(final String reques return this; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java similarity index 88% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java index 94ac629c7..c947b407c 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedRequest.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package com.forgerock.opendj.ldap.extensions; import java.io.IOException; @@ -150,7 +139,6 @@ public Iterable getValues() { return values; } - /** {@inheritDoc} */ @Override public String toString() { return property + ": " + values; @@ -160,7 +148,6 @@ public String toString() { private static final class RequestDecoder implements ExtendedRequestDecoder { - @Override public PasswordPolicyStateExtendedRequest decodeExtendedRequest( final ExtendedRequest request, final DecodeOptions options) @@ -196,8 +183,6 @@ public PasswordPolicyStateExtendedRequest decodeExtendedRequest( private static final class ResultDecoder extends AbstractExtendedResultDecoder { - - /** {@inheritDoc} */ @Override public PasswordPolicyStateExtendedResult newExtendedErrorResult( final ResultCode resultCode, final String matchedDN, final String diagnosticMessage) { @@ -283,10 +268,7 @@ public PasswordPolicyStateExtendedResult decodeExtendedResult(final ExtendedResu "Seconds Until Required Change Time"; static final String PASSWORD_HISTORY_NAME = "Password History"; - /** - * A decoder which can be used to decode password policy state extended - * operation requests. - */ + /** A decoder which can be used to decode password policy state extended operation requests. */ public static final RequestDecoder REQUEST_DECODER = new RequestDecoder(); /** No need to expose this. */ @@ -362,9 +344,7 @@ private static void decodeOperations(final ASN1Reader reader, } } - /** - * Creates a new password policy state extended request. - */ + /** Creates a new password policy state extended request. */ public PasswordPolicyStateExtendedRequest() { // Nothing to do. } @@ -389,256 +369,189 @@ public void addGraceLoginUseTime(final Date date) { setDateProperty(ADD_GRACE_LOGIN_USE_TIME, date); } - /** {@inheritDoc} */ @Override public void addOperation(final PasswordPolicyStateOperation operation) { operations.add(operation); } - /** - * Clears the account disabled state. - */ + /** Clears the account disabled state. */ public void clearAccountDisabledState() { operations.add(PasswordPolicyStateOperationType.CLEAR_ACCOUNT_DISABLED_STATE); } - /** - * Clears the account expiration time. - */ + /** Clears the account expiration time. */ public void clearAccountExpirationTime() { operations.add(PasswordPolicyStateOperationType.CLEAR_ACCOUNT_EXPIRATION_TIME); } - /** - * Clears the authentication failure times. - */ + /** Clears the authentication failure times. */ public void clearAuthenticationFailureTimes() { operations.add(PasswordPolicyStateOperationType.CLEAR_AUTHENTICATION_FAILURE_TIMES); } - /** - * Clears the grace login use times. - */ + /** Clears the grace login use times. */ public void clearGraceLoginUseTimes() { operations.add(PasswordPolicyStateOperationType.CLEAR_GRACE_LOGIN_USE_TIMES); } - /** - * Clears the last login time. - */ + /** Clears the last login time. */ public void clearLastLoginTime() { operations.add(PasswordPolicyStateOperationType.CLEAR_LAST_LOGIN_TIME); } - /** - * Clears the password changed by required time. - */ + /** Clears the password changed by required time. */ public void clearPasswordChangedByRequiredTime() { operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_CHANGED_BY_REQUIRED_TIME); } - /** - * Clears the password changed time. - */ + /** Clears the password changed time. */ public void clearPasswordChangedTime() { operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_CHANGED_TIME); } - /** - * Clears the password expiration warned time. - */ + /** Clears the password expiration warned time. */ public void clearPasswordExpirationWarnedTime() { operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_EXPIRATION_WARNED_TIME); } - /** - * Clears the password history. - */ + /** Clears the password history. */ public void clearPasswordHistory() { operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_HISTORY); } - /** - * Clears the password reset state. - */ + /** Clears the password reset state. */ public void clearPasswordResetState() { operations.add(PasswordPolicyStateOperationType.CLEAR_PASSWORD_RESET_STATE); } - /** {@inheritDoc} */ @Override public String getOID() { return OID; } - /** {@inheritDoc} */ @Override public Iterable getOperations() { return operations; } - /** {@inheritDoc} */ @Override public ExtendedResultDecoder getResultDecoder() { return RESULT_DECODER; } - /** {@inheritDoc} */ @Override public String getTargetUser() { return targetUser; } - /** {@inheritDoc} */ @Override public ByteString getValue() { return encode(targetUser, operations); } - /** {@inheritDoc} */ @Override public boolean hasValue() { return true; } - /** - * Returns the account disabled state. - */ + /** Returns the account disabled state. */ public void requestAccountDisabledState() { operations.add(PasswordPolicyStateOperationType.GET_ACCOUNT_DISABLED_STATE); } - /** - * Returns the account expiration time. - */ + /** Returns the account expiration time. */ public void requestAccountExpirationTime() { operations.add(PasswordPolicyStateOperationType.GET_ACCOUNT_EXPIRATION_TIME); } - /** - * Returns the authentication failure times. - */ + /** Returns the authentication failure times. */ public void requestAuthenticationFailureTimes() { operations.add(PasswordPolicyStateOperationType.GET_AUTHENTICATION_FAILURE_TIMES); } - /** - * Returns the grace login use times. - */ + /** Returns the grace login use times. */ public void requestGraceLoginUseTimes() { operations.add(PasswordPolicyStateOperationType.GET_GRACE_LOGIN_USE_TIMES); } - /** - * Returns the last login time. - */ + /** Returns the last login time. */ public void requestLastLoginTime() { operations.add(PasswordPolicyStateOperationType.GET_LAST_LOGIN_TIME); } - /** - * Returns the password changed by required time. - */ + /** Returns the password changed by required time. */ public void requestPasswordChangedByRequiredTime() { operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_CHANGED_BY_REQUIRED_TIME); } - /** - * Returns the password changed time. - */ + /** Returns the password changed time. */ public void requestPasswordChangedTime() { operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_CHANGED_TIME); } - /** - * Returns the password expiration warned time. - */ + /** Returns the password expiration warned time. */ public void requestPasswordExpirationWarnedTime() { operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_EXPIRATION_WARNED_TIME); } - /** - * Returns the password history. - */ + /** Returns the password history. */ public void requestPasswordHistory() { operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_HISTORY); } - /** - * Returns the password policy DN. - */ + /** Returns the password policy DN. */ public void requestPasswordPolicyDN() { operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_POLICY_DN); } - /** - * Returns the password reset state. - */ + /** Returns the password reset state. */ public void requestPasswordResetState() { operations.add(PasswordPolicyStateOperationType.GET_PASSWORD_RESET_STATE); } - /** - * Returns the remaining authentication failure count. - */ + /** Returns the remaining authentication failure count. */ public void requestRemainingAuthenticationFailureCount() { operations.add(PasswordPolicyStateOperationType.GET_REMAINING_AUTHENTICATION_FAILURE_COUNT); } - /** - * Returns the remaining grace login count. - */ + /** Returns the remaining grace login count. */ public void requestRemainingGraceLoginCount() { operations.add(PasswordPolicyStateOperationType.GET_REMAINING_GRACE_LOGIN_COUNT); } - /** - * Returns the seconds until account expiration. - */ + /** Returns the seconds until account expiration. */ public void requestSecondsUntilAccountExpiration() { operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_ACCOUNT_EXPIRATION); } - /** - * Returns the seconds until authentication failure unlock. - */ + /** Returns the seconds until authentication failure unlock. */ public void requestSecondsUntilAuthenticationFailureUnlock() { operations .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_AUTHENTICATION_FAILURE_UNLOCK); } - /** - * Returns the seconds until idle lockout. - */ + /** Returns the seconds until idle lockout. */ public void requestSecondsUntilIdleLockout() { operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_IDLE_LOCKOUT); } - /** - * Returns the seconds until password expiration. - */ + /** Returns the seconds until password expiration. */ public void requestSecondsUntilPasswordExpiration() { operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_EXPIRATION); } - /** - * Returns the seconds until password expiration warning. - */ + /** Returns the seconds until password expiration warning. */ public void requestSecondsUntilPasswordExpirationWarning() { operations .add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_EXPIRATION_WARNING); } - /** - * Returns the seconds until password reset lockout. - */ + /** Returns the seconds until password reset lockout. */ public void requestSecondsUntilPasswordResetLockout() { operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_PASSWORD_RESET_LOCKOUT); } - /** - * Returns the seconds until required change time. - */ + /** Returns the seconds until required change time. */ public void requestSecondsUntilRequiredChangeTime() { operations.add(PasswordPolicyStateOperationType.GET_SECONDS_UNTIL_REQUIRED_CHANGE_TIME); } @@ -761,13 +674,11 @@ private ByteString toByteString(final Date date) { return ByteString.valueOfUtf8(formatAsGeneralizedTime(date)); } - /** {@inheritDoc} */ @Override public void setTargetUser(String targetUser) { this.targetUser = targetUser != null ? targetUser : ""; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java similarity index 67% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java index 817ca09e1..ad1779bbc 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateExtendedResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. */ package com.forgerock.opendj.ldap.extensions; @@ -34,9 +24,7 @@ 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 implements PasswordPolicyStateOperationContainer { @@ -54,47 +42,42 @@ public PasswordPolicyStateExtendedResult(final ResultCode resultCode) { 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 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(); diff --git a/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java new file mode 100644 index 000000000..67d94587a --- /dev/null +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperation.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package com.forgerock.opendj.ldap.extensions; + +import org.forgerock.opendj.ldap.ByteString; + +/** + * Password policy state operation. + */ +public interface PasswordPolicyStateOperation { + /** + * Returns the type of operation. + * + * @return The type of operation. + */ + PasswordPolicyStateOperationType getOperationType(); + + /** + * Returns the operation values. + * + * @return The operation values. + */ + Iterable getValues(); +} diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java similarity index 55% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java index c62b7ce8e..6a48f2ce2 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationContainer.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package com.forgerock.opendj.ldap.extensions; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java similarity index 58% rename from opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java index f6272f646..1039e0b77 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/PasswordPolicyStateOperationType.java @@ -1,259 +1,166 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * 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; @@ -262,17 +169,16 @@ private PasswordPolicyStateOperationType(final String propertyName) { this.propertyName = propertyName; } - /** {@inheritDoc} */ + @Override public PasswordPolicyStateOperationType getOperationType() { return this; } - /** {@inheritDoc} */ + @Override public Iterable getValues() { return null; } - /** {@inheritDoc} */ @Override public String toString() { return propertyName; diff --git a/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java new file mode 100644 index 000000000..5de736eb5 --- /dev/null +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/ldap/extensions/package-info.java @@ -0,0 +1,21 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ + +/** + * Classes implementing Sun proprietary LDAP extended operations. + */ +package com.forgerock.opendj.ldap.extensions; + diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java similarity index 89% rename from opendj-core/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java index 2bb063a0d..3a6bf670e 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/ASCIICharProp.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package com.forgerock.opendj.util; @@ -180,7 +170,7 @@ public char charValue() { return c; } - /** {@inheritDoc} */ + @Override public int compareTo(final ASCIICharProp o) { return c - o.c; } @@ -196,13 +186,11 @@ public int decimalValue() { return decimalValue; } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { return this == obj; } - /** {@inheritDoc} */ @Override public int hashCode() { return c; @@ -309,7 +297,6 @@ public char toLowerCase() { return lowerCaseChar; } - /** {@inheritDoc} */ @Override public String toString() { return stringValue; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/Collections2.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Collections2.java similarity index 84% rename from opendj-core/src/main/java/com/forgerock/opendj/util/Collections2.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Collections2.java index ee9b6c679..c5940e708 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/Collections2.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Collections2.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.util; @@ -35,13 +25,10 @@ import org.forgerock.util.Function; import org.forgerock.util.promise.NeverThrowsException; -/** - * Additional {@code Collection} based utility methods. - */ +/** Additional {@code Collection} based utility methods. */ public final class Collections2 { private static class TransformedCollection> extends AbstractCollection implements Collection { - protected final C collection; protected final Function funcMtoN; @@ -56,68 +43,57 @@ protected TransformedCollection(final C collection, this.funcNtoM = funcNtoM; } - /** {@inheritDoc} */ @Override public boolean add(final N e) { return collection.add(funcNtoM.apply(e)); } - /** {@inheritDoc} */ @Override public void clear() { collection.clear(); } - /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean contains(final Object o) { return collection.contains(funcNtoM.apply((N) o)); } - /** {@inheritDoc} */ @Override public boolean isEmpty() { return collection.isEmpty(); } - /** {@inheritDoc} */ @Override public Iterator iterator() { return Iterators.transformedIterator(collection.iterator(), funcMtoN); } - /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public boolean remove(final Object o) { return collection.remove(funcNtoM.apply((N) o)); } - /** {@inheritDoc} */ @Override public int size() { return collection.size(); } - } private static final class TransformedList extends TransformedCollection> implements List { - private TransformedList(final List list, final Function funcMtoN, final Function funcNtoM) { super(list, funcMtoN, funcNtoM); } - /** {@inheritDoc} */ @Override public void add(final int index, final N element) { collection.add(index, funcNtoM.apply(element)); } - /** {@inheritDoc} */ @Override public boolean addAll(final int index, final Collection c) { // We cannot transform c here due to type-safety. @@ -128,33 +104,28 @@ public boolean addAll(final int index, final Collection c) { return result; } - /** {@inheritDoc} */ @Override public N get(final int index) { return funcMtoN.apply(collection.get(index)); } - /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public int indexOf(final Object o) { return collection.indexOf(funcNtoM.apply((N) o)); } - /** {@inheritDoc} */ @Override @SuppressWarnings("unchecked") public int lastIndexOf(final Object o) { return collection.lastIndexOf(funcNtoM.apply((N) o)); } - /** {@inheritDoc} */ @Override public ListIterator listIterator() { return listIterator(0); } - /** {@inheritDoc} */ @Override public ListIterator listIterator(final int index) { final ListIterator iterator = collection.listIterator(index); @@ -208,26 +179,22 @@ public void set(final N e) { }; } - /** {@inheritDoc} */ @Override public N remove(final int index) { return funcMtoN.apply(collection.remove(index)); } - /** {@inheritDoc} */ @Override public N set(final int index, final N element) { final M result = collection.set(index, funcNtoM.apply(element)); return funcMtoN.apply(result); } - /** {@inheritDoc} */ @Override public List subList(final int fromIndex, final int toIndex) { final List subList = collection.subList(fromIndex, toIndex); return new TransformedList<>(subList, funcMtoN, funcNtoM); } - } /** @@ -290,5 +257,4 @@ public static List transformedList(final List list, private Collections2() { // Do nothing. } - } diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/Iterables.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Iterables.java similarity index 92% rename from opendj-core/src/main/java/com/forgerock/opendj/util/Iterables.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Iterables.java index 1e90e8c93..5b29ddc67 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/Iterables.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Iterables.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2013-2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/Iterators.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Iterators.java similarity index 86% rename from opendj-core/src/main/java/com/forgerock/opendj/util/Iterators.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Iterators.java index a3fd595c3..bc5c51b52 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/Iterators.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Iterators.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ - package com.forgerock.opendj.util; import java.util.Iterator; @@ -33,9 +22,7 @@ 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 implements Iterator { private int i; @@ -46,12 +33,12 @@ private ArrayIterator(final M[] a) { this.a = a; } - /** {@inheritDoc} */ + @Override public boolean hasNext() { return i < a.length; } - /** {@inheritDoc} */ + @Override public M next() { if (hasNext()) { return a[i++]; @@ -60,7 +47,7 @@ public M next() { } } - /** {@inheritDoc} */ + @Override public void remove() { throw new UnsupportedOperationException(); } @@ -68,17 +55,17 @@ public void remove() { } private static final class EmptyIterator implements Iterator { - /** {@inheritDoc} */ + @Override public boolean hasNext() { return false; } - /** {@inheritDoc} */ + @Override public M next() { throw new NoSuchElementException(); } - /** {@inheritDoc} */ + @Override public void remove() { throw new UnsupportedOperationException(); } @@ -101,7 +88,7 @@ private FilteredIterator(final Iterator iterator, this.parameter = p; } - /** {@inheritDoc} */ + @Override public boolean hasNext() { if (hasNextMustIterate) { hasNextMustIterate = false; @@ -118,7 +105,7 @@ public boolean hasNext() { } } - /** {@inheritDoc} */ + @Override public M next() { if (!hasNext()) { throw new NoSuchElementException(); @@ -127,7 +114,7 @@ public M next() { return next; } - /** {@inheritDoc} */ + @Override public void remove() { iterator.remove(); } @@ -142,12 +129,12 @@ private SingletonIterator(final M value) { this.value = value; } - /** {@inheritDoc} */ + @Override public boolean hasNext() { return value != null; } - /** {@inheritDoc} */ + @Override public M next() { if (value != null) { final M tmp = value; @@ -158,7 +145,7 @@ public M next() { } } - /** {@inheritDoc} */ + @Override public void remove() { throw new UnsupportedOperationException(); } @@ -177,17 +164,17 @@ private TransformedIterator(final Iterator iterator, 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(); } @@ -201,17 +188,17 @@ private UnmodifiableIterator(final Iterator iterator) { 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(); } diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/OperatingSystem.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/OperatingSystem.java similarity index 88% rename from opendj-core/src/main/java/com/forgerock/opendj/util/OperatingSystem.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/OperatingSystem.java index 7e8ff6391..9a256a9f8 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/OperatingSystem.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/OperatingSystem.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package com.forgerock.opendj.util; @@ -118,6 +108,7 @@ private OperatingSystem(String osName, boolean isWindows, boolean isMacOS, boole * * @return The human-readable name for this operating system. */ + @Override public String toString() { return osName; } diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/PackedLong.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/PackedLong.java similarity index 90% rename from opendj-core/src/main/java/com/forgerock/opendj/util/PackedLong.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/PackedLong.java index d0cdbf18c..2d7027259 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/PackedLong.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/PackedLong.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/Predicate.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Predicate.java similarity index 52% rename from opendj-core/src/main/java/com/forgerock/opendj/util/Predicate.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Predicate.java index 888d53a88..9cdda2fb1 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/Predicate.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/Predicate.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/ReferenceCountedObject.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/ReferenceCountedObject.java similarity index 83% rename from opendj-core/src/main/java/com/forgerock/opendj/util/ReferenceCountedObject.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/ReferenceCountedObject.java index f7aca1786..d7ff6eac8 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/ReferenceCountedObject.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/ReferenceCountedObject.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java similarity index 71% rename from opendj-core/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java index c7d22e095..a7afa177d 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/SizeLimitInputStream.java @@ -1,36 +1,25 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package com.forgerock.opendj.util; import java.io.IOException; import java.io.InputStream; -/** - * An implementation of input stream that enforces an read size limit. - */ +/** An implementation of input stream that enforces an read size limit. */ public class SizeLimitInputStream extends InputStream { private int bytesRead; private int markBytesRead; @@ -50,7 +39,6 @@ public SizeLimitInputStream(final InputStream parentStream, final int readLimit) this.readLimit = readLimit; } - /** {@inheritDoc} */ @Override public int available() throws IOException { final int streamAvail = parentStream.available(); @@ -58,7 +46,6 @@ public int available() throws IOException { return limitedAvail < streamAvail ? limitedAvail : streamAvail; } - /** {@inheritDoc} */ @Override public void close() throws IOException { parentStream.close(); @@ -82,20 +69,17 @@ public int getSizeLimit() { return readLimit; } - /** {@inheritDoc} */ @Override public synchronized void mark(final int readlimit) { parentStream.mark(readlimit); markBytesRead = bytesRead; } - /** {@inheritDoc} */ @Override public boolean markSupported() { return parentStream.markSupported(); } - /** {@inheritDoc} */ @Override public int read() throws IOException { if (bytesRead >= readLimit) { @@ -109,7 +93,6 @@ public int read() throws IOException { return b; } - /** {@inheritDoc} */ @Override public int read(final byte[] b, final int off, int len) throws IOException { if (off < 0 || len < 0 || off + len > b.length) { @@ -135,14 +118,12 @@ public int read(final byte[] b, final int off, int len) throws IOException { return readLen; } - /** {@inheritDoc} */ @Override public synchronized void reset() throws IOException { parentStream.reset(); bytesRead = markBytesRead; } - /** {@inheritDoc} */ @Override public long skip(long n) throws IOException { if (bytesRead + n > readLimit) { diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java similarity index 96% rename from opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java index 27ea81cdd..7a32e63b3 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/StaticUtils.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java similarity index 97% rename from opendj-core/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java index 58b849fc1..d7443bfbd 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/StringPrepProfile.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/main/java/com/forgerock/opendj/util/SubstringReader.java b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/SubstringReader.java similarity index 78% rename from opendj-core/src/main/java/com/forgerock/opendj/util/SubstringReader.java rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/SubstringReader.java index de600a794..f2abf4000 100644 --- a/opendj-core/src/main/java/com/forgerock/opendj/util/SubstringReader.java +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/SubstringReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/package-info.java similarity index 76% rename from opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt rename to opendj-sdk-core/src/main/java/com/forgerock/opendj/util/package-info.java index f829e8222..1b5c369a0 100644 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-3.txt +++ b/opendj-sdk-core/src/main/java/com/forgerock/opendj/util/package-info.java @@ -9,8 +9,13 @@ * When distributing Covered Software, include this CDDL Header Notice in each file and include * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL * Header, with the fields enclosed by brackets [] replaced by your own identifying - * information: "Portions copyright [year] [name of copyright owner]". + * information: "Portions Copyright [year] [name of copyright owner]". * + * Copyright 2009 Sun Microsystems, Inc. */ - - EXPECTED OUTPUT: Copyright YEAR ForgeRock AS. \ No newline at end of file + +/** + * Classes providing utility functionality. + */ +package com.forgerock.opendj.util; + diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/io/ASN1.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1.java index eb75b2e21..bc8690f35 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java index 204e80090..0a9ef1b8a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1ByteSequenceReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java index eb6c0e8dd..c6a152202 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1InputStreamReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.io; @@ -41,9 +31,7 @@ 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(); @@ -72,14 +60,14 @@ final class ASN1InputStreamReader extends AbstractASN1Reader { 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)) @@ -88,7 +76,7 @@ public boolean elementAvailable() throws IOException { && 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 @@ -101,7 +89,7 @@ public boolean hasNextElement() throws IOException { return state != ASN1.ELEMENT_READ_STATE_NEED_TYPE || needTypeState(true, false); } - /** {@inheritDoc} */ + @Override public int peekLength() throws IOException { peekType(); switch (state) { @@ -117,7 +105,7 @@ public int peekLength() throws IOException { return peekLength; } - /** {@inheritDoc} */ + @Override public byte peekType() throws IOException { if (state == ASN1.ELEMENT_READ_STATE_NEED_TYPE) { needTypeState(true, true); @@ -126,7 +114,7 @@ public byte peekType() throws IOException { return peekType; } - /** {@inheritDoc} */ + @Override public boolean readBoolean() throws IOException { // Read the header if haven't done so already peekLength(); @@ -148,7 +136,7 @@ public boolean readBoolean() throws IOException { return readByte != 0x00; } - /** {@inheritDoc} */ + @Override public void readEndSequence() throws IOException { if (streamStack.isEmpty()) { final LocalizableMessage message = ERR_ASN1_SEQUENCE_READ_NOT_STARTED.get(); @@ -171,20 +159,19 @@ public void readEndSequence() throws IOException { 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(); @@ -199,7 +186,7 @@ public int readEnumerated() throws IOException { return (int) readInteger(); } - /** {@inheritDoc} */ + @Override public long readInteger() throws IOException { // Read the header if haven't done so already peekLength(); @@ -248,7 +235,7 @@ public long readInteger() throws IOException { } } - /** {@inheritDoc} */ + @Override public void readNull() throws IOException { // Read the header if haven't done so already peekLength(); @@ -264,7 +251,7 @@ public void readNull() throws IOException { state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; } - /** {@inheritDoc} */ + @Override public ByteString readOctetString() throws IOException { // Read the header if haven't done so already peekLength(); @@ -295,7 +282,7 @@ public ByteString readOctetString() throws IOException { return ByteString.wrap(value); } - /** {@inheritDoc} */ + @Override public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException { // Read the header if haven't done so already peekLength(); @@ -323,7 +310,7 @@ public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws return builder; } - /** {@inheritDoc} */ + @Override public String readOctetStringAsString() throws IOException { // Read the header if haven't done so already peekLength(); @@ -365,7 +352,7 @@ public String readOctetStringAsString() throws IOException { return str; } - /** {@inheritDoc} */ + @Override public void readStartSequence() throws IOException { // Read the header if haven't done so already peekLength(); @@ -381,20 +368,19 @@ public void readStartSequence() throws IOException { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1OutputStreamWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1OutputStreamWriter.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/io/ASN1OutputStreamWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1OutputStreamWriter.java index d100db7d2..397cb70f8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1OutputStreamWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1OutputStreamWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.io; @@ -39,9 +29,7 @@ import com.forgerock.opendj.util.StaticUtils; -/** - * An ASN1Writer implementation that outputs to an outputstream. - */ +/** An ASN1Writer implementation that outputs to an outputstream. */ final class ASN1OutputStreamWriter extends AbstractASN1Writer { /** Initial size of internal buffers. */ private static final int BUFFER_INIT_SIZE = 32; @@ -70,7 +58,6 @@ final class ASN1OutputStreamWriter extends AbstractASN1Writer { this.stackDepth = -1; } - /** {@inheritDoc} */ @Override public void close() throws IOException { while (stackDepth >= 0) { @@ -81,13 +68,11 @@ public void close() throws IOException { rootStream.close(); } - /** {@inheritDoc} */ @Override public void flush() throws IOException { rootStream.flush(); } - /** {@inheritDoc} */ @Override public ASN1Writer writeBoolean(final byte type, final boolean booleanValue) throws IOException { out.write(type); @@ -98,7 +83,6 @@ public ASN1Writer writeBoolean(final byte type, final boolean booleanValue) thro return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeEndSequence() throws IOException { if (stackDepth < 0) { @@ -126,19 +110,16 @@ public ASN1Writer writeEndSequence() throws IOException { 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 { out.write(type); @@ -171,7 +152,6 @@ public ASN1Writer writeInteger(final byte type, final int intValue) throws IOExc return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeInteger(final byte type, final long longValue) throws IOException { out.write(type); @@ -246,7 +226,6 @@ public ASN1Writer writeInteger(final byte type, final long longValue) throws IOE return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeNull(final byte type) throws IOException { out.write(type); @@ -256,7 +235,6 @@ public ASN1Writer writeNull(final byte type) throws IOException { return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeOctetString(final byte type, final byte[] value, final int offset, final int length) throws IOException { @@ -268,7 +246,6 @@ public ASN1Writer writeOctetString(final byte type, final byte[] value, final in return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeOctetString(final byte type, final ByteSequence value) throws IOException { @@ -280,7 +257,6 @@ public ASN1Writer writeOctetString(final byte type, final ByteSequence value) return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeOctetString(final byte type, final String value) throws IOException { out.write(type); @@ -298,7 +274,6 @@ public ASN1Writer writeOctetString(final byte type, final String value) throws I return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeStartSequence(final byte type) throws IOException { // Write the type in current stream switch to next sub-stream @@ -320,7 +295,6 @@ public ASN1Writer writeStartSequence(final byte type) throws IOException { return this; } - /** {@inheritDoc} */ @Override public ASN1Writer writeStartSet(final byte type) throws IOException { // From an implementation point of view, a set is equivalent to a diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1Reader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1Reader.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/io/ASN1Reader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1Reader.java index e270b6bef..447455e9a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1Reader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1Reader.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.io; @@ -49,6 +39,7 @@ public interface ASN1Reader extends Closeable { * @throws IOException * If an error occurs while closing. */ + @Override void close() throws IOException; /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1Writer.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1Writer.java similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/io/ASN1Writer.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1Writer.java index 7c869a269..532daf40e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/ASN1Writer.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/ASN1Writer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.io; @@ -48,6 +38,7 @@ public interface ASN1Writer extends Closeable, Flushable { * @throws IOException * If an error occurs while closing. */ + @Override void close() throws IOException; /** @@ -65,6 +56,7 @@ public interface ASN1Writer extends Closeable, Flushable { * @throws IOException * If an error occurs while flushing. */ + @Override void flush() throws IOException; /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Reader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Reader.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Reader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Reader.java index ef83c990c..7a05fd2c6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Reader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Reader.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.io; @@ -42,14 +32,12 @@ * 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; @@ -58,7 +46,7 @@ public boolean readBoolean(byte type) throws IOException { return readBoolean(); } - /** {@inheritDoc} */ + @Override public int readEnumerated(byte type) throws IOException { if (type == 0x00) { type = ASN1.UNIVERSAL_ENUMERATED_TYPE; @@ -67,7 +55,7 @@ public int readEnumerated(byte type) throws IOException { return readEnumerated(); } - /** {@inheritDoc} */ + @Override public long readInteger(byte type) throws IOException { if (type == 0x00) { type = ASN1.UNIVERSAL_INTEGER_TYPE; @@ -76,7 +64,7 @@ public long readInteger(byte type) throws IOException { return readInteger(); } - /** {@inheritDoc} */ + @Override public void readNull(byte type) throws IOException { if (type == 0x00) { type = ASN1.UNIVERSAL_NULL_TYPE; @@ -85,7 +73,7 @@ public void readNull(byte type) throws IOException { readNull(); } - /** {@inheritDoc} */ + @Override public ByteString readOctetString(byte type) throws IOException { if (type == 0x00) { type = ASN1.UNIVERSAL_OCTET_STRING_TYPE; @@ -94,7 +82,7 @@ public ByteString readOctetString(byte type) throws IOException { return readOctetString(); } - /** {@inheritDoc} */ + @Override public ByteStringBuilder readOctetString(byte type, final ByteStringBuilder builder) throws IOException { if (type == 0x00) { @@ -105,7 +93,7 @@ public ByteStringBuilder readOctetString(byte type, final ByteStringBuilder buil 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. @@ -116,7 +104,7 @@ public String readOctetStringAsString(byte type) throws IOException { return readOctetStringAsString(); } - /** {@inheritDoc} */ + @Override public void readStartExplicitTag(byte type) throws IOException { if (type == 0x00) { type = (ASN1.TYPE_MASK_CONTEXT | ASN1.TYPE_MASK_CONSTRUCTED); @@ -125,7 +113,7 @@ public void readStartExplicitTag(byte type) throws IOException { readStartExplicitTag(); } - /** {@inheritDoc} */ + @Override public void readStartSequence(byte type) throws IOException { if (type == 0x00) { type = ASN1.UNIVERSAL_SEQUENCE_TYPE; @@ -134,7 +122,7 @@ public void readStartSequence(byte type) throws IOException { readStartSequence(); } - /** {@inheritDoc} */ + @Override public void readStartSet(byte type) throws IOException { // From an implementation point of view, a set is equivalent to a // sequence. @@ -145,7 +133,7 @@ public void readStartSet(byte type) throws IOException { readStartSet(); } - /** {@inheritDoc} */ + @Override public ASN1Reader skipElement(final byte expectedType) throws IOException { if (peekType() != expectedType) { final LocalizableMessage message = diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Writer.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Writer.java similarity index 62% rename from opendj-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Writer.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Writer.java index caefb70f6..750118035 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Writer.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractASN1Writer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.io; @@ -36,70 +26,68 @@ */ 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); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/AbstractLDAPMessageHandler.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractLDAPMessageHandler.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/io/AbstractLDAPMessageHandler.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractLDAPMessageHandler.java index ac2433597..38de2966d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/AbstractLDAPMessageHandler.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/AbstractLDAPMessageHandler.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAP.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAP.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/io/LDAP.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAP.java index 03aad25cc..f431072b3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAP.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAP.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAPMessageHandler.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPMessageHandler.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/io/LDAPMessageHandler.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPMessageHandler.java index 89cc38cf7..c510dd695 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAPMessageHandler.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPMessageHandler.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAPReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPReader.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/io/LDAPReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPReader.java index 334251ac4..2104f81f9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAPReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAPWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPWriter.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/io/LDAPWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPWriter.java index b4c91e13c..e74fe0c1c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/io/LDAPWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/LDAPWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/package-info.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/package-info.java new file mode 100644 index 000000000..4a66ff4e1 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/io/package-info.java @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2013 ForgeRock AS. + */ + +/** + * Classes and interfaces providing I/O functionality. + *

+ * It includes facilities for encoding and decoding ASN.1 data streams, as + * well as LDAP protocol messages. + *

+ * Note that this particular implementation is limited to the subset of elements + * that are typically used by LDAP clients. As such, it does not include all + * ASN.1 element types, particularly elements like OIDs, bit strings, and + * timestamp values. + */ +package org.forgerock.opendj.io; + diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AVA.java similarity index 60% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AVA.java index 876714bc5..935053a23 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AVA.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AVA.java @@ -1,34 +1,25 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; -import static com.forgerock.opendj.util.StaticUtils.*; import static com.forgerock.opendj.ldap.CoreMessages.*; +import static com.forgerock.opendj.util.StaticUtils.*; + +import static org.forgerock.util.Reject.*; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; @@ -42,9 +33,7 @@ import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.ldap.schema.MatchingRule; import org.forgerock.opendj.ldap.schema.Schema; -import org.forgerock.opendj.ldap.schema.Syntax; import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException; -import org.forgerock.util.Reject; import com.forgerock.opendj.util.StaticUtils; import com.forgerock.opendj.util.SubstringReader; @@ -62,6 +51,10 @@ * cn=Kurt Zeilenga *

* + * Note: The name AVA is historical, coming from X500/LDAPv2. + * However, in LDAP context, this class actually represents an + * AttributeTypeAndValue. + * * @see RFC 4512 - * Lightweight Directory Access Protocol (LDAP): Directory Information * Models @@ -121,7 +114,8 @@ static AVA decode(final SubstringReader reader, final Schema schema) { throw new LocalizedIllegalArgumentException(message); } - final AttributeType attribute = readAttributeName(reader, schema); + final String nameOrOid = readAttributeName(reader); + final AttributeType attribute = schema.getAttributeType(nameOrOid); // Skip over any spaces if we have. reader.skipWhitespaces(); @@ -150,8 +144,7 @@ static AVA decode(final SubstringReader reader, final Schema schema) { // Parse the value for this RDN component. final ByteString value = readAttributeValue(reader); - - return new AVA(attribute, value); + return new AVA(attribute, nameOrOid, value); } static void escapeAttributeValue(final String str, final StringBuilder builder) { @@ -174,7 +167,7 @@ static void escapeAttributeValue(final String str, final StringBuilder builder) } else { if ((c == ' ' && si == length - 1) || (c == '"' || c == '+' || c == ',' || c == ';' || c == '<' - || c == '=' || c == '>' || c == '\\' || c == '\u0000')) { + || c == '>' || c == '\\' || c == '\u0000')) { builder.append('\\'); } builder.append(c); @@ -183,220 +176,7 @@ static void escapeAttributeValue(final String str, final StringBuilder builder) } } - private static void appendHexChars(final SubstringReader reader, - final StringBuilder valueBuffer, final StringBuilder hexBuffer) throws DecodeException { - final int length = hexBuffer.length(); - if (length == 0) { - return; - } - - if (length % 2 != 0) { - final LocalizableMessage message = ERR_HEX_DECODE_INVALID_LENGTH.get(hexBuffer); - throw DecodeException.error(message); - } - - int pos = 0; - final int arrayLength = length / 2; - final byte[] hexArray = new byte[arrayLength]; - for (int i = 0; i < arrayLength; i++) { - switch (hexBuffer.charAt(pos++)) { - case '0': - hexArray[i] = 0x00; - break; - case '1': - hexArray[i] = 0x10; - break; - case '2': - hexArray[i] = 0x20; - break; - case '3': - hexArray[i] = 0x30; - break; - case '4': - hexArray[i] = 0x40; - break; - case '5': - hexArray[i] = 0x50; - break; - case '6': - hexArray[i] = 0x60; - break; - case '7': - hexArray[i] = 0x70; - break; - case '8': - hexArray[i] = (byte) 0x80; - break; - case '9': - hexArray[i] = (byte) 0x90; - break; - case 'A': - case 'a': - hexArray[i] = (byte) 0xA0; - break; - case 'B': - case 'b': - hexArray[i] = (byte) 0xB0; - break; - case 'C': - case 'c': - hexArray[i] = (byte) 0xC0; - break; - case 'D': - case 'd': - hexArray[i] = (byte) 0xD0; - break; - case 'E': - case 'e': - hexArray[i] = (byte) 0xE0; - break; - case 'F': - case 'f': - hexArray[i] = (byte) 0xF0; - break; - default: - final LocalizableMessage message = - ERR_HEX_DECODE_INVALID_CHARACTER.get(hexBuffer, hexBuffer.charAt(pos - 1)); - throw DecodeException.error(message); - } - - switch (hexBuffer.charAt(pos++)) { - case '0': - // No action required. - break; - case '1': - hexArray[i] |= 0x01; - break; - case '2': - hexArray[i] |= 0x02; - break; - case '3': - hexArray[i] |= 0x03; - break; - case '4': - hexArray[i] |= 0x04; - break; - case '5': - hexArray[i] |= 0x05; - break; - case '6': - hexArray[i] |= 0x06; - break; - case '7': - hexArray[i] |= 0x07; - break; - case '8': - hexArray[i] |= 0x08; - break; - case '9': - hexArray[i] |= 0x09; - break; - case 'A': - case 'a': - hexArray[i] |= 0x0A; - break; - case 'B': - case 'b': - hexArray[i] |= 0x0B; - break; - case 'C': - case 'c': - hexArray[i] |= 0x0C; - break; - case 'D': - case 'd': - hexArray[i] |= 0x0D; - break; - case 'E': - case 'e': - hexArray[i] |= 0x0E; - break; - case 'F': - case 'f': - hexArray[i] |= 0x0F; - break; - default: - final LocalizableMessage message = - ERR_HEX_DECODE_INVALID_CHARACTER.get(hexBuffer, hexBuffer.charAt(pos - 1)); - throw DecodeException.error(message); - } - } - try { - valueBuffer.append(new String(hexArray, "UTF-8")); - } catch (final Exception e) { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE.get(reader.getString(), String - .valueOf(e)); - throw DecodeException.error(message); - } - // Clean up the hex buffer. - hexBuffer.setLength(0); - } - - private static ByteString delimitAndEvaluateEscape(final SubstringReader reader) - throws DecodeException { - char c = '\u0000'; - final StringBuilder valueBuffer = new StringBuilder(); - final StringBuilder hexBuffer = new StringBuilder(); - reader.skipWhitespaces(); - - boolean escaped = false; - while (reader.remaining() > 0) { - c = reader.read(); - if (escaped) { - // This character is escaped. - if (isHexDigit(c)) { - // Unicode characters. - if (reader.remaining() <= 0) { - final LocalizableMessage msg = - ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID - .get(reader.getString()); - throw DecodeException.error(msg); - } - - // Check the next byte for hex. - final char c2 = reader.read(); - if (isHexDigit(c2)) { - hexBuffer.append(c); - hexBuffer.append(c2); - // We may be at the end. - if (reader.remaining() == 0) { - appendHexChars(reader, valueBuffer, hexBuffer); - } - } else { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID - .get(reader.getString()); - throw DecodeException.error(message); - } - } else { - appendHexChars(reader, valueBuffer, hexBuffer); - valueBuffer.append(c); - } - escaped = false; - } else if (c == 0x5C /* The backslash character */) { - // We found an escape. - escaped = true; - } else { - // Check for delimited chars. - if (c == '+' || c == ',' || c == ';') { - reader.reset(); - // Return what we have got here so far. - appendHexChars(reader, valueBuffer, hexBuffer); - return ByteString.valueOfUtf8(valueBuffer); - } - // It is definitely not a delimiter at this point. - appendHexChars(reader, valueBuffer, hexBuffer); - valueBuffer.append(c); - } - reader.mark(); - } - - reader.reset(); - return ByteString.valueOfUtf8(valueBuffer); - } - - private static AttributeType readAttributeName(final SubstringReader reader, final Schema schema) { + private static String readAttributeName(final SubstringReader reader) { int length = 1; reader.mark(); @@ -407,63 +187,50 @@ private static AttributeType readAttributeName(final SubstringReader reader, fin boolean lastWasPeriod = false; while (reader.remaining() > 0) { c = reader.read(); - if (c == '=' || c == ' ') { // This signals the end of the OID. break; } else if (c == '.') { if (lastWasPeriod) { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, - reader.pos() - 1); - throw new LocalizedIllegalArgumentException(message); - } else { - lastWasPeriod = true; + throw illegalCharacter(reader, c); } + lastWasPeriod = true; } else if (!isDigit(c)) { - // This must have been an illegal character. - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, reader - .pos() - 1); - throw new LocalizedIllegalArgumentException(message); + throw illegalCharacter(reader, c); } else { lastWasPeriod = false; } length++; } + if (lastWasPeriod) { + throw illegalCharacter(reader, '.'); + } } else if (isAlpha(c)) { // This must be an attribute description. In this case, we will // only accept alphabetic characters, numeric digits, and the // hyphen. while (reader.remaining() > 0) { c = reader.read(); - if (c == '=' || c == ' ') { // This signals the end of the OID. break; } else if (!isAlpha(c) && !isDigit(c) && c != '-') { - // This is an illegal character. - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, reader - .pos() - 1); - throw new LocalizedIllegalArgumentException(message); + throw illegalCharacter(reader, c); } - length++; } } else { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, - reader.pos() - 1); - throw new LocalizedIllegalArgumentException(message); + throw illegalCharacter(reader, c); } - + // Return the position of the first non-space character after the token reader.reset(); + return reader.read(length); + } - // Return the position of the first non-space character after the - // token. - - return schema.getAttributeType(reader.read(length)); + private static LocalizedIllegalArgumentException illegalCharacter( + final SubstringReader reader, final char c) { + return new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_ATTR_ILLEGAL_CHAR.get(reader.getString(), c, reader.pos() - 1)); } private static ByteString readAttributeValue(final SubstringReader reader) { @@ -473,130 +240,189 @@ private static ByteString readAttributeValue(final SubstringReader reader) { return ByteString.empty(); } + // Decide how to parse based on the first character. reader.mark(); - - // Look at the first character. If it is an octothorpe (#), then - // that means that the value should be a hex string. char c = reader.read(); - int length = 0; if (c == '+') { - // Value is empty and followed by another AVA + // Value is empty and followed by another AVA. reader.reset(); return ByteString.empty(); } else if (c == '#') { - // The first two characters must be hex characters. + // Value is HEX encoded BER. + return readAttributeValueAsBER(reader); + } else if (c == '"') { + // Legacy support for RFC 2253. The value should continue until the + // corresponding closing quotation mark and has the same format as + // RFC 4514 attribute values, except that special characters, + // excluding double quote and back-slash, do not need escaping. reader.mark(); - if (reader.remaining() < 2) { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT.get(reader.getString()); - throw new LocalizedIllegalArgumentException(message); + return readAttributeValue(reader, true); + } else { + // Otherwise, use general parsing to find the end of the value. + return readAttributeValue(reader, false); + } + } + + private static ByteString readAttributeValueAsBER(final SubstringReader reader) { + // The first two characters must be hex characters. + reader.mark(); + if (reader.remaining() < 2) { + throw new LocalizedIllegalArgumentException(ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT.get(reader.getString())); + } + + int length = 0; + for (int i = 0; i < 2; i++) { + final char c = reader.read(); + if (isHexDigit(c)) { + length++; + } else { + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c)); } + } - for (int i = 0; i < 2; i++) { - c = reader.read(); - if (isHexDigit(c)) { - length++; + // The rest of the value must be a multiple of two hex + // characters. The end of the value may be designated by the + // end of the DN, a comma or semicolon, or a space. + while (reader.remaining() > 0) { + char c = reader.read(); + if (isHexDigit(c)) { + length++; + + if (reader.remaining() > 0) { + c = reader.read(); + if (isHexDigit(c)) { + length++; + } else { + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c)); + } } else { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c); - throw new LocalizedIllegalArgumentException(message); + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT.get(reader.getString())); } + } else if (c == ' ' || c == ',' || c == ';') { + // This denotes the end of the value. + break; + } else { + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c)); } + } - // The rest of the value must be a multiple of two hex - // characters. The end of the value may be designated by the - // end of the DN, a comma or semicolon, or a space. - while (reader.remaining() > 0) { - c = reader.read(); + // At this point, we should have a valid hex string. Convert it + // to a byte array and set that as the value of the provided + // octet string. + try { + reader.reset(); + return ByteString.valueOfHex(reader.read(length)); + } catch (final LocalizedIllegalArgumentException e) { + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE.get(reader.getString(), e.getMessageObject())); + } + } + + private static ByteString readAttributeValue(final SubstringReader reader, final boolean isQuoted) { + reader.reset(); + final ByteString bytes = delimitAndEvaluateEscape(reader, isQuoted); + if (bytes.length() == 0) { + // We don't allow an empty attribute value. + final LocalizableMessage message = + ERR_ATTR_SYNTAX_DN_INVALID_REQUIRES_ESCAPE_CHAR.get(reader.getString(), reader.pos()); + throw new LocalizedIllegalArgumentException(message); + } + return bytes; + } + + private static ByteString delimitAndEvaluateEscape(final SubstringReader reader, final boolean isQuoted) { + final StringBuilder valueBuffer = new StringBuilder(); + StringBuilder hexBuffer = null; + boolean escaped = false; + int trailingSpaces = 0; + while (reader.remaining() > 0) { + final char c = reader.read(); + if (escaped) { + // This character is escaped. if (isHexDigit(c)) { - length++; - - if (reader.remaining() > 0) { - c = reader.read(); - if (isHexDigit(c)) { - length++; - } else { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c); - throw new LocalizedIllegalArgumentException(message); + // Unicode characters. + if (reader.remaining() <= 0) { + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID.get(reader.getString())); + } + + // Check the next byte for hex. + final char c2 = reader.read(); + if (isHexDigit(c2)) { + if (hexBuffer == null) { + hexBuffer = new StringBuilder(); + } + hexBuffer.append(c); + hexBuffer.append(c2); + // We may be at the end. + if (reader.remaining() == 0) { + appendHexChars(reader, valueBuffer, hexBuffer); } } else { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_HEX_VALUE_TOO_SHORT.get(reader.getString()); - throw new LocalizedIllegalArgumentException(message); + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_ESCAPED_HEX_VALUE_INVALID.get(reader.getString())); } - } else if (c == ' ' || c == ',' || c == ';') { - // This denotes the end of the value. - break; } else { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_INVALID_HEX_DIGIT.get(reader.getString(), c); - throw new LocalizedIllegalArgumentException(message); + appendHexChars(reader, valueBuffer, hexBuffer); + valueBuffer.append(c); } - } - - // At this point, we should have a valid hex string. Convert it - // to a byte array and set that as the value of the provided - // octet string. - try { + escaped = false; + } else if (c == '\\') { + escaped = true; + trailingSpaces = 0; + } else if (isQuoted && c == '"') { + appendHexChars(reader, valueBuffer, hexBuffer); + reader.skipWhitespaces(); + return ByteString.valueOfUtf8(valueBuffer); + } else if (!isQuoted && (c == '+' || c == ',' || c == ';')) { reader.reset(); - return ByteString.valueOfHex(reader.read(length)); - } catch (final LocalizedIllegalArgumentException e) { - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE.get(reader.getString(), e - .getMessageObject()); - throw new LocalizedIllegalArgumentException(message); + appendHexChars(reader, valueBuffer, hexBuffer); + valueBuffer.setLength(valueBuffer.length() - trailingSpaces); + return ByteString.valueOfUtf8(valueBuffer); + } else { + // It is definitely not a delimiter at this point. + appendHexChars(reader, valueBuffer, hexBuffer); + valueBuffer.append(c); + trailingSpaces = c != ' ' ? 0 : trailingSpaces + 1; } - } else if (c == '"') { - // If the first character is a quotation mark, then the value - // should continue until the corresponding closing quotation mark. reader.mark(); - while (true) { - if (reader.remaining() <= 0) { - // We hit the end of the AVA before the closing quote. - // That's an error. - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_UNMATCHED_QUOTE.get(reader.getString()); - throw new LocalizedIllegalArgumentException(message); - } + } + if (isQuoted) { + // We hit the end of the AVA before the closing quote. That's an error. + throw new LocalizedIllegalArgumentException(ERR_ATTR_SYNTAX_DN_UNMATCHED_QUOTE.get(reader.getString())); + } + reader.reset(); + valueBuffer.setLength(valueBuffer.length() - trailingSpaces); + return ByteString.valueOfUtf8(valueBuffer); + } - if (reader.read() == '"') { - // This is the end of the value. - break; - } - length++; - } - reader.reset(); - final ByteString retString = ByteString.valueOfUtf8(reader.read(length)); - reader.read(); - return retString; - } else { - // Otherwise, use general parsing to find the end of the value. - reader.reset(); - ByteString bytes; - try { - bytes = delimitAndEvaluateEscape(reader); - } catch (final DecodeException e) { - throw new LocalizedIllegalArgumentException(e.getMessageObject()); - } - if (bytes.length() == 0) { - // We don't allow an empty attribute value. - final LocalizableMessage message = - ERR_ATTR_SYNTAX_DN_INVALID_REQUIRES_ESCAPE_CHAR.get(reader.getString(), - reader.pos()); - throw new LocalizedIllegalArgumentException(message); - } - return bytes; + private static void appendHexChars(final SubstringReader reader, + final StringBuilder valueBuffer, + final StringBuilder hexBuffer) { + if (hexBuffer == null) { + return; + } + final ByteString bytes = ByteString.valueOfHex(hexBuffer.toString()); + try { + valueBuffer.append(new String(bytes.toByteArray(), "UTF-8")); + } catch (final Exception e) { + throw new LocalizedIllegalArgumentException( + ERR_ATTR_SYNTAX_DN_ATTR_VALUE_DECODE_FAILURE.get(reader.getString(), String.valueOf(e))); } + // Clean up the hex buffer. + hexBuffer.setLength(0); } private final AttributeType attributeType; - + private final String attributeName; private final ByteString attributeValue; /** Cached normalized value using equality matching rule. */ private ByteString equalityNormalizedAttributeValue; - /** Cached normalized value using ordering matching rule. */ private ByteString orderingNormalizedAttributeValue; @@ -616,10 +442,29 @@ private static ByteString readAttributeValue(final SubstringReader reader) { * {@code null}. */ public AVA(final AttributeType attributeType, final Object attributeValue) { - Reject.ifNull(attributeType, attributeValue); + this(attributeType, null, attributeValue); + } - this.attributeType = attributeType; - this.attributeValue = ByteString.valueOfObject(attributeValue); + /** + * Creates a new attribute value assertion (AVA) using the provided + * attribute type, name and value. + *

+ * If {@code attributeValue} is not an instance of {@code ByteString} then + * it will be converted using the {@link ByteString#valueOfObject(Object)} method. + * + * @param attributeType + * The attribute type. + * @param attributeName + * The user provided attribute name. + * @param attributeValue + * The attribute value. + * @throws NullPointerException + * If {@code attributeType}, {@code attributeName} or {@code attributeValue} was {@code null}. + */ + public AVA(final AttributeType attributeType, final String attributeName, final Object attributeValue) { + this.attributeType = checkNotNull(attributeType); + this.attributeName = computeAttributeName(attributeName, attributeType); + this.attributeValue = ByteString.valueOfObject(checkNotNull(attributeValue)); } /** @@ -640,13 +485,15 @@ public AVA(final AttributeType attributeType, final Object attributeValue) { * {@code null}. */ public AVA(final String attributeType, final Object attributeValue) { - Reject.ifNull(attributeType, attributeValue); - + this.attributeName = checkNotNull(attributeType); this.attributeType = Schema.getDefaultSchema().getAttributeType(attributeType); - this.attributeValue = ByteString.valueOfObject(attributeValue); + this.attributeValue = ByteString.valueOfObject(checkNotNull(attributeValue)); + } + + private String computeAttributeName(final String attributeName, final AttributeType attributeType) { + return attributeName != null ? attributeName : attributeType.getNameOrOID(); } - /** {@inheritDoc} */ @Override public int compareTo(final AVA ava) { final int result = attributeType.compareTo(ava.attributeType); @@ -659,7 +506,6 @@ public int compareTo(final AVA ava) { return normalizedValue.compareTo(otherNormalizedValue); } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -688,6 +534,15 @@ public AttributeType getAttributeType() { return attributeType; } + /** + * Returns the attribute name associated with this AVA. + * + * @return The attribute name associated with this AVA. + */ + public String getAttributeName() { + return attributeName; + } + /** * Returns the attribute value associated with this AVA. * @@ -697,7 +552,6 @@ public ByteString getAttributeValue() { return attributeValue; } - /** {@inheritDoc} */ @Override public int hashCode() { return attributeType.hashCode() * 31 + getEqualityNormalizedValue().hashCode(); @@ -715,7 +569,6 @@ public Attribute toAttribute() { return new LinkedAttribute(ad, attributeValue); } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -723,17 +576,15 @@ public String toString() { } StringBuilder toString(final StringBuilder builder) { - if (!attributeType.getNames().iterator().hasNext()) { + if (attributeName.equals(attributeType.getOID())) { builder.append(attributeType.getOID()); builder.append("=#"); builder.append(attributeValue.toHexString()); } else { - final String name = attributeType.getNameOrOID(); - builder.append(name); + builder.append(attributeName); builder.append("="); - final Syntax syntax = attributeType.getSyntax(); - if (!syntax.isHumanReadable()) { + if (!attributeType.getSyntax().isHumanReadable()) { builder.append("#"); builder.append(attributeValue.toHexString()); } else { @@ -879,15 +730,12 @@ private ByteString escapeBytes(final ByteString value) { } private boolean needEscaping(final ByteString value) { - boolean needEscaping = false; for (int i = 0; i < value.length(); i++) { - final byte b = value.byteAt(i); - if (isByteToEscape(b)) { - needEscaping = true; - break; + if (isByteToEscape(value.byteAt(i))) { + return true; } } - return needEscaping; + return false; } private boolean isByteToEscape(final byte b) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java index 31d8c678d..a29ba8589 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnection.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import org.forgerock.opendj.ldap.requests.AddRequest; @@ -47,58 +36,47 @@ * asynchronous methods. */ public abstract class AbstractAsynchronousConnection extends AbstractConnection { - - /** - * Creates a new abstract asynchronous connection. - */ + /** Creates a new abstract asynchronous connection. */ protected AbstractAsynchronousConnection() { // No implementation required. } - /** {@inheritDoc} */ @Override public Result add(final AddRequest request) throws LdapException { return blockingGetOrThrow(addAsync(request)); } - /** {@inheritDoc} */ @Override public BindResult bind(final BindRequest request) throws LdapException { return blockingGetOrThrow(bindAsync(request)); } - /** {@inheritDoc} */ @Override public CompareResult compare(final CompareRequest request) throws LdapException { return blockingGetOrThrow(compareAsync(request)); } - /** {@inheritDoc} */ @Override public Result delete(final DeleteRequest request) throws LdapException { return blockingGetOrThrow(deleteAsync(request)); } - /** {@inheritDoc} */ @Override public R extendedRequest(final ExtendedRequest request, final IntermediateResponseHandler handler) throws LdapException { return blockingGetOrThrow(extendedRequestAsync(request, handler)); } - /** {@inheritDoc} */ @Override public Result modify(final ModifyRequest request) throws LdapException { return blockingGetOrThrow(modifyAsync(request)); } - /** {@inheritDoc} */ @Override public Result modifyDN(final ModifyDNRequest request) throws LdapException { return blockingGetOrThrow(modifyDNAsync(request)); } - /** {@inheritDoc} */ @Override public Result search(final SearchRequest request, final SearchResultHandler handler) throws LdapException { return blockingGetOrThrow(searchAsync(request, handler)); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java index a21098a27..3c43771a3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractAttribute.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.AbstractSet; @@ -140,18 +129,15 @@ static String toString(final Attribute attribute) { 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; @@ -161,13 +147,12 @@ public boolean add(final Object... values) { return modified; } - /** {@inheritDoc} */ @Override public boolean addAll(final Collection values) { return addAll(values, null); } - /** {@inheritDoc} */ + @Override public boolean addAll(final Collection values, final Collection duplicateValues) { boolean modified = false; @@ -181,11 +166,9 @@ public boolean addAll(final Collection values, return modified; } - /** {@inheritDoc} */ @Override public abstract boolean contains(Object value); - /** {@inheritDoc} */ @Override public boolean containsAll(final Collection values) { for (final Object value : values) { @@ -196,56 +179,51 @@ public boolean containsAll(final Collection 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 iterator(); - /** {@inheritDoc} */ @Override public abstract boolean remove(Object value); - /** {@inheritDoc} */ @Override public boolean removeAll(final Collection values) { return removeAll(values, null); } - /** {@inheritDoc} */ + @Override public boolean removeAll(final Collection values, final Collection missingValues) { boolean modified = false; @@ -259,13 +237,12 @@ public boolean removeAll(final Collection values, return modified; } - /** {@inheritDoc} */ @Override public boolean retainAll(final Collection values) { return retainAll(values, null); } - /** {@inheritDoc} */ + @Override public boolean retainAll(final Collection values, final Collection missingValues) { if (values.isEmpty()) { @@ -307,17 +284,14 @@ public boolean retainAll(final Collection values, 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); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java index f21e5ac8f..c039f34fe 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnection.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.Collection; @@ -63,7 +52,6 @@ * interface, to minimize the effort required to implement this interface. */ public abstract class AbstractConnection implements Connection { - private static final class SingleEntryHandler implements SearchResultHandler { private volatile SearchResultEntry firstEntry; private volatile SearchResultReference firstReference; @@ -176,9 +164,7 @@ public Object visitChangeRecord(final Connection p, final ModifyRequest change) } }; - /** - * Creates a new abstract connection. - */ + /** Creates a new abstract connection. */ protected AbstractConnection() { // No implementation required. } @@ -451,5 +437,4 @@ private SearchRequest enforceSingleEntrySearchRequest(final SearchRequest reques */ @Override public abstract String toString(); - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java index f492b0242..126a0f319 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractConnectionWrapper.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.Collection; @@ -60,9 +49,7 @@ * The type of wrapped connection. */ public abstract class AbstractConnectionWrapper implements Connection { - /** - * The wrapped connection. - */ + /** The wrapped connection. */ protected final C connection; /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java index 3fbc33dd1..766107ba4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractEntry.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java index 731a5acf7..33ec38c4a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractFilterVisitor.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.List; @@ -44,10 +34,7 @@ * additional parameter. */ public abstract class AbstractFilterVisitor implements FilterVisitor { - - /** - * Default constructor. - */ + /** Default constructor. */ protected AbstractFilterVisitor() { // Nothing to do. } @@ -57,6 +44,7 @@ protected AbstractFilterVisitor() { *

* The default implementation is to call {@link #visitDefaultFilter(Object)}. */ + @Override public R visitAndFilter(final P p, final List subFilters) { return visitDefaultFilter(p); } @@ -66,6 +54,7 @@ public R visitAndFilter(final P p, final List subFilters) { *

* 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); @@ -90,6 +79,7 @@ public R visitDefaultFilter(final 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); @@ -100,6 +90,7 @@ public R visitEqualityMatchFilter(final P p, final String attributeDescription, *

* 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) { @@ -111,6 +102,7 @@ public R visitExtensibleMatchFilter(final P p, final String matchingRule, *

* 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); @@ -121,6 +113,7 @@ public R visitGreaterOrEqualFilter(final P p, final String attributeDescription, *

* 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); @@ -131,6 +124,7 @@ public R visitLessOrEqualFilter(final P p, final String attributeDescription, *

* The default implementation is to call {@link #visitDefaultFilter(Object)}. */ + @Override public R visitNotFilter(final P p, final Filter subFilter) { return visitDefaultFilter(p); } @@ -140,6 +134,7 @@ public R visitNotFilter(final P p, final Filter subFilter) { *

* The default implementation is to call {@link #visitDefaultFilter(Object)}. */ + @Override public R visitOrFilter(final P p, final List subFilters) { return visitDefaultFilter(p); } @@ -149,6 +144,7 @@ public R visitOrFilter(final P p, final List subFilters) { *

* The default implementation is to call {@link #visitDefaultFilter(Object)}. */ + @Override public R visitPresentFilter(final P p, final String attributeDescription) { return visitDefaultFilter(p); } @@ -158,6 +154,7 @@ public R visitPresentFilter(final P p, final String attributeDescription) { *

* The default implementation is to call {@link #visitDefaultFilter(Object)}. */ + @Override public R visitSubstringsFilter(final P p, final String attributeDescription, final ByteString initialSubstring, final List anySubstrings, final ByteString finalSubstring) { @@ -169,6 +166,7 @@ public R visitSubstringsFilter(final P p, final String attributeDescription, *

* 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); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java similarity index 74% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java index 14a60c2a0..5cb8d3d1e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractMapEntry.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -31,9 +21,7 @@ import org.forgerock.util.Reject; -/** - * Abstract implementation for {@code Map} based entries. - */ +/** Abstract implementation for {@code Map} based entries. */ abstract class AbstractMapEntry extends AbstractEntry { private final Map attributes; private DN name; @@ -52,7 +40,6 @@ abstract class AbstractMapEntry extends AbstractEntry { this.attributes = attributes; } - /** {@inheritDoc} */ @Override public final boolean addAttribute(final Attribute attribute, final Collection duplicateValues) { @@ -66,20 +53,17 @@ public final boolean addAttribute(final Attribute attribute, } } - /** {@inheritDoc} */ @Override public final Entry clearAttributes() { attributes.clear(); return this; } - /** {@inheritDoc} */ @Override public final Iterable getAllAttributes() { return attributes.values(); } - /** {@inheritDoc} */ @Override public final Attribute getAttribute(final AttributeDescription attributeDescription) { final Attribute attribute = attributes.get(attributeDescription); @@ -91,19 +75,16 @@ public final Attribute getAttribute(final AttributeDescription attributeDescript } } - /** {@inheritDoc} */ @Override public final int getAttributeCount() { return attributes.size(); } - /** {@inheritDoc} */ @Override public final DN getName() { return name; } - /** {@inheritDoc} */ @Override public final boolean removeAttribute(final Attribute attribute, final Collection missingValues) { @@ -133,12 +114,10 @@ public final boolean removeAttribute(final Attribute attribute, } } - /** {@inheritDoc} */ @Override public final Entry setName(final DN dn) { Reject.ifNull(dn); this.name = dn; return this; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java index 6e8f2c4fb..c3286822f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AbstractSynchronousConnection.java @@ -1,29 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2012-2014 ForgeRock AS + * Copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import org.forgerock.opendj.ldap.requests.AbandonRequest; @@ -51,10 +40,7 @@ * the equivalent synchronous methods. */ public abstract class AbstractSynchronousConnection extends AbstractConnection { - - /** - * Creates a new abstract synchronous connection. - */ + /** Creates a new abstract synchronous connection. */ protected AbstractSynchronousConnection() { // No implementation required. } @@ -164,5 +150,4 @@ private LdapPromise onException(final LdapException e) { private LdapPromise thenOnResult(final R result) { return newSuccessfulLdapPromise(result); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AddressMask.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AddressMask.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AddressMask.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AddressMask.java index 751b88c82..13d222e7d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AddressMask.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AddressMask.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Assertion.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Assertion.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Assertion.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Assertion.java index 3c60abc7c..dbb76acff 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Assertion.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Assertion.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java new file mode 100644 index 000000000..4a63a008c --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AssertionFailureException.java @@ -0,0 +1,33 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +import org.forgerock.opendj.ldap.responses.Result; + +/** + * Thrown when the result code returned in a Result indicates that the Request + * failed because the filter contained in an assertion control failed to match + * the target entry. More specifically, this exception is used for the + * {@link ResultCode#ASSERTION_FAILED ASSERTION_FAILED} result code. + */ +@SuppressWarnings("serial") +public class AssertionFailureException extends LdapException { + AssertionFailureException(final Result result) { + super(result); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java index ae31be17b..63c482a3e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Attribute.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -60,6 +50,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code value} was {@code null}. */ + @Override boolean add(ByteString value); /** @@ -99,6 +90,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code values} was {@code null}. */ + @Override boolean addAll(Collection values); /** @@ -134,6 +126,7 @@ public interface Attribute extends Set { * If this attribute does not support removal of attribute * values. */ + @Override void clear(); /** @@ -150,6 +143,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code value} was {@code null}. */ + @Override boolean contains(Object value); /** @@ -167,6 +161,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code values} was {@code null}. */ + @Override boolean containsAll(Collection values); /** @@ -181,6 +176,7 @@ public interface Attribute extends Set { * @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); /** @@ -226,6 +222,7 @@ public interface Attribute extends Set { * * @return The hash code for this attribute. */ + @Override int hashCode(); /** @@ -233,6 +230,7 @@ public interface Attribute extends Set { * * @return {@code true} if this attribute contains no attribute values. */ + @Override boolean isEmpty(); /** @@ -242,6 +240,7 @@ public interface Attribute extends Set { * * @return An iterator over the attribute values in this attribute. */ + @Override Iterator iterator(); /** @@ -269,6 +268,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code value} was {@code null}. */ + @Override boolean remove(Object value); /** @@ -293,6 +293,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code values} was {@code null}. */ + @Override boolean removeAll(Collection values); /** @@ -342,6 +343,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code values} was {@code null}. */ + @Override boolean retainAll(Collection values); /** @@ -373,6 +375,7 @@ public interface Attribute extends Set { * * @return The number of attribute values in this attribute. */ + @Override int size(); /** @@ -390,6 +393,7 @@ public interface Attribute extends Set { * @return An array containing all of the attribute values contained in this * attribute. */ + @Override ByteString[] toArray(); /** @@ -421,6 +425,7 @@ public interface Attribute extends Set { * @throws NullPointerException * If {@code array} was {@code null}. */ + @Override T[] toArray(T[] array); /** @@ -428,5 +433,6 @@ public interface Attribute extends Set { * * @return The string representation of this attribute. */ + @Override String toString(); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java index bb650f063..754c6546a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeDescription.java @@ -1,32 +1,24 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.LinkedList; @@ -84,13 +76,11 @@ protected Impl() { public abstract boolean isSuperTypeOf(Impl other); public abstract int size(); - } private static final class MultiOptionImpl extends Impl { private final String[] normalizedOptions; - private final String[] options; private MultiOptionImpl(final String[] options, final String[] normalizedOptions) { @@ -175,9 +165,7 @@ public boolean isSubTypeOf(final Impl other) { 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)) { @@ -199,6 +187,7 @@ public boolean isSuperTypeOf(final Impl other) { return true; } + @Override public Iterator iterator() { return Iterators.arrayIterator(options); } @@ -213,7 +202,6 @@ public int size() { private static final class SingleOptionImpl extends Impl { private final String normalizedOption; - private final String option; private SingleOptionImpl(final String option, final String normalizedOption) { @@ -272,6 +260,7 @@ public boolean isSuperTypeOf(final Impl other) { return other.hasOption(normalizedOption); } + @Override public Iterator iterator() { return Iterators.singletonIterator(option); } @@ -333,6 +322,7 @@ public boolean isSuperTypeOf(final Impl other) { return true; } + @Override public Iterator iterator() { return Iterators.emptyIterator(); } @@ -347,7 +337,6 @@ public int size() { private static final ThreadLocal>> CACHE = new ThreadLocal>>() { - /** {@inheritDoc} */ @Override protected WeakHashMap> initialValue() { return new WeakHashMap<>(); @@ -360,9 +349,8 @@ protected WeakHashMap> initialValue() private static final AttributeDescription OBJECT_CLASS; static { final AttributeType attributeType = Schema.getCoreSchema().getAttributeType("2.5.4.0"); - OBJECT_CLASS = - new AttributeDescription(attributeType.getNameOrOID(), attributeType, - ZERO_OPTION_IMPL); + final String attributeName = attributeType.getNameOrOID(); + OBJECT_CLASS = new AttributeDescription(attributeName, attributeName, attributeType, ZERO_OPTION_IMPL); } /** @@ -387,21 +375,15 @@ public AttributeDescription withOption(final String option) { Reject.ifNull(option); final String normalizedOption = toLowerCase(option); - if (pimpl.hasOption(normalizedOption)) { + if (optionsPimpl.hasOption(normalizedOption)) { return this; } - final String oldAttributeDescription = attributeDescription; - final StringBuilder builder = - new StringBuilder(oldAttributeDescription.length() + option.length() + 1); - builder.append(oldAttributeDescription); - builder.append(';'); - builder.append(option); - final String newAttributeDescription = builder.toString(); + final String newAttributeDescription = appendOption(attributeDescription, option); - final Impl impl = pimpl; + final Impl impl = optionsPimpl; if (impl instanceof ZeroOptionImpl) { - return new AttributeDescription(newAttributeDescription, attributeType, + return new AttributeDescription(newAttributeDescription, nameOrOid, attributeType, new SingleOptionImpl(option, normalizedOption)); } else if (impl instanceof SingleOptionImpl) { final SingleOptionImpl simpl = (SingleOptionImpl) impl; @@ -419,7 +401,7 @@ public AttributeDescription withOption(final String option) { newNormalizedOptions[1] = normalizedOption; } - return new AttributeDescription(newAttributeDescription, attributeType, + return new AttributeDescription(newAttributeDescription, nameOrOid, attributeType, new MultiOptionImpl(newOptions, newNormalizedOptions)); } else { final MultiOptionImpl mimpl = (MultiOptionImpl) impl; @@ -450,7 +432,7 @@ public AttributeDescription withOption(final String option) { newNormalizedOptions[sz2] = normalizedOption; } - return new AttributeDescription(newAttributeDescription, attributeType, + return new AttributeDescription(newAttributeDescription, nameOrOid, attributeType, new MultiOptionImpl(newOptions, newNormalizedOptions)); } } @@ -473,7 +455,7 @@ public AttributeDescription withoutOption(final String option) { Reject.ifNull(option); final String normalizedOption = toLowerCase(option); - if (!pimpl.hasOption(normalizedOption)) { + if (!optionsPimpl.hasOption(normalizedOption)) { return this; } @@ -488,11 +470,11 @@ public AttributeDescription withoutOption(final String option) { .length()); final String newAttributeDescription = builder.toString(); - final Impl impl = pimpl; + final Impl impl = optionsPimpl; if (impl instanceof ZeroOptionImpl) { throw new IllegalStateException("ZeroOptionImpl unexpected"); } else if (impl instanceof SingleOptionImpl) { - return new AttributeDescription(newAttributeDescription, attributeType, + return new AttributeDescription(newAttributeDescription, nameOrOid, attributeType, ZERO_OPTION_IMPL); } else { final MultiOptionImpl mimpl = (MultiOptionImpl) impl; @@ -512,7 +494,7 @@ public AttributeDescription withoutOption(final String option) { remainingNormalizedOption = mimpl.normalizedOptions[0]; } - return new AttributeDescription(newAttributeDescription, attributeType, + return new AttributeDescription(newAttributeDescription, nameOrOid, attributeType, new SingleOptionImpl(remainingOption, remainingNormalizedOption)); } else { final String[] newOptions = new String[mimpl.options.length - 1]; @@ -531,15 +513,14 @@ public AttributeDescription withoutOption(final String option) { } } - return new AttributeDescription(newAttributeDescription, attributeType, + return new AttributeDescription(newAttributeDescription, nameOrOid, attributeType, new MultiOptionImpl(newOptions, newNormalizedOptions)); } } } /** - * Creates an attribute description having the provided attribute type and - * no options. + * Creates an attribute description having the provided attribute type and no options. * * @param attributeType * The attribute type. @@ -548,21 +529,35 @@ public AttributeDescription withoutOption(final String option) { * If {@code attributeType} was {@code null}. */ public static AttributeDescription create(final AttributeType attributeType) { - Reject.ifNull(attributeType); + return create(attributeType.getNameOrOID(), attributeType); + } - // Use object identity in case attribute type does not come from - // core schema. + /** + * Creates an attribute description having the provided attribute name, type and no options. + * + * @param attributeName + * The attribute name. + * @param attributeType + * The attribute type. + * @return The attribute description. + * @throws NullPointerException + * If {@code attributeType} was {@code null}. + * @deprecated This method may be removed at any time + * @since OPENDJ-2803 Migrate Attribute + */ + @Deprecated + public static AttributeDescription create(final String attributeName, final AttributeType attributeType) { + Reject.ifNull(attributeName, attributeType); + + // Use object identity in case attribute type does not come from core schema. if (attributeType == OBJECT_CLASS.getAttributeType()) { return OBJECT_CLASS; - } else { - return new AttributeDescription(attributeType.getNameOrOID(), attributeType, - ZERO_OPTION_IMPL); } + return new AttributeDescription(attributeName, attributeName, attributeType, ZERO_OPTION_IMPL); } /** - * Creates an attribute description having the provided attribute type and - * single option. + * Creates an attribute description having the provided attribute type and single option. * * @param attributeType * The attribute type. @@ -573,23 +568,68 @@ public static AttributeDescription create(final AttributeType attributeType) { * If {@code attributeType} or {@code option} was {@code null}. */ public static AttributeDescription create(final AttributeType attributeType, final String option) { - Reject.ifNull(attributeType, option); + return create(attributeType.getNameOrOID(), attributeType, option); + } + + /** + * Creates an attribute description having the provided attribute name, type and single option. + * + * @param attributeName + * The attribute name. + * @param attributeType + * The attribute type. + * @param option + * The attribute option. + * @return The attribute description. + * @throws NullPointerException + * If {@code attributeType} or {@code option} was {@code null}. + * @deprecated This method may be removed at any time + * @since OPENDJ-2803 Migrate Attribute + */ + @Deprecated + public static AttributeDescription create( + final String attributeName, final AttributeType attributeType, final String option) { + Reject.ifNull(attributeName, attributeType, option); + + final String attributeDescription = appendOption(attributeName, option); + final String normalizedOption = toLowerCase(option); - final String oid = attributeType.getNameOrOID(); + return new AttributeDescription(attributeDescription, attributeName, attributeType, + new SingleOptionImpl(option, normalizedOption)); + } + + private static String appendOption(final String oid, final String option) { final StringBuilder builder = new StringBuilder(oid.length() + option.length() + 1); builder.append(oid); builder.append(';'); builder.append(option); - final String attributeDescription = builder.toString(); - final String normalizedOption = toLowerCase(option); + return builder.toString(); + } - return new AttributeDescription(attributeDescription, attributeType, new SingleOptionImpl( - option, normalizedOption)); + /** + * Creates an attribute description having the provided attribute name, type and options. + * + * @param attributeName + * The attribute name. + * @param attributeType + * The attribute type. + * @param options + * The attribute options. + * @return The attribute description. + * @throws NullPointerException + * If {@code attributeType} or {@code options} was {@code null}. + * @deprecated This method may be removed at any time + * @since OPENDJ-2803 Migrate Attribute + */ + @Deprecated + public static AttributeDescription create( + final String attributeName, final AttributeType attributeType, final String... options) { + Reject.ifNull(options); + return create(attributeName, attributeType, Arrays.asList(options)); } /** - * Creates an attribute description having the provided attribute type and - * options. + * Creates an attribute description having the provided attribute type and options. * * @param attributeType * The attribute type. @@ -599,40 +639,74 @@ public static AttributeDescription create(final AttributeType attributeType, fin * @throws NullPointerException * If {@code attributeType} or {@code options} was {@code null}. */ - public static AttributeDescription create(final AttributeType attributeType, - final String... options) { - Reject.ifNull(attributeType); + public static AttributeDescription create(final AttributeType attributeType, final String... options) { Reject.ifNull(options); + return create(attributeType.getNameOrOID(), attributeType, Arrays.asList(options)); + } + + /** + * Creates an attribute description having the provided attribute type and options. + * + * @param attributeType + * The attribute type. + * @param options + * The attribute options. + * @return The attribute description. + * @throws NullPointerException + * If {@code attributeType} or {@code options} was {@code null}. + */ + public static AttributeDescription create(final AttributeType attributeType, final Collection options) { + return create(attributeType.getNameOrOID(), attributeType, options); + } - switch (options.length) { + /** + * Creates an attribute description having the provided attribute name, type and options. + * + * @param attributeName + * The attribute name. + * @param attributeType + * The attribute type. + * @param options + * The attribute options. + * @return The attribute description. + * @throws NullPointerException + * If {@code attributeType} or {@code options} was {@code null}. + * @deprecated This method may be removed at any time + * @since OPENDJ-2803 Migrate Attribute + */ + @Deprecated + public static AttributeDescription create( + final String attributeName, final AttributeType attributeType, final Collection options) { + Reject.ifNull(attributeName, attributeType); + + final Collection opts = options != null ? options : Collections. emptySet(); + switch (opts.size()) { case 0: - return create(attributeType); + return create(attributeName, attributeType); case 1: - return create(attributeType, options[0]); + return create(attributeName, attributeType, opts.iterator().next()); default: - final String[] optionsList = new String[options.length]; - final String[] normalizedOptions = new String[options.length]; + final String[] optionsList = new String[opts.size()]; + final String[] normalizedOptions = new String[opts.size()]; - final String oid = attributeType.getNameOrOID(); + final Iterator it = opts.iterator(); final StringBuilder builder = - new StringBuilder(oid.length() + options[0].length() + options[1].length() + 2); - builder.append(oid); + new StringBuilder(attributeName.length() + it.next().length() + it.next().length() + 2); + builder.append(attributeName); int i = 0; - for (final String option : options) { + for (final String option : opts) { builder.append(';'); builder.append(option); optionsList[i] = option; - final String normalizedOption = toLowerCase(option); - normalizedOptions[i++] = normalizedOption; + normalizedOptions[i++] = toLowerCase(option); } Arrays.sort(normalizedOptions); final String attributeDescription = builder.toString(); - return new AttributeDescription(attributeDescription, attributeType, + return new AttributeDescription(attributeDescription, attributeName, attributeType, new MultiOptionImpl(optionsList, normalizedOptions)); } - } /** @@ -774,7 +848,6 @@ private static AttributeDescription valueOf0(final String attributeDescription, i++; while (i < length) { c = attributeDescription.charAt(i); - if (c == ';' || c == ' ') { break; } @@ -822,8 +895,7 @@ private static AttributeDescription valueOf0(final String attributeDescription, i = skipTrailingWhiteSpace(attributeDescription, i + 1, length); } - // Determine the portion of the string containing the attribute type - // name. + // Determine the portion of the string containing the attribute type name. String oid; if (attributeTypeStart == 0 && attributeTypeEnd == length) { oid = attributeDescription; @@ -843,15 +915,12 @@ private static AttributeDescription valueOf0(final String attributeDescription, // If we're already at the end of the attribute description then it // does not contain any options. if (i == length) { - // Use object identity in case attribute type does not come from - // core schema. + // Use object identity in case attribute type does not come from core schema. if (attributeType == OBJECT_CLASS.getAttributeType() && attributeDescription.equals(OBJECT_CLASS.toString())) { return OBJECT_CLASS; - } else { - return new AttributeDescription(attributeDescription, attributeType, - ZERO_OPTION_IMPL); } + return new AttributeDescription(attributeDescription, oid, attributeType, ZERO_OPTION_IMPL); } // At this point 'i' must point at a semi-colon. @@ -906,7 +975,7 @@ private static AttributeDescription valueOf0(final String attributeDescription, // If we're already at the end of the attribute description then it // only contains a single option. if (i == length) { - return new AttributeDescription(attributeDescription, attributeType, + return new AttributeDescription(attributeDescription, oid, attributeType, new SingleOptionImpl(option, normalizedOption)); } @@ -972,23 +1041,23 @@ private static AttributeDescription valueOf0(final String attributeDescription, normalizedOptions.add(normalizedOption); } - return new AttributeDescription(attributeDescription, attributeType, new MultiOptionImpl( - options.toArray(new String[options.size()]), normalizedOptions - .toArray(new String[normalizedOptions.size()]))); + return new AttributeDescription(attributeDescription, oid, attributeType, + new MultiOptionImpl(options.toArray(new String[options.size()]), + normalizedOptions.toArray(new String[normalizedOptions.size()]))); } private final String attributeDescription; - + private final String nameOrOid; private final AttributeType attributeType; - - private final Impl pimpl; + private final Impl optionsPimpl; /** Private constructor. */ - private AttributeDescription(final String attributeDescription, + private AttributeDescription(final String attributeDescription, final String attributeName, final AttributeType attributeType, final Impl pimpl) { this.attributeDescription = attributeDescription; + this.nameOrOid = attributeName; this.attributeType = attributeType; - this.pimpl = pimpl; + this.optionsPimpl = pimpl; } /** @@ -1004,13 +1073,14 @@ private AttributeDescription(final String attributeDescription, * @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) { return result; } else { // Attribute type is the same, so compare options. - return pimpl.compareTo(other.pimpl); + return optionsPimpl.compareTo(other.optionsPimpl); } } @@ -1027,7 +1097,7 @@ public int compareTo(final AttributeDescription other) { */ public boolean hasOption(final String option) { final String normalizedOption = toLowerCase(option); - return pimpl.hasOption(normalizedOption); + return optionsPimpl.hasOption(normalizedOption); } /** @@ -1048,7 +1118,7 @@ public boolean equals(final Object o) { return true; } else if (o instanceof AttributeDescription) { final AttributeDescription other = (AttributeDescription) o; - return attributeType.equals(other.attributeType) && pimpl.equals(other.pimpl); + return attributeType.equals(other.attributeType) && optionsPimpl.equals(other.optionsPimpl); } else { return false; } @@ -1063,6 +1133,20 @@ public AttributeType getAttributeType() { return attributeType; } + /** + * Returns the attribute name or the oid provided by the user associated with this attribute + * description. + * + * @return The attribute name or the oid provided by the user associated with this attribute + * description. + * @deprecated This method may be removed at any time + * @since OPENDJ-2803 Migrate Attribute + */ + @Deprecated + public String getNameOrOID() { + return nameOrOid; + } + /** * Returns an {@code Iterable} containing the options contained in this * attribute description. Attempts to remove options using an iterator's @@ -1072,7 +1156,7 @@ public AttributeType getAttributeType() { * @return An {@code Iterable} containing the options. */ public Iterable getOptions() { - return pimpl; + return optionsPimpl; } /** @@ -1085,7 +1169,7 @@ public Iterable getOptions() { @Override public int hashCode() { // FIXME: should we cache this? - return attributeType.hashCode() * 31 + pimpl.hashCode(); + return attributeType.hashCode() * 31 + optionsPimpl.hashCode(); } /** @@ -1095,7 +1179,7 @@ public int hashCode() { * {@code false} if not. */ public boolean hasOptions() { - return pimpl.hasOptions(); + return optionsPimpl.hasOptions(); } /** @@ -1154,7 +1238,7 @@ public boolean isPlaceHolder() { */ public boolean isSubTypeOf(final AttributeDescription other) { return attributeType.isSubTypeOf(other.attributeType) - && pimpl.isSubTypeOf(other.pimpl); + && optionsPimpl.isSubTypeOf(other.optionsPimpl); } /** @@ -1181,7 +1265,7 @@ public boolean isSubTypeOf(final AttributeDescription other) { */ public boolean isSuperTypeOf(final AttributeDescription other) { return attributeType.isSuperTypeOf(other.attributeType) - && pimpl.isSuperTypeOf(other.pimpl); + && optionsPimpl.isSuperTypeOf(other.optionsPimpl); } /** @@ -1199,7 +1283,7 @@ public boolean matches(final AttributeDescription other) { if (this == other) { return true; } else { - return attributeType.matches(other.attributeType) && pimpl.equals(other.pimpl); + return attributeType.matches(other.attributeType) && optionsPimpl.equals(other.optionsPimpl); } } diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java new file mode 100644 index 000000000..5e61bef3a --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeFactory.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +/** + * Attribute factories are included with a set of {@code DecodeOptions} in order + * to allow application to control how {@code Attribute} instances are created + * when decoding requests and responses. + * + * @see Attribute + * @see DecodeOptions + */ +public interface AttributeFactory { + /** + * Creates an attribute using the provided attribute description and no + * values. + * + * @param attributeDescription + * The attribute description. + * @return The new attribute. + * @throws NullPointerException + * If {@code attributeDescription} was {@code null}. + */ + Attribute newAttribute(AttributeDescription attributeDescription); +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeFilter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeFilter.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeFilter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeFilter.java index 8249babb0..0fa210941 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeFilter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeFilter.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java index 213372616..e65e5b4a2 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AttributeParser.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2012-2015 ForgeRock AS. + * Copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java index 693b98f90..022d367fa 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Attributes.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java similarity index 57% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java index 556d16f33..a167208a1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AuthenticationException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java similarity index 57% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java index 593e109f7..d4cd07373 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/AuthorizationException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Base64.java old mode 100755 new mode 100644 similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Base64.java index 845575823..93f5e5aa9 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Base64.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Base64.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java old mode 100755 new mode 100644 similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java index 7adf2a3b6..a8fa3a9e4 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteSequence.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java old mode 100755 new mode 100644 similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java index 750ffb1b5..3cb9d89db --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteSequenceReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java old mode 100755 new mode 100644 similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java index 4f6a69644..de0a469d9 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteString.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -43,11 +33,8 @@ import com.forgerock.opendj.util.StaticUtils; -/** - * An immutable sequence of bytes backed by a byte array. - */ +/** An immutable sequence of bytes backed by a byte array. */ public final class ByteString implements ByteSequence { - /** Singleton empty byte string. */ private static final ByteString EMPTY = wrap(new byte[0]); @@ -636,7 +623,6 @@ public ByteSequenceReader asReader() { return new ByteSequenceReader(this); } - /** {@inheritDoc} */ @Override public byte byteAt(final int index) { if (index >= length || index < 0) { @@ -645,14 +631,12 @@ public byte byteAt(final int index) { return buffer[offset + index]; } - /** {@inheritDoc} */ @Override public int compareTo(final byte[] bytes, final int offset, final int length) { checkArrayBounds(bytes, offset, length); return compareTo(this.buffer, this.offset, this.length, bytes, offset, length); } - /** {@inheritDoc} */ @Override public int compareTo(final ByteSequence o) { if (this == o) { @@ -661,14 +645,12 @@ public int compareTo(final ByteSequence o) { return -o.compareTo(buffer, offset, length); } - /** {@inheritDoc} */ @Override public byte[] copyTo(final byte[] bytes) { copyTo(bytes, 0); return bytes; } - /** {@inheritDoc} */ @Override public byte[] copyTo(final byte[] bytes, final int offset) { if (offset < 0) { @@ -690,7 +672,6 @@ public ByteStringBuilder copyTo(final ByteStringBuilder builder) { return builder; } - @Override public boolean copyTo(CharBuffer charBuffer, CharsetDecoder decoder) { return copyTo(ByteBuffer.wrap(buffer, offset, length), charBuffer, decoder); @@ -708,14 +689,12 @@ static boolean copyTo(ByteBuffer inBuffer, CharBuffer outBuffer, CharsetDecoder return !result.isError() && !result.isOverflow(); } - /** {@inheritDoc} */ @Override public OutputStream copyTo(final OutputStream stream) throws IOException { stream.write(buffer, offset, length); return stream; } - /** {@inheritDoc} */ @Override public boolean equals(final byte[] bytes, final int offset, final int length) { checkArrayBounds(bytes, offset, length); @@ -761,13 +740,11 @@ public boolean isEmpty() { return length == 0; } - /** {@inheritDoc} */ @Override public int length() { return length; } - /** {@inheritDoc} */ @Override public ByteString subSequence(final int start, final int end) { if (start < 0 || start > end || end > length) { @@ -776,16 +753,11 @@ public ByteString subSequence(final int start, final int end) { return new ByteString(buffer, offset + start, end - start); } - /** {@inheritDoc} */ @Override public boolean startsWith(ByteSequence prefix) { - if (prefix == null || prefix.length() > length) { - return false; - } - return prefix.equals(buffer, 0, prefix.length()); + return prefix != null && prefix.length() <= length && prefix.equals(buffer, 0, prefix.length()); } - /** {@inheritDoc} */ @Override public String toBase64String() { return Base64.encode(this); @@ -802,10 +774,9 @@ public String toHexString() { if (isEmpty()) { return ""; } - StringBuilder builder = new StringBuilder((length - 1) * 3 + 2); + StringBuilder builder = new StringBuilder(length * 2); builder.append(StaticUtils.byteToHex(buffer[offset])); for (int i = 1; i < length; i++) { - builder.append(' '); builder.append(StaticUtils.byteToHex(buffer[offset + i])); } return builder.toString(); @@ -911,13 +882,11 @@ public String toHexPlusAsciiString(int indent) { return builder.toString(); } - /** {@inheritDoc} */ @Override public byte[] toByteArray() { return copyTo(new byte[length]); } - /** {@inheritDoc} */ @Override public ByteString toByteString() { return this; @@ -982,7 +951,6 @@ public long toLong() { return v; } - /** {@inheritDoc} */ @Override public String toString() { return toString(buffer, offset, length); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java old mode 100755 new mode 100644 similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java index da0cc5e78..cb6702973 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ByteStringBuilder.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java index a08b7f816..728123edc 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CachedConnectionPool.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java similarity index 58% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java index ac206069e..1ccd50225 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CancelRequestListener.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011 ForgeRock AS + * Copyright 2011 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java new file mode 100644 index 000000000..88d4a480f --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CancelledResultException.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +import org.forgerock.opendj.ldap.responses.Result; + +/** + * Thrown when the result code returned in a Result indicates that the Request + * was cancelled. More specifically, this exception is used for the following + * error result codes: + *

    + *
  • {@link ResultCode#CANCELLED CANCELLED} - the requested operation was + * cancelled. + *
  • {@link ResultCode#CLIENT_SIDE_USER_CANCELLED CLIENT_SIDE_USER_CANCELLED} + * - the requested operation was cancelled by the user. + *
+ */ +@SuppressWarnings("serial") +public class CancelledResultException extends LdapException { + CancelledResultException(final Result result) { + super(result); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java index 0fd5d4a1d..235499077 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/CommonLDAPOptions.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import static com.forgerock.opendj.util.StaticUtils.getProvider; @@ -94,12 +84,6 @@ abstract class CommonLDAPOptions { *

* The default setting is {@code -1} (disabled) and may be configured using * the {@code org.forgerock.opendj.io.linger} property. - * - * @param linger - * The value of the {@link java.net.SocketOptions#SO_LINGER - * SO_LINGER} socket option for new connections, or -1 if linger - * should be disabled. - * @return A reference to this set of options. */ public static final Option SO_LINGER_IN_SECONDS = Option.withDefault( getIntProperty("org.forgerock.opendj.io.linger", -1)); @@ -110,7 +94,6 @@ abstract class CommonLDAPOptions { *

* The default setting is {@code true} and may be configured using the * {@code org.forgerock.opendj.io.keepAlive} property. - * */ public static final Option SO_KEEPALIVE = Option.withDefault( getBooleanProperty("org.forgerock.opendj.io.keepAlive", true)); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java index af359b3ef..aa5f38f70 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConditionResult.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connection.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Connection.java similarity index 98% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Connection.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Connection.java index c47fb61dd..9336052ac 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connection.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Connection.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java index 17d7ff439..9cdc6e4af 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionEventListener.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java new file mode 100644 index 000000000..ab219dce6 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionException.java @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +import org.forgerock.opendj.ldap.responses.Result; + +/** + * Thrown when the result code returned in a Result indicates that the Request + * was unsuccessful because of a connection failure. + */ +@SuppressWarnings("serial") +public class ConnectionException extends LdapException { + ConnectionException(final Result result) { + super(result); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java index eab9c65f1..a3befa964 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionFactory.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionLoadBalancer.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionLoadBalancer.java new file mode 100644 index 000000000..47caa2dc2 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionLoadBalancer.java @@ -0,0 +1,61 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static org.forgerock.util.promise.Promises.newExceptionPromise; + +import java.util.Collection; + +import org.forgerock.util.Options; +import org.forgerock.util.promise.Promise; + +/** + * An abstract connection based load balancer. Load balancing is performed when the application attempts to obtain a + * connection. + *

+ * Implementations should override the method {@code getInitialConnectionFactoryIndex()} in order to provide the policy + * for selecting the first connection factory to use for each connection request. + */ +abstract class ConnectionLoadBalancer extends LoadBalancer { + ConnectionLoadBalancer(final String loadBalancerName, + final Collection factories, + final Options options) { + super(loadBalancerName, factories, options); + } + + @Override + public final Connection getConnection() throws LdapException { + return getMonitoredConnectionFactory(getInitialConnectionFactoryIndex()).getConnection(); + } + + @Override + public final Promise getConnectionAsync() { + try { + return getMonitoredConnectionFactory(getInitialConnectionFactoryIndex()).getConnectionAsync(); + } catch (final LdapException e) { + return newExceptionPromise(e); + } + } + + /** + * Returns the index of the first connection factory which should be used in order to satisfy the next connection + * request. + * + * @return The index of the first connection factory which should be used in order to satisfy the next connection + * request. + */ + abstract int getInitialConnectionFactoryIndex(); +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java similarity index 74% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java index 43a5c2f60..b8980100b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionPool.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2014 ForgeRock AS + * Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java similarity index 65% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java index c75e9e243..32418403a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConnectionSecurityLayer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Connections.java similarity index 69% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Connections.java index da5300a86..547cfff75 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Connections.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Connections.java @@ -1,49 +1,80 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; import static org.forgerock.opendj.ldap.RequestHandlerFactoryAdapter.adaptRequestHandler; +import static org.forgerock.util.time.Duration.duration; import java.net.InetAddress; import java.net.InetSocketAddress; import java.util.Collection; import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; - +import java.util.concurrent.atomic.AtomicInteger; + +import org.forgerock.opendj.ldap.requests.AddRequest; +import org.forgerock.opendj.ldap.requests.CRAMMD5SASLBindRequest; +import org.forgerock.opendj.ldap.requests.CompareRequest; +import org.forgerock.opendj.ldap.requests.DeleteRequest; +import org.forgerock.opendj.ldap.requests.DigestMD5SASLBindRequest; +import org.forgerock.opendj.ldap.requests.GSSAPISASLBindRequest; +import org.forgerock.opendj.ldap.requests.ModifyDNRequest; +import org.forgerock.opendj.ldap.requests.ModifyRequest; +import org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest; +import org.forgerock.opendj.ldap.requests.PlainSASLBindRequest; +import org.forgerock.opendj.ldap.requests.Request; +import org.forgerock.opendj.ldap.requests.SearchRequest; +import org.forgerock.opendj.ldap.requests.SimpleBindRequest; +import org.forgerock.util.Function; +import org.forgerock.util.Option; import org.forgerock.util.Options; import org.forgerock.util.Reject; +import org.forgerock.util.promise.NeverThrowsException; import org.forgerock.util.promise.Promise; +import org.forgerock.util.time.Duration; /** * This class contains methods for creating and manipulating connection * factories and connections. */ public final class Connections { + /** + * Specifies the interval between successive attempts to reconnect to offline load-balanced connection factories. + * The default configuration is to attempt to reconnect every second. + */ + public static final Option LOAD_BALANCER_MONITORING_INTERVAL = Option.withDefault(duration("1 seconds")); + + /** + * Specifies the event listener which should be notified whenever a load-balanced connection factory changes state + * from online to offline or vice-versa. By default events will be logged to the {@code LoadBalancingAlgorithm} + * logger using the {@link LoadBalancerEventListener#LOG_EVENTS} listener. + */ + public static final Option LOAD_BALANCER_EVENT_LISTENER = + Option.of(LoadBalancerEventListener.class, LoadBalancerEventListener.LOG_EVENTS); + + /** + * Specifies the scheduler which will be used for periodically reconnecting to offline connection factories. A + * system-wide scheduler will be used by default. + */ + public static final Option LOAD_BALANCER_SCHEDULER = + Option.of(ScheduledExecutorService.class, null); + /** * Creates a new connection pool which creates new connections as needed * using the provided connection factory, but will reuse previously @@ -365,14 +396,15 @@ public static ConnectionFactory newInternalConnectionFactory( } /** - * Creates a new "round-robin" load-balance which will load-balance connections across the provided set of + * Creates a new "round-robin" load-balancer which will load-balance connections across the provided set of * connection factories. A round robin load balancing algorithm distributes connection requests across a list of * connection factories one at a time. When the end of the list is reached, the algorithm starts again from the * beginning. *

* This algorithm is typically used for load-balancing within data centers, where load must be distributed - * equally across multiple data sources. This algorithm contrasts with the {@link FailoverLoadBalancingAlgorithm} - * which is used for load-balancing between data centers. + * equally across multiple data sources. This algorithm contrasts with the + * {@link #newFailoverLoadBalancer(Collection, Options)} which is used for load-balancing between data + * centers. *

* If a problem occurs that temporarily prevents connections from being obtained for one of the connection * factories, then this algorithm automatically "fails over" to the next operational connection factory in the list. @@ -385,24 +417,56 @@ public static ConnectionFactory newInternalConnectionFactory( * @param factories * The connection factories. * @param options - * This configuration options for the load-balancer. See {@link LoadBalancingAlgorithm} for common options. + * This configuration options for the load-balancer. * @return The new round-robin load balancer. + * @see #newShardedRequestLoadBalancer(Collection, Options) * @see #newFailoverLoadBalancer(Collection, Options) - * @see LoadBalancingAlgorithm + * @see #LOAD_BALANCER_EVENT_LISTENER + * @see #LOAD_BALANCER_MONITORING_INTERVAL + * @see #LOAD_BALANCER_SCHEDULER */ public static ConnectionFactory newRoundRobinLoadBalancer( final Collection factories, final Options options) { - return new LoadBalancer(new RoundRobinLoadBalancingAlgorithm(factories, options)); + return new ConnectionLoadBalancer("RoundRobinLoadBalancer", factories, options) { + private final int maxIndex = factories.size(); + private final AtomicInteger nextIndex = new AtomicInteger(-1); + + @Override + int getInitialConnectionFactoryIndex() { + // A round robin pool of one connection factories is unlikely in + // practice and requires special treatment. + if (maxIndex == 1) { + return 0; + } + + // Determine the next factory to use: avoid blocking algorithm. + int oldNextIndex; + int newNextIndex; + do { + oldNextIndex = nextIndex.get(); + newNextIndex = oldNextIndex + 1; + if (newNextIndex == maxIndex) { + newNextIndex = 0; + } + } while (!nextIndex.compareAndSet(oldNextIndex, newNextIndex)); + + // There's a potential, but benign, race condition here: other threads + // could jump in and rotate through the list before we return the + // connection factory. + return newNextIndex; + } + }; } /** - * Creates a new "fail-over" load-balance which will load-balance connections across the provided set of connection + * Creates a new "fail-over" load-balancer which will load-balance connections across the provided set of connection * factories. A fail-over load balancing algorithm provides fault tolerance across multiple underlying connection * factories. *

* This algorithm is typically used for load-balancing between data centers, where there is preference to * always forward connection requests to the closest available data center. This algorithm contrasts with the - * {@link RoundRobinLoadBalancingAlgorithm} which is used for load-balancing within a data center. + * {@link #newRoundRobinLoadBalancer(Collection, Options)} which is used for load-balancing within a data + * center. *

* This algorithm selects connection factories based on the order in which they were provided during construction. * More specifically, an attempt to obtain a connection factory will always return the first operational @@ -420,27 +484,139 @@ public static ConnectionFactory newRoundRobinLoadBalancer( * @param factories * The connection factories. * @param options - * This configuration options for the load-balancer. See {@link LoadBalancingAlgorithm} for common options. + * This configuration options for the load-balancer. * @return The new fail-over load balancer. * @see #newRoundRobinLoadBalancer(Collection, Options) - * @see LoadBalancingAlgorithm + * @see #newShardedRequestLoadBalancer(Collection, Options) + * @see #LOAD_BALANCER_EVENT_LISTENER + * @see #LOAD_BALANCER_MONITORING_INTERVAL + * @see #LOAD_BALANCER_SCHEDULER */ public static ConnectionFactory newFailoverLoadBalancer( final Collection factories, final Options options) { - return new LoadBalancer(new FailoverLoadBalancingAlgorithm(factories, options)); + return new ConnectionLoadBalancer("FailoverLoadBalancer", factories, options) { + @Override + int getInitialConnectionFactoryIndex() { + // Always start with the first connection factory. + return 0; + } + }; } /** - * Creates a new load balancer which will obtain connections using the provided load balancing algorithm. + * Creates a new "sharded" load-balancer which will load-balance individual requests across the provided set of + * connection factories, each typically representing a single replica, using an algorithm that ensures that requests + * targeting a given DN will always be routed to the same replica. In other words, this load-balancer increases + * consistency whilst maintaining read-scalability by simulating a "single master" replication topology, where each + * replica is responsible for a subset of the entries. When a replica is unavailable the load-balancer "fails over" + * by performing a linear probe in order to find the next available replica thus ensuring high-availability when a + * network partition occurs while sacrificing consistency, since the unavailable replica may still be visible to + * other clients. + *

+ * This load-balancer distributes requests based on the hash of their target DN and handles all core operations, as + * well as any password modify extended requests and SASL bind requests which use authentication IDs having the + * "dn:" form. Note that subtree operations (searches, subtree deletes, and modify DN) are likely to include entries + * which are "mastered" on different replicas, so client applications should be more tolerant of inconsistencies. + * Requests that are either unrecognized or that do not have a parameter that may be considered to be a target DN + * will be routed randomly. + *

+ * NOTE: this connection factory returns fake connections, since real connections are obtained for each + * request. Therefore, the returned fake connections have certain limitations: abandon requests will be ignored + * since they cannot be routed; connection event listeners can be registered, but will only be notified when the + * fake connection is closed or when all of the connection factories are unavailable. + *

+ * NOTE: in deployments where there are multiple client applications, care should be taken to ensure that + * the factories are configured using the same ordering, otherwise requests will not be routed consistently + * across the client applications. + *

+ * The implementation periodically attempts to connect to failed connection factories in order to determine if they + * have become available again. * - * @param algorithm - * The load balancing algorithm which will be used to obtain the next - * @return The new load balancer. - * @throws NullPointerException - * If {@code algorithm} was {@code null}. + * @param factories + * The connection factories. + * @param options + * This configuration options for the load-balancer. + * @return The new affinity load balancer. + * @see #newRoundRobinLoadBalancer(Collection, Options) + * @see #newFailoverLoadBalancer(Collection, Options) + * @see #LOAD_BALANCER_EVENT_LISTENER + * @see #LOAD_BALANCER_MONITORING_INTERVAL + * @see #LOAD_BALANCER_SCHEDULER */ - public static ConnectionFactory newLoadBalancer(final LoadBalancingAlgorithm algorithm) { - return new LoadBalancer(algorithm); + public static ConnectionFactory newShardedRequestLoadBalancer( + final Collection factories, final Options options) { + return new RequestLoadBalancer("ShardedRequestLoadBalancer", + factories, + options, + newShardedRequestLoadBalancerFunction(factories)); + } + + // Package private for testing. + static Function newShardedRequestLoadBalancerFunction( + final Collection factories) { + return new Function() { + private final int maxIndex = factories.size(); + + @Override + public Integer apply(final Request request) { + // Normalize the hash to a valid factory index, taking care of negative hash values and especially + // Integer.MIN_VALUE (see doc for Math.abs()). + final int index = computeIndexBasedOnDnHashCode(request); + return index == Integer.MIN_VALUE ? 0 : (Math.abs(index) % maxIndex); + } + + private int computeIndexBasedOnDnHashCode(final Request request) { + // The following conditions are ordered such that the most common operations appear first in order to + // reduce the average number of branches. A better solution would be to use a visitor, but a visitor + // would only apply to the core operations, not extended operations or SASL binds. + if (request instanceof SearchRequest) { + return ((SearchRequest) request).getName().hashCode(); + } else if (request instanceof ModifyRequest) { + return ((ModifyRequest) request).getName().hashCode(); + } else if (request instanceof SimpleBindRequest) { + return hashCodeOfDnString(((SimpleBindRequest) request).getName()); + } else if (request instanceof AddRequest) { + return ((AddRequest) request).getName().hashCode(); + } else if (request instanceof DeleteRequest) { + return ((DeleteRequest) request).getName().hashCode(); + } else if (request instanceof CompareRequest) { + return ((CompareRequest) request).getName().hashCode(); + } else if (request instanceof ModifyDNRequest) { + return ((ModifyDNRequest) request).getName().hashCode(); + } else if (request instanceof PasswordModifyExtendedRequest) { + return hashCodeOfAuthzid(((PasswordModifyExtendedRequest) request).getUserIdentityAsString()); + } else if (request instanceof PlainSASLBindRequest) { + return hashCodeOfAuthzid(((PlainSASLBindRequest) request).getAuthenticationID()); + } else if (request instanceof DigestMD5SASLBindRequest) { + return hashCodeOfAuthzid(((DigestMD5SASLBindRequest) request).getAuthenticationID()); + } else if (request instanceof GSSAPISASLBindRequest) { + return hashCodeOfAuthzid(((GSSAPISASLBindRequest) request).getAuthenticationID()); + } else if (request instanceof CRAMMD5SASLBindRequest) { + return hashCodeOfAuthzid(((CRAMMD5SASLBindRequest) request).getAuthenticationID()); + } else { + return distributeRequestAtRandom(); + } + } + + private int hashCodeOfAuthzid(final String authzid) { + if (authzid != null && authzid.startsWith("dn:")) { + return hashCodeOfDnString(authzid.substring(3)); + } + return distributeRequestAtRandom(); + } + + private int hashCodeOfDnString(final String dnString) { + try { + return DN.valueOf(dnString).hashCode(); + } catch (final IllegalArgumentException ignored) { + return distributeRequestAtRandom(); + } + } + + private int distributeRequestAtRandom() { + return ThreadLocalRandom.current().nextInt(0, maxIndex); + } + }; } /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java index f8f6172a0..ab27ecce3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ConstraintViolationException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2013-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2013-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DN.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DN.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/DN.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DN.java index 5e7a8059a..3a1a44b53 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DN.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DN.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -31,9 +21,9 @@ import java.util.LinkedHashMap; import java.util.Map; import java.util.NoSuchElementException; +import java.util.UUID; import java.util.WeakHashMap; -import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizedIllegalArgumentException; import org.forgerock.opendj.ldap.schema.CoreSchema; import org.forgerock.opendj.ldap.schema.Schema; @@ -62,12 +52,14 @@ * Models */ public final class DN implements Iterable, Comparable { - static final byte NORMALIZED_RDN_SEPARATOR = 0x00; static final byte NORMALIZED_AVA_SEPARATOR = 0x01; static final byte NORMALIZED_ESC_BYTE = 0x02; - private static final DN ROOT_DN = new DN(CoreSchema.getInstance(), null, null, ""); + static final char RDN_CHAR_SEPARATOR = ','; + static final char AVA_CHAR_SEPARATOR = '+'; + + private static final DN ROOT_DN = new DN(CoreSchema.getInstance(), null, null); /** * This is the size of the per-thread per-schema DN cache. We should @@ -78,8 +70,6 @@ public final class DN implements Iterable, Comparable { private static final ThreadLocal>> CACHE = new ThreadLocal>>() { - - /** {@inheritDoc} */ @Override protected WeakHashMap> initialValue() { return new WeakHashMap<>(); @@ -204,15 +194,13 @@ public static DN rootDN() { } /** - * Parses the provided LDAP string representation of a DN using the default - * schema. + * Parses the provided LDAP string representation of a DN using the default schema. * * @param dn * The LDAP string representation of a DN. * @return The parsed DN. * @throws LocalizedIllegalArgumentException - * If {@code dn} is not a valid LDAP string representation of a - * DN. + * If {@code dn} is not a valid LDAP string representation of a DN. * @throws NullPointerException * If {@code dn} was {@code null}. * @see #format(String, Object...) @@ -222,8 +210,7 @@ public static DN valueOf(final String dn) { } /** - * Parses the provided LDAP string representation of a DN using the provided - * schema. + * Parses the provided LDAP string representation of a DN using the provided schema. * * @param dn * The LDAP string representation of a DN. @@ -231,8 +218,7 @@ public static DN valueOf(final String dn) { * The schema to use when parsing the DN. * @return The parsed DN. * @throws LocalizedIllegalArgumentException - * If {@code dn} is not a valid LDAP string representation of a - * DN. + * If {@code dn} is not a valid LDAP string representation of a DN. * @throws NullPointerException * If {@code dn} or {@code schema} was {@code null}. * @see #format(String, Schema, Object...) @@ -251,64 +237,58 @@ public static DN valueOf(final String dn, final Schema schema) { } // Not in cache so decode. - final SubstringReader reader = new SubstringReader(dn); - return decode(dn, reader, schema, cache); + return decode(new SubstringReader(dn), schema, cache); } /** - * Compares the provided DN values to determine their relative order in a - * sorted list. The order is the natural order as defined by the - * {@code toNormalizedByteString()} method. + * Parses the provided LDAP string representation of a DN using the default schema. * - * @param dn1 - * The first DN to be compared. It must not be {@code null}. - * @param dn2 - * The second DN to be compared. It must not be {@code null}. - * @return A negative integer if the first DN should come before the second - * DN in a sorted list, a positive integer if the first DN should - * come after the second DN in a sorted list, or zero if the two DN - * values can be considered equal. + * @param dn + * The LDAP byte string representation of a DN. + * @return The parsed DN. + * @throws LocalizedIllegalArgumentException + * If {@code dn} is not a valid LDAP byte string representation of a DN. + * @throws NullPointerException + * If {@code dn} was {@code null}. */ - private static int compareTo(final DN dn1, final DN dn2) { - return dn1.toNormalizedByteString().compareTo(dn2.toNormalizedByteString()); + public static DN valueOf(ByteString dn) { + return DN.valueOf(dn.toString()); } /** Decodes a DN using the provided reader and schema. */ - private static DN decode(final String dnString, final SubstringReader reader, - final Schema schema, final Map cache) { + private static DN decode(final SubstringReader reader, final Schema schema, final Map cache) { reader.skipWhitespaces(); if (reader.remaining() == 0) { return ROOT_DN; } - RDN rdn; + final RDN rdn; try { - rdn = RDN.decode(null, reader, schema); + rdn = RDN.decode(reader, schema); } catch (final UnknownSchemaElementException e) { - final LocalizableMessage message = - ERR_DN_TYPE_NOT_FOUND.get(reader.getString(), e.getMessageObject()); - throw new LocalizedIllegalArgumentException(message); + throw new LocalizedIllegalArgumentException( + ERR_DN_TYPE_NOT_FOUND.get(reader.getString(), e.getMessageObject())); } - DN parent; if (reader.remaining() > 0 && reader.read() == ',') { + reader.skipWhitespaces(); + if (reader.remaining() == 0) { + throw new LocalizedIllegalArgumentException(ERR_ATTR_SYNTAX_DN_ATTR_NO_NAME.get(reader.getString())); + } reader.mark(); final String parentString = reader.read(reader.remaining()); - - parent = cache.get(parentString); + DN parent = cache.get(parentString); if (parent == null) { reader.reset(); - parent = decode(parentString, reader, schema, cache); + parent = decode(reader, schema, cache); - // Only cache parent DNs since leaf DNs are likely to make the - // cache to volatile. + // Only cache parent DNs since leaf DNs are likely to make the cache to volatile. cache.put(parentString, parent); } + return new DN(schema, parent, rdn); } else { - parent = ROOT_DN; + return new DN(schema, ROOT_DN, rdn); } - - return new DN(schema, parent, rdn, dnString); } @SuppressWarnings("serial") @@ -329,9 +309,7 @@ protected boolean removeEldestEntry(final Map.Entry e) { } private final RDN rdn; - private DN parent; - private final int size; /** @@ -341,8 +319,8 @@ protected boolean removeEldestEntry(final Map.Entry e) { private ByteString normalizedDN; /** - * We need to store the original string value if provided in order to - * preserve the original whitespace. + * The RFC 4514 string representation of this DN. A value of {@code null} + * indicates that the value needs to be computed lazily. */ private String stringValue; @@ -350,17 +328,17 @@ protected boolean removeEldestEntry(final Map.Entry e) { private final Schema schema; /** Private constructor. */ - private DN(final Schema schema, final DN parent, final RDN rdn, final String stringValue) { - this(schema, parent, rdn, stringValue, parent != null ? parent.size + 1 : 0); + private DN(final Schema schema, final DN parent, final RDN rdn) { + this(schema, parent, rdn, parent != null ? parent.size + 1 : 0); } /** Private constructor. */ - private DN(final Schema schema, final DN parent, final RDN rdn, final String stringValue, final int size) { + private DN(final Schema schema, final DN parent, final RDN rdn, final int size) { this.schema = schema; this.parent = parent; this.rdn = rdn; - this.stringValue = stringValue; this.size = size; + this.stringValue = rdn == null ? "" : null; } /** @@ -388,7 +366,7 @@ public DN child(final DN dn) { } DN newDN = this; for (i = 0; i < rdns.length; i++) { - newDN = new DN(this.schema, newDN, rdns[i], null); + newDN = new DN(this.schema, newDN, rdns[i]); } return newDN; } @@ -412,7 +390,7 @@ public DN child(final DN dn) { */ public DN child(final RDN rdn) { Reject.ifNull(rdn); - return new DN(this.schema, this, rdn, null); + return new DN(this.schema, this, rdn); } /** @@ -457,13 +435,11 @@ public DN child(final String attributeType, final Object attributeValue) { return child(new RDN(attributeType, attributeValue)); } - /** {@inheritDoc} */ @Override public int compareTo(final DN dn) { - return compareTo(this, dn); + return toNormalizedByteString().compareTo(dn.toNormalizedByteString()); } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -476,7 +452,6 @@ public boolean equals(final Object obj) { return false; } - /** {@inheritDoc} */ @Override public int hashCode() { return toNormalizedByteString().hashCode(); @@ -530,20 +505,21 @@ public boolean isChildOf(final String dn) { * If {@code dn} or {@code scope} was {@code null}. */ public boolean isInScopeOf(DN dn, SearchScope scope) { - if (scope == SearchScope.BASE_OBJECT) { + switch (scope.asEnum()) { + case BASE_OBJECT: // The base DN must equal this DN. return equals(dn); - } else if (scope == SearchScope.SINGLE_LEVEL) { + case SINGLE_LEVEL: // The parent DN must equal the base DN. return isChildOf(dn); - } else if (scope == SearchScope.SUBORDINATES) { + case SUBORDINATES: // This DN must be a descendant of the provided base DN, but // not equal to it. return isSubordinateOrEqualTo(dn) && !equals(dn); - } else if (scope == SearchScope.WHOLE_SUBTREE) { + case WHOLE_SUBTREE: // This DN must be a descendant of the provided base DN. return isSubordinateOrEqualTo(dn); - } else { + default: // This is a scope that we don't recognize. return false; } @@ -742,12 +718,16 @@ public void remove() { * dn.localName(dn.size()).equals(dn); * * + * Said otherwise, a new DN is built using {@code index} RDNs, + * retained in the same order, starting from the left. + * * @param index * The number of RDNs to be included in the local name. * @return The DN whose content is the specified number of RDNs from this * DN. * @throws IllegalArgumentException * If {@code index} is less than zero. + * @see #parent(int) for the reverse operation (starting from the right) */ public DN localName(final int index) { Reject.ifFalse(index >= 0, "index less than zero"); @@ -757,11 +737,11 @@ public DN localName(final int index) { } else if (index >= size) { return this; } else { - final DN localName = new DN(this.schema, null, rdn, null, index); + final DN localName = new DN(this.schema, null, rdn, index); DN nextLocalName = localName; DN lastDN = parent; for (int i = index - 1; i > 0; i--) { - nextLocalName.parent = new DN(this.schema, null, lastDN.rdn, null, i); + nextLocalName.parent = new DN(this.schema, null, lastDN.rdn, i); nextLocalName = nextLocalName.parent; lastDN = lastDN.parent; } @@ -792,6 +772,9 @@ public DN parent() { * RDNs removed. Note that if {@code index} is zero then this DN will be * returned (identity). * + * Said otherwise, a new DN is built using {@code index} RDNs, + * retained in the same order, starting from the right. + * * @param index * The number of RDNs to be removed. * @return The DN which is equal to this DN with the specified number of @@ -799,6 +782,7 @@ public DN parent() { * reached. * @throws IllegalArgumentException * If {@code index} is less than zero. + * @see #localName(int) for the reverse operation (starting from the left) */ public DN parent(final int index) { // We allow size + 1 so that we can return null as the parent of the @@ -821,6 +805,29 @@ public RDN rdn() { return rdn; } + /** + * Returns the RDN at the specified index for this DN, + * or {@code null} if no such RDN exists. + *

+ * Here is an example usage: + *

+     * DN.valueOf("ou=people,dc=example,dc=com").rdn(0) => "ou=people"
+     * DN.valueOf("ou=people,dc=example,dc=com").rdn(1) => "dc=example"
+     * DN.valueOf("ou=people,dc=example,dc=com").rdn(2) => "dc=com"
+     * DN.valueOf("ou=people,dc=example,dc=com").rdn(3) => null
+     * 
+ * + * @param index + * The index of the requested RDN. + * @return The RDN at the specified index, or {@code null} if no such RDN exists. + * @throws IllegalArgumentException + * If {@code index} is less than zero. + */ + public RDN rdn(int index) { + DN parentDN = parent(index); + return parentDN != null ? parentDN.rdn : null; + } + /** * Returns a copy of this DN whose parent DN, {@code fromDN}, has been * renamed to the new parent DN, {@code toDN}. If this DN is not subordinate @@ -868,10 +875,9 @@ public int size() { public String toString() { // We don't care about potential race conditions here. if (stringValue == null) { - final StringBuilder builder = new StringBuilder(); - rdn.toString(builder); + final StringBuilder builder = rdn.toString(new StringBuilder()); if (!parent.isRootDN()) { - builder.append(','); + builder.append(RDN_CHAR_SEPARATOR); builder.append(parent); } stringValue = builder.toString(); @@ -891,20 +897,13 @@ public String toString() { */ public ByteString toNormalizedByteString() { if (normalizedDN == null) { - if (rdn() == null) { + if (rdn == null) { normalizedDN = ByteString.empty(); } else { - final ByteStringBuilder builder = new ByteStringBuilder(); - int i = size() - 1; - parent(i).rdn().toNormalizedByteString(builder); - for (i--; i >= 0; i--) { - final RDN rdn = parent(i).rdn(); - // Only add a separator if the RDN is not RDN.maxValue(). - if (rdn.size() != 0) { - builder.appendByte(DN.NORMALIZED_RDN_SEPARATOR); - } - rdn.toNormalizedByteString(builder); - } + final ByteString normalizedParent = parent.toNormalizedByteString(); + final ByteStringBuilder builder = new ByteStringBuilder(normalizedParent.length() + 16); + builder.appendBytes(normalizedParent); + rdn.toNormalizedByteString(builder); normalizedDN = builder.toByteString(); } } @@ -924,20 +923,38 @@ public String toNormalizedUrlSafeString() { return ""; } + // This code differs from toNormalizedByteString(), + // because we do not care about ordering comparisons. + // (so we do not append the RDN_SEPARATOR first) final StringBuilder builder = new StringBuilder(); int i = size() - 1; parent(i).rdn().toNormalizedUrlSafeString(builder); for (i--; i >= 0; i--) { final RDN rdn = parent(i).rdn(); - // Only add a separator if the RDN is not RDN.maxValue(). + // Only add a separator if the RDN is not RDN.maxValue() or RDN.minValue(). if (rdn.size() != 0) { - builder.append(','); + builder.append(RDN_CHAR_SEPARATOR); } rdn.toNormalizedUrlSafeString(builder); } return builder.toString(); } + /** + * Returns a UUID whose content is based on the normalized content of this DN. + * Two equivalent DNs subject to the same schema will always yield the same UUID. + * + * @return the UUID representing this DN + */ + public UUID toUUID() { + ByteString normDN = toNormalizedByteString(); + if (!normDN.isEmpty()) { + // remove leading RDN separator + normDN = normDN.subSequence(1, normDN.length()); + } + return UUID.nameUUIDFromBytes(normDN.toByteArray()); + } + /** * A compact representation of a DN, suitable for equality and comparisons, and providing a natural hierarchical * ordering. @@ -952,10 +969,10 @@ public String toNormalizedUrlSafeString() { *
  • lazily: the normalized value is computed only the first time it is needed.
  • * * - * @Deprecated This class will eventually be replaced by a compact implementation of a DN. + * @deprecated This class will eventually be replaced by a compact implementation of a DN. */ + @Deprecated public static final class CompactDn implements Comparable { - /** Original string corresponding to the DN. */ private final byte[] originalValue; @@ -968,11 +985,10 @@ public static final class CompactDn implements Comparable { private final Schema schema; private CompactDn(final DN dn) { - this.originalValue = dn.stringValue != null ? getBytes(dn.stringValue) : new byte[0]; + this.originalValue = getBytes(dn.toString()); this.schema = dn.schema; } - /** {@inheritDoc} */ @Override public int compareTo(final CompactDn other) { byte[] normValue = getNormalizedValue(); @@ -989,13 +1005,11 @@ public DN toDn() { return DN.valueOf(ByteString.toString(originalValue, 0, originalValue.length), schema); } - /** {@inheritDoc} */ @Override public int hashCode() { return Arrays.hashCode(getNormalizedValue()); } - /** {@inheritDoc} */ @Override public boolean equals(Object obj) { if (this == obj) { @@ -1008,7 +1022,6 @@ public boolean equals(Object obj) { } } - /** {@inheritDoc} */ @Override public String toString() { return ByteString.toString(originalValue, 0, originalValue.length); @@ -1030,5 +1043,4 @@ private byte[] getNormalizedValue() { public CompactDn compact() { return new CompactDn(this); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DecodeException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DecodeException.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/DecodeException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DecodeException.java index 079391787..2aadaae11 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DecodeException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DecodeException.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -101,11 +92,7 @@ private DecodeException(final LocalizableMessage message, final boolean isFatal, this.isFatal = isFatal; } - /** - * Returns the message that explains the problem that occurred. - * - * @return LocalizableMessage of the problem - */ + @Override public LocalizableMessage getMessageObject() { return message; } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java index 1a4ae12d5..4e634ea90 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DecodeOptions.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -52,17 +42,14 @@ private FixedSchemaResolver(final Schema schema) { this.schema = schema; } - /** {@inheritDoc} */ + @Override public Schema resolveSchema(final String dn) { return schema; } - } private SchemaResolver schemaResolver; - private EntryFactory entryFactory; - private AttributeFactory attributeFactory; /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java index de0302dee..7a4a588b3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/DereferenceAliasesPolicy.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.Arrays; @@ -71,10 +61,7 @@ public final class DereferenceAliasesPolicy { */ public static final DereferenceAliasesPolicy FINDING_BASE = register(2, "find"); - /** - * Dereference aliases both in searching and in locating the base object of - * a Search operation. - */ + /** Dereference aliases both in searching and in locating the base object of a Search operation. */ public static final DereferenceAliasesPolicy ALWAYS = register(3, "always"); /** @@ -132,7 +119,6 @@ private DereferenceAliasesPolicy(final int intValue, final String name) { this.name = name; } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -144,7 +130,6 @@ public boolean equals(final Object obj) { } } - /** {@inheritDoc} */ @Override public int hashCode() { return intValue; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Entries.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Entries.java index 38ef111ad..d21689819 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entries.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Entries.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -73,10 +63,7 @@ public final class Entries { * @see Entries#diffEntries(Entry, Entry, DiffOptions) */ public static final class DiffOptions { - /** - * Selects which attributes will be compared. By default all user - * attributes will be compared. - */ + /** Selects which attributes will be compared. By default all user attributes will be compared. */ private AttributeFilter attributeFilter = USER_ATTRIBUTES_ONLY_FILTER; /** @@ -198,7 +185,6 @@ private DiffOptions replaceMaxValues(final int maxValues) { private Entry filter(final Entry entry) { return attributeFilter.filteredViewOf(entry); } - } private static final class UnmodifiableEntry implements Entry { @@ -208,20 +194,17 @@ private UnmodifiableEntry(final Entry entry) { this.entry = entry; } - /** {@inheritDoc} */ @Override public boolean addAttribute(final Attribute attribute) { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public boolean addAttribute(final Attribute attribute, final Collection duplicateValues) { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public Entry addAttribute(final String attributeDescription, final Object... values) { throw new UnsupportedOperationException(); @@ -243,7 +226,6 @@ public boolean containsAttribute(final String attributeDescription, final Object return entry.containsAttribute(attributeDescription, values); } - /** {@inheritDoc} */ @Override public boolean equals(final Object object) { return object == this || entry.equals(object); @@ -261,7 +243,6 @@ public Iterable getAllAttributes(final AttributeDescription attribute .getAllAttributes(attributeDescription), UNMODIFIABLE_ATTRIBUTE_FUNCTION)); } - /** {@inheritDoc} */ @Override public Iterable getAllAttributes(final String attributeDescription) { return Iterables.unmodifiableIterable(Iterables.transformedIterable(entry @@ -278,7 +259,6 @@ public Attribute getAttribute(final AttributeDescription attributeDescription) { } } - /** {@inheritDoc} */ @Override public Attribute getAttribute(final String attributeDescription) { final Attribute attribute = entry.getAttribute(attributeDescription); @@ -294,31 +274,26 @@ public int getAttributeCount() { return entry.getAttributeCount(); } - /** {@inheritDoc} */ @Override public DN getName() { return entry.getName(); } - /** {@inheritDoc} */ @Override public int hashCode() { return entry.hashCode(); } - /** {@inheritDoc} */ @Override public AttributeParser parseAttribute(final AttributeDescription attributeDescription) { return entry.parseAttribute(attributeDescription); } - /** {@inheritDoc} */ @Override public AttributeParser parseAttribute(final String attributeDescription) { return entry.parseAttribute(attributeDescription); } - /** {@inheritDoc} */ @Override public boolean removeAttribute(final Attribute attribute, final Collection missingValues) { @@ -330,19 +305,16 @@ public boolean removeAttribute(final AttributeDescription attributeDescription) throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public Entry removeAttribute(final String attributeDescription, final Object... values) { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public boolean replaceAttribute(final Attribute attribute) { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public Entry replaceAttribute(final String attributeDescription, final Object... values) { throw new UnsupportedOperationException(); @@ -353,18 +325,15 @@ public Entry setName(final DN dn) { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public Entry setName(final String dn) { throw new UnsupportedOperationException(); } - /** {@inheritDoc} */ @Override public String toString() { return entry.toString(); } - } private static final Comparator COMPARATOR = new Comparator() { @@ -601,11 +570,8 @@ public static ModifyRequest diffEntries(final Entry fromEntry, final Entry toEnt final int cmp = adfrom.compareTo(adto); if (cmp == 0) { - /* - * Attribute is in both entries so compute the differences - * between the old and new. - */ - if (options.useReplaceMaxValues > ato.size()) { + /* Attribute is in both entries so compute the differences between the old and new. */ + if (options.useReplaceMaxValues >= ato.size()) { // This attribute is a candidate for replacing. if (diffAttributeNeedsReplacing(afrom, ato, options)) { request.addModification(new Modification(ModificationType.REPLACE, ato)); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entry.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Entry.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Entry.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Entry.java index 45cd6e1af..f35595979 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Entry.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Entry.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -232,6 +222,7 @@ public interface Entry { * @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); /** @@ -330,6 +321,7 @@ public interface Entry { * * @return The hash code for this entry. */ + @Override int hashCode(); /** @@ -525,5 +517,6 @@ public interface Entry { * * @return The string representation of this entry. */ + @Override String toString(); } diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java new file mode 100644 index 000000000..f80063056 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/EntryFactory.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +/** + * Entry factories are included with a set of {@code DecodeOptions} in order to + * allow application to control how {@code Entry} instances are created when + * decoding requests and responses. + * + * @see Entry + * @see DecodeOptions + */ +public interface EntryFactory { + /** + * Creates an empty entry using the provided distinguished name and no + * attributes. + * + * @param name + * The distinguished name of the entry to be created. + * @return The new entry. + * @throws NullPointerException + * If {@code name} was {@code null}. + */ + Entry newEntry(DN name); +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java similarity index 55% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java index 991eba942..ef45d3ec3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/EntryNotFoundException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Filter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Filter.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Filter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Filter.java index e8bf106d4..224692163 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Filter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Filter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2011 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2011 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -309,22 +299,45 @@ public StringBuilder visitAndFilter(final StringBuilder builder, } @Override - public StringBuilder visitApproxMatchFilter(final StringBuilder builder, - final String attributeDescription, final ByteString assertionValue) { - builder.append('('); - builder.append(attributeDescription); - builder.append("~="); - valueToFilterString(builder, assertionValue); + public StringBuilder visitOrFilter(final StringBuilder builder, + final List subFilters) { + builder.append("(|"); + for (final Filter subFilter : subFilters) { + subFilter.accept(this, builder); + } builder.append(')'); return builder; } + @Override + public StringBuilder visitApproxMatchFilter(final StringBuilder builder, + final String attributeDescription, final ByteString assertionValue) { + return visitBinaryOperator(builder, attributeDescription, "~=", assertionValue); + } + @Override public StringBuilder visitEqualityMatchFilter(final StringBuilder builder, final String attributeDescription, final ByteString assertionValue) { + return visitBinaryOperator(builder, attributeDescription, "=", assertionValue); + } + + @Override + public StringBuilder visitGreaterOrEqualFilter(final StringBuilder builder, + final String attributeDescription, final ByteString assertionValue) { + return visitBinaryOperator(builder, attributeDescription, ">=", assertionValue); + } + + @Override + public StringBuilder visitLessOrEqualFilter(final StringBuilder builder, + final String attributeDescription, final ByteString assertionValue) { + return visitBinaryOperator(builder, attributeDescription, "<=", assertionValue); + } + + private StringBuilder visitBinaryOperator(final StringBuilder builder, + final String attributeDescription, final String operator, final ByteString assertionValue) { builder.append('('); builder.append(attributeDescription); - builder.append("="); + builder.append(operator); valueToFilterString(builder, assertionValue); builder.append(')'); return builder; @@ -355,28 +368,6 @@ public StringBuilder visitExtensibleMatchFilter(final StringBuilder builder, return builder; } - @Override - public StringBuilder visitGreaterOrEqualFilter(final StringBuilder builder, - final String attributeDescription, final ByteString assertionValue) { - builder.append('('); - builder.append(attributeDescription); - builder.append(">="); - valueToFilterString(builder, assertionValue); - builder.append(')'); - return builder; - } - - @Override - public StringBuilder visitLessOrEqualFilter(final StringBuilder builder, - final String attributeDescription, final ByteString assertionValue) { - builder.append('('); - builder.append(attributeDescription); - builder.append("<="); - valueToFilterString(builder, assertionValue); - builder.append(')'); - return builder; - } - @Override public StringBuilder visitNotFilter(final StringBuilder builder, final Filter subFilter) { @@ -386,17 +377,6 @@ public StringBuilder visitNotFilter(final StringBuilder builder, return builder; } - @Override - public StringBuilder visitOrFilter(final StringBuilder builder, - final List subFilters) { - builder.append("(|"); - for (final Filter subFilter : subFilters) { - subFilter.accept(this, builder); - } - builder.append(')'); - return builder; - } - @Override public StringBuilder visitPresentFilter(final StringBuilder builder, final String attributeDescription) { @@ -846,11 +826,11 @@ public static Filter substrings(final String attributeDescription, Reject.ifNull(attributeDescription); Reject.ifFalse(initialSubstring != null || finalSubstring != null - || (anySubstrings != null && anySubstrings.size() > 0), + || (anySubstrings != null && !anySubstrings.isEmpty()), "at least one substring (initial, any or final) must be specified"); List anySubstringList; - if (anySubstrings == null || anySubstrings.size() == 0) { + if (anySubstrings == null || anySubstrings.isEmpty()) { anySubstringList = Collections.emptyList(); } else if (anySubstrings.size() == 1) { final Object anySubstring = anySubstrings.iterator().next(); @@ -1670,5 +1650,4 @@ public String toString() { final StringBuilder builder = new StringBuilder(); return pimpl.accept(TO_STRING_VISITOR, builder).toString(); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java similarity index 87% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java index a91671172..939506d98 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/FilterVisitor.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Functions.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Functions.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Functions.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Functions.java index 9c14ca1ac..6c5465ea8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Functions.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Functions.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -50,6 +40,7 @@ public final class Functions { private static final Function BYTESTRING_TO_STRING = new Function() { + @Override public String apply(final ByteString value) { return value.toString(); } @@ -57,6 +48,7 @@ public String apply(final ByteString value) { private static final Function IDENTITY = new Function() { + @Override public Object apply(final Object value) { return value; } @@ -64,6 +56,7 @@ public Object apply(final Object value) { private static final Function NORMALIZE_STRING = new Function() { + @Override public String apply(final String value) { return StaticUtils.toLowerCase(value).trim(); } @@ -71,6 +64,7 @@ public String apply(final String value) { private static final Function OBJECT_TO_BYTESTRING = new Function() { + @Override public ByteString apply(final Object value) { return ByteString.valueOfObject(value); } @@ -78,6 +72,7 @@ public ByteString apply(final Object value) { private static final Function STRING_TO_BOOLEAN = new Function() { + @Override public Boolean apply(final String value) { final String valueString = StaticUtils.toLowerCase(value); if ("true".equals(valueString) || "yes".equals(valueString) @@ -95,6 +90,7 @@ public Boolean apply(final String value) { private static final Function STRING_TO_GENERALIZED_TIME = new Function() { + @Override public GeneralizedTime apply(final String value) { return GeneralizedTime.valueOf(value); } @@ -102,6 +98,7 @@ public GeneralizedTime apply(final String value) { private static final Function STRING_TO_INTEGER = new Function() { + @Override public Integer apply(final String value) { try { return Integer.valueOf(value); @@ -114,6 +111,7 @@ public Integer apply(final String value) { private static final Function STRING_TO_LONG = new Function() { + @Override public Long apply(final String value) { try { return Long.valueOf(value); @@ -176,6 +174,7 @@ public N apply(M value) { public static Function compose( final Function first, final Function second) { return new Function() { + @Override public N apply(final M value) { return second.apply(first.apply(value)); } @@ -241,6 +240,7 @@ public static Function strin public static Function stringToAttributeDescription( final Schema schema) { return new Function() { + @Override public AttributeDescription apply(final String value) { return AttributeDescription.valueOf(value, schema); } @@ -281,6 +281,7 @@ public static Function stringToDN() { */ public static Function stringToDN(final Schema schema) { return new Function() { + @Override public DN apply(final String value) { return DN.valueOf(value, schema); } @@ -340,6 +341,7 @@ public static Function b public static Function byteStringToAttributeDescription( final Schema schema) { return compose(byteStringToString(), new Function() { + @Override public AttributeDescription apply(final String value) { return AttributeDescription.valueOf(value, schema); } @@ -380,6 +382,7 @@ public static Function byteStringToDN() { */ public static Function byteStringToDN(final Schema schema) { return compose(byteStringToString(), new Function() { + @Override public DN apply(final String value) { return DN.valueOf(value, schema); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/GSERParser.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/GSERParser.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/GSERParser.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/GSERParser.java index 283d04a37..0643b5d67 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/GSERParser.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/GSERParser.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2014 Manuel Gaupp + * Copyright 2013-2014 Manuel Gaupp */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/GeneralizedTime.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/GeneralizedTime.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/GeneralizedTime.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/GeneralizedTime.java index cdb5167ee..66218beed 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/GeneralizedTime.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/GeneralizedTime.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2012-2015 ForgeRock AS. + * Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -54,7 +44,6 @@ * Rules */ public final class GeneralizedTime implements Comparable { - /** UTC TimeZone is assumed to never change over JVM lifetime. */ private static final TimeZone TIME_ZONE_UTC_OBJ = TimeZone.getTimeZone("UTC"); @@ -818,7 +807,6 @@ private GeneralizedTime(final Calendar calendar, final Date date, final long tim this.stringValue = stringValue; } - /** {@inheritDoc} */ @Override public int compareTo(final GeneralizedTime o) { final Long timeMS1 = getTimeInMillis(); @@ -826,7 +814,6 @@ public int compareTo(final GeneralizedTime o) { return timeMS1.compareTo(timeMS2); } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -858,7 +845,6 @@ public long getTimeInMillis() { return tmpTimeMS; } - /** {@inheritDoc} */ @Override public int hashCode() { return ((Long) getTimeInMillis()).hashCode(); @@ -893,7 +879,6 @@ public Date toDate() { return (Date) tmpDate.clone(); } - /** {@inheritDoc} */ @Override public String toString() { String tmpString = stringValue; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java similarity index 64% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java index d0ccd15b4..d68dcc25c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/IntermediateResponseHandler.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnection.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/InternalConnection.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnection.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/InternalConnection.java index b348df661..f7ec3ec8b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnection.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/InternalConnection.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.List; @@ -73,7 +62,6 @@ final class InternalConnection extends AbstractAsynchronousConnection { this.serverConnection = serverConnection; } - /** {@inheritDoc} */ @Override public LdapPromise abandonAsync(final AbandonRequest request) { final int i = messageID.getAndIncrement(); @@ -81,7 +69,6 @@ public LdapPromise abandonAsync(final AbandonRequest request) { return newSuccessfulLdapPromise((Void) null, i); } - /** {@inheritDoc} */ @Override public LdapPromise addAsync(final AddRequest request, final IntermediateResponseHandler intermediateResponseHandler) { @@ -92,32 +79,28 @@ public LdapPromise addAsync(final AddRequest request, return promise; } - /** {@inheritDoc} */ @Override public void addConnectionEventListener(final ConnectionEventListener listener) { Reject.ifNull(listener); listeners.add(listener); } - /** {@inheritDoc} */ @Override public LdapPromise bindAsync(final BindRequest request, final IntermediateResponseHandler intermediateResponseHandler) { final int i = messageID.getAndIncrement(); final BindResultLdapPromiseImpl promise = - newBindLdapPromise(i, request, null, intermediateResponseHandler, this); + newBindLdapPromise(i, request, null, intermediateResponseHandler); serverConnection.handleBind(i, 3, request, promise, promise); return promise; } - /** {@inheritDoc} */ @Override public void close(final UnbindRequest request, final String reason) { final int i = messageID.getAndIncrement(); serverConnection.handleConnectionClosed(i, request); } - /** {@inheritDoc} */ @Override public LdapPromise compareAsync(final CompareRequest request, final IntermediateResponseHandler intermediateResponseHandler) { @@ -128,7 +111,6 @@ public LdapPromise compareAsync(final CompareRequest request, return promise; } - /** {@inheritDoc} */ @Override public LdapPromise deleteAsync(final DeleteRequest request, final IntermediateResponseHandler intermediateResponseHandler) { @@ -139,7 +121,6 @@ public LdapPromise deleteAsync(final DeleteRequest request, return promise; } - /** {@inheritDoc} */ @Override public LdapPromise extendedRequestAsync(final ExtendedRequest request, final IntermediateResponseHandler intermediateResponseHandler) { @@ -150,21 +131,18 @@ public LdapPromise extendedRequestAsync(final Exte return promise; } - /** {@inheritDoc} */ @Override public boolean isClosed() { // FIXME: this should be true after close has been called. return false; } - /** {@inheritDoc} */ @Override public boolean isValid() { // FIXME: this should be false if this connection is disconnected. return true; } - /** {@inheritDoc} */ @Override public LdapPromise modifyAsync(final ModifyRequest request, final IntermediateResponseHandler intermediateResponseHandler) { @@ -175,7 +153,6 @@ public LdapPromise modifyAsync(final ModifyRequest request, return promise; } - /** {@inheritDoc} */ @Override public LdapPromise modifyDNAsync(final ModifyDNRequest request, final IntermediateResponseHandler intermediateResponseHandler) { @@ -186,14 +163,12 @@ public LdapPromise modifyDNAsync(final ModifyDNRequest request, return promise; } - /** {@inheritDoc} */ @Override public void removeConnectionEventListener(final ConnectionEventListener listener) { Reject.ifNull(listener); listeners.remove(listener); } - /** {@inheritDoc} */ @Override public LdapPromise searchAsync(final SearchRequest request, final IntermediateResponseHandler intermediateResponseHandler, final SearchResultHandler entryHandler) { @@ -204,14 +179,8 @@ public LdapPromise searchAsync(final SearchRequest request, return promise; } - /** {@inheritDoc} */ @Override public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("InternalConnection("); - builder.append(serverConnection); - builder.append(')'); - return builder.toString(); + return getClass().getSimpleName() + "(" + serverConnection + ')'; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java index 685f211ed..58f75abf8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/InternalConnectionFactory.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java index 7504772ab..39f5573d5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/KeyManagers.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -46,9 +36,7 @@ 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 @@ -66,7 +54,7 @@ private SelectCertificate(final X509KeyManager keyManager, final String alias) { this.alias = alias; } - /** {@inheritDoc} */ + @Override public String chooseClientAlias(final String[] keyType, final Principal[] issuers, final Socket socket) { for (final String type : keyType) { @@ -83,7 +71,6 @@ public String chooseClientAlias(final String[] keyType, final Principal[] issuer return null; } - /** {@inheritDoc} */ @Override public String chooseEngineClientAlias(final String[] keyType, final Principal[] issuers, final SSLEngine engine) { @@ -101,7 +88,6 @@ public String chooseEngineClientAlias(final String[] keyType, final Principal[] return null; } - /** {@inheritDoc} */ @Override public String chooseEngineServerAlias(final String keyType, final Principal[] issuers, final SSLEngine engine) { @@ -117,7 +103,7 @@ public String chooseEngineServerAlias(final String keyType, final Principal[] is return null; } - /** {@inheritDoc} */ + @Override public String chooseServerAlias(final String keyType, final Principal[] issuers, final Socket socket) { final String[] serverAliases = keyManager.getServerAliases(keyType, issuers); @@ -132,22 +118,22 @@ public String chooseServerAlias(final String keyType, final Principal[] 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); } @@ -209,19 +195,8 @@ public static X509KeyManager useKeyStoreFile(final String file, final char[] pas final String keyStoreFormat = format != null ? format : KeyStore.getDefaultType(); final KeyStore keyStore = KeyStore.getInstance(keyStoreFormat); - - FileInputStream fos = null; - try { - fos = new FileInputStream(keyStoreFile); + try (FileInputStream fos = new FileInputStream(keyStoreFile)) { keyStore.load(fos, password); - } finally { - if (fos != null) { - try { - fos.close(); - } catch (final IOException ignored) { - // Ignore. - } - } } final KeyManagerFactory kmf = diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java index d3491ad15..7d5b69c00 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPClientContext.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java similarity index 98% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java index 5ddc35280..320ed4a98 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPConnectionFactory.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java index 061fc90e5..48ff6bf81 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPListener.java @@ -1,34 +1,21 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ - package org.forgerock.opendj.ldap; -import static com.forgerock.opendj.util.StaticUtils.*; - import java.io.Closeable; import java.io.IOException; import java.net.InetAddress; @@ -115,9 +102,7 @@ public final class LDAPListener extends CommonLDAPOptions implements Closeable { */ private final LDAPListenerImpl impl; - /** - * Transport provider that provides the implementation of this listener. - */ + /** Transport provider that provides the implementation of this listener. */ private TransportProvider provider; /** @@ -262,9 +247,7 @@ public LDAPListener(final String host, final int port, this.impl = provider.getLDAPListener(address, factory, options); } - /** - * Closes this LDAP connection listener. - */ + /** Closes this LDAP connection listener. */ @Override public void close() { impl.close(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java index e0008dc9b..f30d9a020 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LDAPUrl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -101,114 +91,70 @@ public final class LDAPUrl { */ private final boolean isSecured; - /** - * The host name corresponding to an LDAP URL. - */ + /** The host name corresponding to an LDAP URL. */ private final String host; - /** - * The port number corresponding to an LDAP URL. - */ + /** The port number corresponding to an LDAP URL. */ private final int port; - /** - * The distinguished name corresponding to an LDAP URL. - */ + /** The distinguished name corresponding to an LDAP URL. */ private final DN name; - /** - * The search scope corresponding to an LDAP URL. - */ + /** The search scope corresponding to an LDAP URL. */ private final SearchScope scope; - /** - * The search filter corresponding to an LDAP URL. - */ + /** The search filter corresponding to an LDAP URL. */ private final Filter filter; - /** - * The attributes that need to be searched. - */ + /** The attributes that need to be searched. */ private final List attributes; - /** - * The String value of LDAP URL. - */ + /** The String value of LDAP URL. */ private final String urlString; - /** - * Normalized ldap URL. - */ + /** Normalized ldap URL. */ private String normalizedURL; - /** - * The default scheme to be used with LDAP URL. - */ + /** The default scheme to be used with LDAP URL. */ private static final String DEFAULT_URL_SCHEME = "ldap"; - /** - * The SSL-based scheme allowed to be used with LDAP URL. - */ + /** The SSL-based scheme allowed to be used with LDAP URL. */ private static final String SSL_URL_SCHEME = "ldaps"; - /** - * The default host. - */ + /** The default host. */ private static final String DEFAULT_HOST = "localhost"; - /** - * The default non-SSL port. - */ + /** The default non-SSL port. */ private static final int DEFAULT_PORT = 389; - /** - * The default SSL port. - */ + /** The default SSL port. */ private static final int DEFAULT_SSL_PORT = 636; - /** - * The default filter. - */ + /** The default filter. */ private static final Filter DEFAULT_FILTER = Filter.objectClassPresent(); - /** - * The default search scope. - */ + /** The default search scope. */ private static final SearchScope DEFAULT_SCOPE = SearchScope.BASE_OBJECT; - /** - * The default distinguished name. - */ + /** The default distinguished name. */ private static final DN DEFAULT_DN = DN.rootDN(); - /** - * The % encoding character. - */ + /** The % encoding character. */ private static final char PERCENT_ENCODING_CHAR = '%'; - /** - * The ? character. - */ + /** The ? character. */ private static final char QUESTION_CHAR = '?'; - /** - * The slash (/) character. - */ + /** The slash (/) character. */ private static final char SLASH_CHAR = '/'; - /** - * The comma (,) character. - */ + /** The comma (,) character. */ private static final char COMMA_CHAR = ','; - /** - * The colon (:) character. - */ + /** The colon (:) character. */ private static final char COLON_CHAR = ':'; - /** - * Set containing characters that do not need to be encoded. - */ + /** Set containing characters that do not need to be encoded. */ private static final Set VALID_CHARS = new HashSet<>(); static { @@ -627,7 +573,6 @@ public SearchRequest asSearchRequest() { return request; } - /** {@inheritDoc} */ @Override public boolean equals(final Object o) { if (o == this) { @@ -704,7 +649,6 @@ public SearchScope getScope() { return scope; } - /** {@inheritDoc} */ @Override public int hashCode() { final String s = toNormalizedString(); @@ -722,7 +666,6 @@ public boolean isSecure() { return isSecured; } - /** {@inheritDoc} */ @Override public String toString() { return urlString; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java index 9d8ec0f76..5dcb64190 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapPromise.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapPromise.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapPromise.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapPromise.java index dab296963..800fa70b0 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapPromise.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapPromise.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -67,6 +57,9 @@ LdapPromise thenOnResultOrException(ResultHandler onResult, @Override LdapPromise thenAlways(Runnable onResultOrException); + @Override + LdapPromise thenFinally(Runnable onResultOrException); + @Override // @Checkstyle:ignore LdapPromise thenAsync(AsyncFunction onResult); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapResultHandler.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapResultHandler.java similarity index 63% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapResultHandler.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapResultHandler.java index 7d701deee..415fcb021 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LdapResultHandler.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LdapResultHandler.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java index d2e2d01ef..1f9818351 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LinkedAttribute.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.Collection; @@ -54,7 +43,6 @@ public final class LinkedAttribute extends AbstractAttribute { private static abstract class Impl { - abstract boolean add(LinkedAttribute attribute, ByteString value); abstract void clear(LinkedAttribute attribute); @@ -85,7 +73,6 @@ abstract boolean retainAll(LinkedAttribute attribute, Collection values, } private static final class MultiValueImpl extends Impl { - @Override boolean add(final LinkedAttribute attribute, final ByteString value) { final ByteString normalizedValue = normalizeValue(attribute, value); @@ -228,7 +215,6 @@ private void resize(final LinkedAttribute attribute) { } private static final class SingleValueImpl extends Impl { - @Override boolean add(final LinkedAttribute attribute, final ByteString value) { final ByteString normalizedValue = normalizeValue(attribute, value); @@ -358,7 +344,6 @@ int size(final LinkedAttribute attribute) { } private static final class ZeroValueImpl extends Impl { - @Override boolean add(final LinkedAttribute attribute, final ByteString value) { attribute.singleValue = value; @@ -433,12 +418,9 @@ boolean retainAll(final LinkedAttribute attribute, final Collection value int size(final LinkedAttribute attribute) { return 0; } - } - /** - * An attribute factory which can be used to create new linked attributes. - */ + /** An attribute factory which can be used to create new linked attributes. */ public static final AttributeFactory FACTORY = new AttributeFactory() { @Override public Attribute newAttribute(final AttributeDescription attributeDescription) { @@ -646,59 +628,50 @@ public LinkedAttribute(final String attributeDescription, final Object... values add(values); } - /** {@inheritDoc} */ @Override public boolean add(final ByteString value) { Reject.ifNull(value); return pimpl.add(this, value); } - /** {@inheritDoc} */ @Override public void clear() { pimpl.clear(this); } - /** {@inheritDoc} */ @Override public boolean contains(final Object value) { Reject.ifNull(value); return pimpl.contains(this, ByteString.valueOfObject(value)); } - /** {@inheritDoc} */ @Override public boolean containsAll(final Collection values) { Reject.ifNull(values); return pimpl.containsAll(this, values); } - /** {@inheritDoc} */ @Override public ByteString firstValue() { return pimpl.firstValue(this); } - /** {@inheritDoc} */ @Override public AttributeDescription getAttributeDescription() { return attributeDescription; } - /** {@inheritDoc} */ @Override public Iterator iterator() { return pimpl.iterator(this); } - /** {@inheritDoc} */ @Override public boolean remove(final Object value) { Reject.ifNull(value); return pimpl.remove(this, ByteString.valueOfObject(value)); } - /** {@inheritDoc} */ @Override public boolean retainAll(final Collection values, final Collection missingValues) { @@ -706,7 +679,6 @@ public boolean retainAll(final Collection values, return pimpl.retainAll(this, values, missingValues); } - /** {@inheritDoc} */ @Override public int size() { return pimpl.size(this); @@ -719,5 +691,4 @@ private ByteString normalizedSingleValue() { } return normalizedSingleValue; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java index 310d09cf0..027717710 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LinkedHashMapEntry.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -66,6 +56,7 @@ public final class LinkedHashMapEntry extends AbstractMapEntry { * 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); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java index 1c30dad10..a7f8e065a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithm.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -43,23 +33,65 @@ import com.forgerock.opendj.util.ReferenceCountedObject; +import static org.forgerock.opendj.ldap.Connections.*; import static org.forgerock.opendj.ldap.LdapException.*; +import static org.forgerock.opendj.ldap.ResultCode.CLIENT_SIDE_CONNECT_ERROR; +import static org.forgerock.util.Utils.closeSilently; +import static org.forgerock.util.Utils.joinAsString; import static org.forgerock.util.promise.Promises.*; import static com.forgerock.opendj.util.StaticUtils.*; /** - * An abstract load balancing algorithm providing monitoring and failover - * capabilities. + * An abstract load balancer providing common monitoring and failover capabilities. *

    - * Implementations should override the method - * {@code getInitialConnectionFactoryIndex()} in order to provide the policy for - * selecting the first connection factory to use for each connection request. + * Implementations should override the {@link ConnectionFactory} methods and use the + * {@link #getMonitoredConnectionFactory(int)} method in order to obtain the desired load-balanced connection factory. + * If the requested connection factory is unavailable then a linear probe will be performed in order to the next + * suitable connection factory. */ -abstract class AbstractLoadBalancingAlgorithm implements LoadBalancingAlgorithm { - private final class MonitoredConnectionFactory implements ConnectionFactory, - LdapResultHandler { +abstract class LoadBalancer implements ConnectionFactory { + LoadBalancer(final String loadBalancerName, + final Collection factories, + final Options options) { + Reject.ifNull(loadBalancerName, factories, options); + + this.loadBalancerName = loadBalancerName; + this.monitoredFactories = new ArrayList<>(factories.size()); + int i = 0; + for (final ConnectionFactory f : factories) { + this.monitoredFactories.add(new MonitoredConnectionFactory(f, i++)); + } + this.scheduler = DEFAULT_SCHEDULER.acquireIfNull(options.get(LOAD_BALANCER_SCHEDULER)); + this.monitoringIntervalMS = options.get(LOAD_BALANCER_MONITORING_INTERVAL).to(TimeUnit.MILLISECONDS); + this.listener = options.get(LOAD_BALANCER_EVENT_LISTENER); + } + @Override + public final void close() { + if (isClosed.compareAndSet(false, true)) { + synchronized (stateLock) { + if (monitoringFuture != null) { + monitoringFuture.cancel(false); + monitoringFuture = null; + } + } + closeSilently(monitoredFactories); + scheduler.release(); + } + } + + @Override + public final String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append(loadBalancerName); + builder.append('('); + joinAsString(builder, ",", monitoredFactories); + builder.append(')'); + return builder.toString(); + } + + private final class MonitoredConnectionFactory implements ConnectionFactory, LdapResultHandler { private final ConnectionFactory factory; private final AtomicBoolean isOperational = new AtomicBoolean(true); private volatile Promise pendingConnectPromise; @@ -85,9 +117,7 @@ public Connection getConnection() throws LdapException { // Attempt failed - try next factory. notifyOffline(e); final int nextIndex = (index + 1) % monitoredFactories.size(); - final MonitoredConnectionFactory nextFactory = - getMonitoredConnectionFactory(nextIndex); - return nextFactory.getConnection(); + return getMonitoredConnectionFactory(nextIndex).getConnection(); } notifyOnline(); return connection; @@ -114,19 +144,13 @@ public Promise apply(LdapException error) throws Ldap }); } - - - /** - * Handle monitoring connection request failure. - */ + /** Handle monitoring connection request failure. */ @Override public void handleException(final LdapException exception) { notifyOffline(exception); } - /** - * Handle monitoring connection request success. - */ + /** Handle monitoring connection request success. */ @Override public void handleResult(final Connection connection) { // The connection is not going to be used, so close it immediately. @@ -139,10 +163,7 @@ public String toString() { return factory.toString(); } - /** - * Attempt to connect to the factory if it is offline and there is no - * pending monitoring request. - */ + /** Attempt to connect to the factory if it is offline and there is no pending monitoring request. */ private synchronized void checkIfAvailable() { if (!isOperational.get() && (pendingConnectPromise == null || pendingConnectPromise.isDone())) { logger.debug(LocalizableMessage.raw("Attempting reconnect to offline factory '%s'", this)); @@ -153,7 +174,6 @@ private synchronized void checkIfAvailable() { private void notifyOffline(final LdapException error) { // Save the error in case the load-balancer is exhausted. lastFailure = error; - if (isOperational.getAndSet(false)) { // Transition from online to offline. synchronized (listenerLock) { @@ -163,7 +183,6 @@ private void notifyOffline(final LdapException error) { handleListenerException(e); } } - synchronized (stateLock) { offlineFactoriesCount++; if (offlineFactoriesCount == 1) { @@ -186,7 +205,6 @@ private void notifyOnline() { handleListenerException(e); } } - synchronized (stateLock) { offlineFactoriesCount--; if (offlineFactoriesCount == 0) { @@ -201,7 +219,8 @@ private void notifyOnline() { private void handleListenerException(RuntimeException e) { // TODO: I18N - logger.error(LocalizableMessage.raw("A run-time error occurred while processing a load-balancer event", e)); + logger.error(LocalizableMessage.raw( + "A run-time error occurred while processing a load-balancer event", e)); } } @@ -220,6 +239,7 @@ public void run() { private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); + private final String loadBalancerName; private final List monitoredFactories; private final ReferenceCountedObject.Reference scheduler; private final Object stateLock = new Object(); @@ -231,102 +251,30 @@ public void run() { */ private volatile LdapException lastFailure; - /** - * The event listener which should be notified when connection factories go - * on or off-line. - */ + /** The event listener which should be notified when connection factories go on or off-line. */ private final LoadBalancerEventListener listener; - /** - * Ensures that events are notified one at a time. - */ + /** Ensures that events are notified one at a time. */ private final Object listenerLock = new Object(); - /** - * Guarded by stateLock. - */ + /** Guarded by stateLock. */ private int offlineFactoriesCount; private final long monitoringIntervalMS; - /** - * Guarded by stateLock. - */ + /** Guarded by stateLock. */ private ScheduledFuture monitoringFuture; private final AtomicBoolean isClosed = new AtomicBoolean(); - AbstractLoadBalancingAlgorithm(final Collection factories, final Options options) { - Reject.ifNull(factories, options); - - this.monitoredFactories = new ArrayList<>(factories.size()); - int i = 0; - for (final ConnectionFactory f : factories) { - this.monitoredFactories.add(new MonitoredConnectionFactory(f, i++)); - } - this.scheduler = DEFAULT_SCHEDULER.acquireIfNull(options.get(LOAD_BALANCER_SCHEDULER)); - this.monitoringIntervalMS = options.get(LOAD_BALANCER_MONITORING_INTERVAL).to(TimeUnit.MILLISECONDS); - this.listener = options.get(LOAD_BALANCER_EVENT_LISTENER); - } - - @Override - public void close() { - if (isClosed.compareAndSet(false, true)) { - synchronized (stateLock) { - if (monitoringFuture != null) { - monitoringFuture.cancel(false); - monitoringFuture = null; - } - } - for (ConnectionFactory factory : monitoredFactories) { - factory.close(); - } - scheduler.release(); - } - } - - @Override - public final ConnectionFactory getConnectionFactory() throws LdapException { - final int index = getInitialConnectionFactoryIndex(); - return getMonitoredConnectionFactory(index); - } - - @Override - public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append(getAlgorithmName()); - builder.append('('); - boolean isFirst = true; - for (final ConnectionFactory factory : monitoredFactories) { - if (!isFirst) { - builder.append(','); - } else { - isFirst = false; - } - builder.append(factory); - } - builder.append(')'); - return builder.toString(); - } - - /** - * Returns the name of this load balancing algorithm. - * - * @return The name of this load balancing algorithm. - */ - abstract String getAlgorithmName(); - /** - * Returns the index of the first connection factory which should be used in - * order to satisfy the next connection request. + * Return the first available connection factory starting from {@code initialIndex}. * - * @return The index of the first connection factory which should be used in - * order to satisfy the next connection request. + * @param initialIndex The index of the connection factory to be returned if operational. + * @return The first available connection factory starting from the initial index. + * @throws LdapException If no connection factories are available. */ - abstract int getInitialConnectionFactoryIndex(); - - /** Return the first factory after index which is operational. */ - private MonitoredConnectionFactory getMonitoredConnectionFactory(final int initialIndex) throws LdapException { - int index = initialIndex; + final ConnectionFactory getMonitoredConnectionFactory(final int initialIndex) throws LdapException { final int maxIndex = monitoredFactories.size(); + int index = initialIndex; do { final MonitoredConnectionFactory factory = monitoredFactories.get(index); if (factory.isOperational.get()) { @@ -340,7 +288,10 @@ private MonitoredConnectionFactory getMonitoredConnectionFactory(final int initi * policy here such as waiting indefinitely, or for a configurable * timeout period. */ - throw newLdapException(ResultCode.CLIENT_SIDE_CONNECT_ERROR, - "No operational connection factories available", lastFailure); + throw newLdapException(CLIENT_SIDE_CONNECT_ERROR, "No operational connection factories available", lastFailure); + } + + final String getLoadBalancerName() { + return loadBalancerName; } } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java similarity index 71% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java index fb1c1db6b..e288bec01 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/LoadBalancerEventListener.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -40,16 +31,16 @@ * sent at a time. Event listener implementations should not need to be thread * safe. * - * @see LoadBalancingAlgorithm#LOAD_BALANCER_EVENT_LISTENER + * @see Connections#LOAD_BALANCER_EVENT_LISTENER */ public interface LoadBalancerEventListener extends EventListener { /** * An event listener implementation which logs events to the LoadBalancingAlgorithm logger. This event listener is - * the default implementation configured using the {@link LoadBalancingAlgorithm#LOAD_BALANCER_EVENT_LISTENER} + * the default implementation configured using the {@link Connections#LOAD_BALANCER_EVENT_LISTENER} * option. */ LoadBalancerEventListener LOG_EVENTS = new LoadBalancerEventListener() { - private final LocalizedLogger logger = LocalizedLogger.getLocalizedLogger(LoadBalancingAlgorithm.class); + private final LocalizedLogger logger = LocalizedLogger.getLocalizedLogger(LoadBalancer.class); @Override public void handleConnectionFactoryOnline(final ConnectionFactory factory) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java index b8a846121..3f74233b6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Matcher.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -219,6 +209,7 @@ public ConditionResult matches(final Entry entry) { * A visitor which is used to transform a filter into a matcher. */ private static final class Visitor implements FilterVisitor { + @Override public MatcherImpl visitAndFilter(final Schema schema, final List subFilters) { if (subFilters.isEmpty()) { logger.trace(LocalizableMessage.raw("Empty add filter component. Will always return TRUE")); @@ -232,6 +223,7 @@ public MatcherImpl visitAndFilter(final Schema schema, final List subFil return new AndMatcherImpl(subMatchers); } + @Override public MatcherImpl visitApproxMatchFilter(final Schema schema, final String attributeDescription, final ByteString assertionValue) { final AttributeDescription ad; @@ -263,6 +255,7 @@ public MatcherImpl visitApproxMatchFilter(final Schema schema, return new AssertionMatcherImpl(ad, rule, null, assertion, false); } + @Override public MatcherImpl visitEqualityMatchFilter(final Schema schema, final String attributeDescription, final ByteString assertionValue) { final AttributeDescription ad; @@ -294,6 +287,7 @@ public MatcherImpl visitEqualityMatchFilter(final Schema schema, 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) { @@ -369,6 +363,7 @@ public MatcherImpl visitExtensibleMatchFilter(final Schema schema, return new AssertionMatcherImpl(ad, rule, ruleUse, assertion, dnAttributes); } + @Override public MatcherImpl visitGreaterOrEqualFilter(final Schema schema, final String attributeDescription, final ByteString assertionValue) { final AttributeDescription ad; @@ -401,6 +396,7 @@ public MatcherImpl visitGreaterOrEqualFilter(final Schema schema, return new AssertionMatcherImpl(ad, rule, null, assertion, false); } + @Override public MatcherImpl visitLessOrEqualFilter(final Schema schema, final String attributeDescription, final ByteString assertionValue) { final AttributeDescription ad; @@ -432,11 +428,13 @@ public MatcherImpl visitLessOrEqualFilter(final Schema schema, 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 subFilters) { if (subFilters.isEmpty()) { logger.trace(LocalizableMessage.raw("Empty or filter component. Will always return FALSE")); @@ -450,6 +448,7 @@ public MatcherImpl visitOrFilter(final Schema schema, final List subFilt return new OrMatcherImpl(subMatchers); } + @Override public MatcherImpl visitPresentFilter(final Schema schema, final String attributeDescription) { AttributeDescription ad; try { @@ -464,6 +463,7 @@ public MatcherImpl visitPresentFilter(final Schema schema, final String attribut return new PresentMatcherImpl(ad); } + @Override public MatcherImpl visitSubstringsFilter(final Schema schema, final String attributeDescription, final ByteString initialSubstring, final List anySubstrings, final ByteString finalSubstring) { @@ -496,6 +496,7 @@ public MatcherImpl visitSubstringsFilter(final Schema schema, return new AssertionMatcherImpl(ad, rule, null, assertion, false); } + @Override public MatcherImpl visitUnrecognizedFilter(final Schema schema, final byte filterTag, final ByteString filterBytes) { // TODO: I18N diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java index ade491909..714817d45 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -388,18 +379,24 @@ public void handleSearch(final RequestContext requestContext, final SearchReques final Matcher matcher = filter.matcher(schema); final AttributeFilter attributeFilter = new AttributeFilter(request.getAttributes(), schema).typesOnly(request.isTypesOnly()); - if (scope.equals(SearchScope.BASE_OBJECT)) { + switch (scope.asEnum()) { + case BASE_OBJECT: final Entry baseEntry = getRequiredEntry(request, dn); if (matcher.matches(baseEntry).toBoolean()) { sendEntry(attributeFilter, entryHandler, baseEntry); } resultHandler.handleResult(newResult(ResultCode.SUCCESS)); - } else if (scope.equals(SearchScope.SINGLE_LEVEL) || scope.equals(SearchScope.SUBORDINATES) - || scope.equals(SearchScope.WHOLE_SUBTREE)) { + break; + + case SINGLE_LEVEL: + case SUBORDINATES: + case WHOLE_SUBTREE: searchWithSubordinates(requestContext, entryHandler, resultHandler, dn, matcher, attributeFilter, request.getSizeLimit(), scope, request.getControl(SimplePagedResultsControl.DECODER, new DecodeOptions())); - } else { + break; + + default: throw newLdapException(ResultCode.PROTOCOL_ERROR, "Search request contains an unsupported search scope"); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Modification.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Modification.java similarity index 69% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/Modification.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Modification.java index 18cadc0c6..38717d881 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/Modification.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/Modification.java @@ -1,36 +1,24 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import org.forgerock.util.Reject; -/** - * A modification to be performed on an entry during a Modify operation. - */ +/** A modification to be performed on an entry during a Modify operation. */ public final class Modification { private final ModificationType modificationType; private final Attribute attribute; @@ -76,7 +64,6 @@ public ModificationType getModificationType() { return modificationType; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -96,5 +83,4 @@ public String toString() { builder.append("})"); return builder.toString(); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ModificationType.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ModificationType.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ModificationType.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ModificationType.java index f125ff389..eb530b205 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ModificationType.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ModificationType.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -39,7 +30,6 @@ * Directory Access Protocol (LDAP) Modify-Increment Extension */ public final class ModificationType { - /** * Contains equivalent values for the ModificationType values. * This allows easily using ModificationType values with switch statements. @@ -155,7 +145,6 @@ private ModificationType(final int intValue, final String name, final Enum modif this.modificationTypeEnum = modificationTypeEnum; } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -167,7 +156,6 @@ public boolean equals(final Object obj) { } } - /** {@inheritDoc} */ @Override public int hashCode() { return intValue; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java new file mode 100644 index 000000000..b81ba27cb --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/MultipleEntriesFoundException.java @@ -0,0 +1,35 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +import org.forgerock.opendj.ldap.responses.Result; + +/** + * Thrown when the result code returned in a Result indicates that the requested + * single entry search operation or read operation failed because the Directory + * Server returned multiple matching entries (or search references) when only a + * single matching entry was expected. More specifically, this exception is used + * for the {@link ResultCode#CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED + * CLIENT_SIDE_UNEXPECTED_RESULTS_RETURNED} error result codes. + */ +@SuppressWarnings("serial") +public class MultipleEntriesFoundException extends LdapException { + MultipleEntriesFoundException(final Result result) { + super(result); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ProviderNotFoundException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ProviderNotFoundException.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ProviderNotFoundException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ProviderNotFoundException.java index d11e44726..b16d567a4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ProviderNotFoundException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ProviderNotFoundException.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RDN.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RDN.java similarity index 65% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/RDN.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RDN.java index bf5bfe1e0..5430c05ac 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RDN.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RDN.java @@ -1,50 +1,46 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; +import static com.forgerock.opendj.ldap.CoreMessages.ERR_RDN_DUPLICATE_AVA_TYPES; +import static com.forgerock.opendj.ldap.CoreMessages.ERR_RDN_NO_AVAS; +import static com.forgerock.opendj.ldap.CoreMessages.ERR_RDN_TRAILING_GARBAGE; import static com.forgerock.opendj.ldap.CoreMessages.ERR_RDN_TYPE_NOT_FOUND; +import static org.forgerock.opendj.ldap.DN.AVA_CHAR_SEPARATOR; +import static org.forgerock.opendj.ldap.DN.NORMALIZED_AVA_SEPARATOR; +import static org.forgerock.opendj.ldap.DN.NORMALIZED_RDN_SEPARATOR; +import static org.forgerock.opendj.ldap.DN.RDN_CHAR_SEPARATOR; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.TreeSet; -import org.forgerock.i18n.LocalizableMessage; import org.forgerock.i18n.LocalizedIllegalArgumentException; import org.forgerock.opendj.ldap.schema.AttributeType; import org.forgerock.opendj.ldap.schema.Schema; import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException; +import org.forgerock.util.Reject; import com.forgerock.opendj.util.Iterators; import com.forgerock.opendj.util.SubstringReader; -import org.forgerock.util.Reject; /** * A relative distinguished name (RDN) as defined in RFC 4512 section 2.3 is the @@ -74,18 +70,44 @@ */ public final class RDN implements Iterable, Comparable { - /** Separator for AVAs. */ - private static final char AVA_CHAR_SEPARATOR = '+'; + /** + * A constant holding a special RDN having zero AVAs + * and which sorts before any RDN other than itself. + */ + private static final RDN MIN_VALUE = new RDN(); + /** + * A constant holding a special RDN having zero AVAs + * and which sorts after any RDN other than itself. + */ + private static final RDN MAX_VALUE = new RDN(); /** - * A constant holding a special RDN having zero AVAs and which always - * compares greater than any other RDN other than itself. + * Returns a constant containing a special RDN which sorts before any + * RDN other than itself. This RDN may be used in order to perform + * range queries on DN keyed collections such as {@code SortedSet}s and + * {@code SortedMap}s. For example, the following code can be used to + * construct a range whose contents is a sub-tree of entries, excluding the base entry: + * + *

    +     * SortedMap entries = ...;
    +     * DN baseDN = ...;
    +     *
    +     * // Returns a map containing the baseDN and all of its subordinates.
    +     * SortedMap subtree = entries.subMap(
    +     *     baseDN.child(RDN.minValue()), baseDN.child(RDN.maxValue()));
    +     * 
    + * + * @return A constant containing a special RDN which sorts before any + * RDN other than itself. + * @see #maxValue() */ - private static final RDN MAX_VALUE = new RDN(new AVA[0], ""); + public static RDN minValue() { + return MIN_VALUE; + } /** - * Returns a constant containing a special RDN which is greater than any - * other RDN other than itself. This RDN may be used in order to perform + * Returns a constant containing a special RDN which sorts after any + * RDN other than itself. This RDN may be used in order to perform * range queries on DN keyed collections such as {@code SortedSet}s and * {@code SortedMap}s. For example, the following code can be used to * construct a range whose contents is a sub-tree of entries: @@ -95,11 +117,12 @@ public final class RDN implements Iterable, Comparable { * DN baseDN = ...; * * // Returns a map containing the baseDN and all of its subordinates. - * SortedMap subtree = entries.subMap(baseDN, baseDN.child(RDN.maxValue)); + * SortedMap subtree = entries.subMap(baseDN, baseDN.child(RDN.maxValue())); * * - * @return A constant containing a special RDN which is greater than any - * other RDN other than itself. + * @return A constant containing a special RDN which sorts after any + * RDN other than itself. + * @see #minValue() */ public static RDN maxValue() { return MAX_VALUE; @@ -139,18 +162,20 @@ public static RDN valueOf(final String rdn) { */ public static RDN valueOf(final String rdn, final Schema schema) { final SubstringReader reader = new SubstringReader(rdn); + final RDN parsedRdn; try { - return decode(rdn, reader, schema); + parsedRdn = decode(reader, schema); } catch (final UnknownSchemaElementException e) { - final LocalizableMessage message = - ERR_RDN_TYPE_NOT_FOUND.get(rdn, e.getMessageObject()); - throw new LocalizedIllegalArgumentException(message); + throw new LocalizedIllegalArgumentException(ERR_RDN_TYPE_NOT_FOUND.get(rdn, e.getMessageObject())); } + if (reader.remaining() > 0) { + throw new LocalizedIllegalArgumentException( + ERR_RDN_TRAILING_GARBAGE.get(rdn, reader.read(reader.remaining()))); + } + return parsedRdn; } - // FIXME: ensure that the decoded RDN does not contain multiple AVAs - // with the same type. - static RDN decode(final String rdnString, final SubstringReader reader, final Schema schema) { + static RDN decode(final SubstringReader reader, final Schema schema) { final AVA firstAVA = AVA.decode(reader, schema); // Skip over any spaces that might be after the attribute value. @@ -171,10 +196,10 @@ static RDN decode(final String rdnString, final SubstringReader reader, final Sc } while (reader.remaining() > 0 && reader.read() == '+'); reader.reset(); - return new RDN(avas.toArray(new AVA[avas.size()]), null); + return new RDN(avas); } else { reader.reset(); - return new RDN(new AVA[] { firstAVA }, null); + return new RDN(firstAVA); } } @@ -233,9 +258,40 @@ public RDN(final String attributeType, final Object attributeValue) { * The attribute-value assertions used to build this RDN. * @throws NullPointerException * If {@code avas} is {@code null} or contains a null ava. + * @throws IllegalArgumentException + * If {@code avas} is empty. */ public RDN(final AVA... avas) { - this(avas, null); + Reject.ifNull(avas); + this.avas = validateAvas(avas); + } + + private AVA[] validateAvas(final AVA[] avas) { + switch (avas.length) { + case 0: + throw new LocalizedIllegalArgumentException(ERR_RDN_NO_AVAS.get()); + case 1: + // Guaranteed to be valid. + break; + case 2: + if (avas[0].getAttributeType().equals(avas[1].getAttributeType())) { + throw new LocalizedIllegalArgumentException( + ERR_RDN_DUPLICATE_AVA_TYPES.get(avas[0].getAttributeName())); + } + break; + default: + final AVA[] sortedAVAs = Arrays.copyOf(avas, avas.length); + Arrays.sort(sortedAVAs); + AttributeType previousAttributeType = null; + for (AVA ava : sortedAVAs) { + if (ava.getAttributeType().equals(previousAttributeType)) { + throw new LocalizedIllegalArgumentException( + ERR_RDN_DUPLICATE_AVA_TYPES.get(ava.getAttributeName())); + } + previousAttributeType = ava.getAttributeType(); + } + } + return avas; } /** @@ -245,20 +301,25 @@ public RDN(final AVA... avas) { * The attribute-value assertions used to build this RDN. * @throws NullPointerException * If {@code ava} is {@code null} or contains null ava. + * @throws IllegalArgumentException + * If {@code avas} is empty. */ public RDN(Collection avas) { - this(avas.toArray(new AVA[avas.size()]), null); + Reject.ifNull(avas); + this.avas = validateAvas(avas.toArray(new AVA[avas.size()])); } - private RDN(final AVA[] avas, final String stringValue) { - Reject.ifNull(avas); - this.avas = avas; - this.stringValue = stringValue; + // Special constructor for min/max RDN values. + private RDN() { + this.avas = new AVA[0]; + this.stringValue = ""; } - /** {@inheritDoc} */ @Override public int compareTo(final RDN rdn) { + // FIXME how about replacing this method body with the following code? + // return toNormalizedByteString().compareTo(rdn.toNormalizedByteString()) + // Identity. if (this == rdn) { return 0; @@ -268,11 +329,18 @@ public int compareTo(final RDN rdn) { if (this == MAX_VALUE) { return 1; } - if (rdn == MAX_VALUE) { return -1; } + // MIN_VALUE is always less than any other RDN other than itself. + if (this == MIN_VALUE) { + return -1; + } + if (rdn == MIN_VALUE) { + return 1; + } + // Compare number of AVAs first as this is quick and easy. final int sz1 = avas.length; final int sz2 = rdn.avas.length; @@ -304,7 +372,6 @@ public int compareTo(final RDN rdn) { return 0; } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -343,7 +410,6 @@ public AVA getFirstAVA() { return avas[0]; } - /** {@inheritDoc} */ @Override public int hashCode() { // Avoid an algorithm that requires the AVAs to be sorted. @@ -364,6 +430,22 @@ public boolean isMultiValued() { return avas.length > 1; } + /** + * Indicates whether this RDN includes the specified attribute type. + * + * @param attributeType The attribute type for which to make the determination. + * @return {@code true} if the RDN includes the specified attribute type, + * or {@code false} if not. + */ + public boolean hasAttributeType(AttributeType attributeType) { + for (AVA ava : avas) { + if (ava.getAttributeType().equals(attributeType)) { + return true; + } + } + return false; + } + /** * Returns an iterator of the AVAs contained in this RDN. The AVAs will be * returned in the user provided order. @@ -403,7 +485,7 @@ public String toString() { final StringBuilder builder = new StringBuilder(); avas[0].toString(builder); for (int i = 1; i < avas.length; i++) { - builder.append('+'); + builder.append(AVA_CHAR_SEPARATOR); avas[i].toString(builder); } stringValue = builder.toString(); @@ -428,17 +510,22 @@ StringBuilder toString(final StringBuilder builder) { ByteStringBuilder toNormalizedByteString(final ByteStringBuilder builder) { switch (size()) { case 0: - // Handle RDN.maxValue(). - builder.appendByte(DN.NORMALIZED_AVA_SEPARATOR); + if (this == MIN_VALUE) { + builder.appendByte(NORMALIZED_RDN_SEPARATOR); + } else { // can only be MAX_VALUE + builder.appendByte(NORMALIZED_AVA_SEPARATOR); + } break; case 1: + builder.appendByte(NORMALIZED_RDN_SEPARATOR); getFirstAVA().toNormalizedByteString(builder); break; default: + builder.appendByte(NORMALIZED_RDN_SEPARATOR); Iterator it = getSortedAvas(); it.next().toNormalizedByteString(builder); while (it.hasNext()) { - builder.appendByte(DN.NORMALIZED_AVA_SEPARATOR); + builder.appendByte(NORMALIZED_AVA_SEPARATOR); it.next().toNormalizedByteString(builder); } break; @@ -458,8 +545,13 @@ ByteStringBuilder toNormalizedByteString(final ByteStringBuilder builder) { StringBuilder toNormalizedUrlSafeString(final StringBuilder builder) { switch (size()) { case 0: - // Handle RDN.maxValue(). - builder.append(RDN.AVA_CHAR_SEPARATOR); + // since MIN_VALUE and MAX_VALUE are only used for sorting DNs, + // it is strange to call toNormalizedUrlSafeString() on one of them + if (this == MIN_VALUE) { + builder.append(RDN_CHAR_SEPARATOR); + } else { // can only be MAX_VALUE + builder.append(AVA_CHAR_SEPARATOR); + } break; case 1: getFirstAVA().toNormalizedUrlSafe(builder); @@ -468,7 +560,7 @@ StringBuilder toNormalizedUrlSafeString(final StringBuilder builder) { Iterator it = getSortedAvas(); it.next().toNormalizedUrlSafe(builder); while (it.hasNext()) { - builder.append(RDN.AVA_CHAR_SEPARATOR); + builder.append(AVA_CHAR_SEPARATOR); it.next().toNormalizedUrlSafe(builder); } break; @@ -478,9 +570,7 @@ StringBuilder toNormalizedUrlSafeString(final StringBuilder builder) { private Iterator getSortedAvas() { TreeSet sortedAvas = new TreeSet<>(); - for (AVA ava : avas) { - sortedAvas.add(ava); - } + Collections.addAll(sortedAvas, avas); return sortedAvas.iterator(); } } diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ReferralException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ReferralException.java new file mode 100644 index 000000000..98936b6ac --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ReferralException.java @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009-2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap; + +import org.forgerock.opendj.ldap.responses.Result; + +/** + * Thrown when the result code returned in a Result indicates that the Request + * could not be processed by the Directory Server because the target entry is + * located on another server. More specifically, this exception is used for the + * {@link ResultCode#REFERRAL REFERRAL} result code. + */ +@SuppressWarnings("serial") +public class ReferralException extends EntryNotFoundException { + ReferralException(final Result result) { + super(result); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestContext.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestContext.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestContext.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestContext.java index 8122759fe..cbcdb4609 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestContext.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestContext.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2012 ForgeRock AS + * Copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java index ff04de7b7..50dd0f2f9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandler.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java index 5f1a978ff..525e11575 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactory.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2014 ForgeRock AS + * Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java index 48937968d..0100d3d06 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestHandlerFactoryAdapter.java @@ -1,29 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2015 ForgeRock AS + * Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import static com.forgerock.opendj.ldap.CoreMessages.INFO_CANCELED_BY_ABANDON_REQUEST; @@ -72,16 +61,10 @@ * The type of client context. */ final class RequestHandlerFactoryAdapter implements ServerConnectionFactory { - /** - * Request context implementation. - */ + /** Request context implementation. */ private static class RequestContextImpl> implements RequestContext, LdapResultHandler { - - /** - * Adapter class which invokes cancel result handlers with correct - * result type. - */ + /** Adapter class which invokes cancel result handlers with correct result type. */ private static final class ExtendedResultHandlerHolder { private final ExtendedRequest request; private final LdapResultHandler resultHandler; @@ -146,7 +129,6 @@ protected RequestContextImpl(final ServerConnectionImpl clientConnection, this.isCancelSupported = isCancelSupported; } - /** {@inheritDoc} */ @Override public void addCancelRequestListener(final CancelRequestListener listener) { Reject.ifNull(listener); @@ -167,10 +149,7 @@ public void addCancelRequestListener(final CancelRequestListener listener) { case TOO_LATE: case RESULT_SENT: case CANCELLED: - /* - * No point in registering the callback since the request - * can never be cancelled now. - */ + /* No point in registering the callback since the request can never be cancelled now. */ break; } } @@ -180,7 +159,6 @@ public void addCancelRequestListener(final CancelRequestListener listener) { } } - /** {@inheritDoc} */ @Override public void checkIfCancelled(final boolean signalTooLate) throws CancelledResultException { synchronized (stateLock) { @@ -193,10 +171,7 @@ public void checkIfCancelled(final boolean signalTooLate) throws CancelledResult } break; case CANCEL_REQUESTED: - /* - * Don't change state: let the handler ack the cancellation - * request. - */ + /* Don't change state: let the handler ack the cancellation request. */ throw (CancelledResultException) newLdapException(ResultCode.CANCELLED, cancelRequestReason.toString()); case TOO_LATE: @@ -204,22 +179,17 @@ public void checkIfCancelled(final boolean signalTooLate) throws CancelledResult break; case RESULT_SENT: case CANCELLED: - /* - * This should not happen - could throw an illegal state - * exception? - */ + /* This should not happen - could throw an illegal state exception? */ break; } } } - /** {@inheritDoc} */ @Override public int getMessageID() { return messageID; } - /** {@inheritDoc} */ @Override public void handleException(final LdapException error) { if (clientConnection.removePendingRequest(this)) { @@ -235,7 +205,6 @@ public void handleException(final LdapException error) { } } - /** {@inheritDoc} */ @Override public void handleResult(final S result) { if (clientConnection.removePendingRequest(this)) { @@ -251,7 +220,6 @@ public void handleResult(final S result) { } } - /** {@inheritDoc} */ @Override public void removeCancelRequestListener(final CancelRequestListener listener) { Reject.ifNull(listener); @@ -297,9 +265,7 @@ private void cancel(final LocalizableMessage reason, this.sendResult &= sendResult; break; case CANCEL_REQUESTED: - /* - * Cancel already request so listeners already invoked. - */ + /* Cancel already request so listeners already invoked. */ if (cancelResultHandler != null) { if (cancelResultHandlers == null) { cancelResultHandlers = new LinkedList<>(); @@ -310,10 +276,7 @@ private void cancel(final LocalizableMessage reason, break; case TOO_LATE: case RESULT_SENT: - /* - * Cannot cancel, so invoke result handler immediately - * outside of lock. - */ + /* Cannot cancel, so invoke result handler immediately outside of lock. */ if (cancelResultHandler != null) { invokeResultHandler = true; resultHandlerIsSuccess = false; @@ -380,10 +343,7 @@ private boolean setResult(final Result result) { } break; case CANCEL_REQUESTED: - /* - * Switch to appropriate final state and invoke any cancel - * request handlers. - */ + /* Switch to appropriate final state and invoke any cancel request handlers. */ if (!result.getResultCode().equals(ResultCode.CANCELLED)) { state = RequestState.RESULT_SENT; } else { @@ -396,10 +356,7 @@ private boolean setResult(final Result result) { break; case RESULT_SENT: case CANCELLED: - /* - * This should not happen - could throw an illegal state - * exception? - */ + /* This should not happen - could throw an illegal state exception? */ maySendResult = false; // Prevent sending multiple results. break; } @@ -420,9 +377,7 @@ private boolean setResult(final Result result) { } } - /** - * Search request context implementation. - */ + /** Search request context implementation. */ private static final class SearchRequestContextImpl extends RequestContextImpl> implements SearchResultHandler { @@ -435,13 +390,11 @@ private SearchRequestContextImpl(final ServerConnectionImpl clientConnection, this.entryHandler = entryHandler; } - /** {@inheritDoc} */ @Override public boolean handleEntry(final SearchResultEntry entry) { return entryHandler.handleEntry(entry); } - /** {@inheritDoc} */ @Override public boolean handleReference(final SearchResultReference reference) { return entryHandler.handleReference(reference); @@ -457,7 +410,6 @@ private ServerConnectionImpl(final RequestHandler requestHandler this.requestHandler = requestHandler; } - /** {@inheritDoc} */ @Override public void handleAbandon(final Integer messageID, final AbandonRequest request) { final RequestContextImpl abandonedRequest = @@ -469,7 +421,6 @@ public void handleAbandon(final Integer messageID, final AbandonRequest request) } } - /** {@inheritDoc} */ @Override public void handleAdd(final Integer messageID, final AddRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -482,7 +433,6 @@ public void handleAdd(final Integer messageID, final AddRequest request, } } - /** {@inheritDoc} */ @Override public void handleBind(final Integer messageID, final int version, final BindRequest request, @@ -496,7 +446,6 @@ public void handleBind(final Integer messageID, final int version, } } - /** {@inheritDoc} */ @Override public void handleCompare(final Integer messageID, final CompareRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -509,28 +458,24 @@ public void handleCompare(final Integer messageID, final CompareRequest request, } } - /** {@inheritDoc} */ @Override public void handleConnectionClosed(final Integer messageID, final UnbindRequest request) { final LocalizableMessage cancelReason = INFO_CANCELED_BY_CLIENT_DISCONNECT.get(); doClose(cancelReason); } - /** {@inheritDoc} */ @Override public void handleConnectionDisconnected(final ResultCode resultCode, final String message) { final LocalizableMessage cancelReason = INFO_CANCELED_BY_SERVER_DISCONNECT.get(); doClose(cancelReason); } - /** {@inheritDoc} */ @Override public void handleConnectionError(final Throwable error) { final LocalizableMessage cancelReason = INFO_CANCELED_BY_CLIENT_ERROR.get(); doClose(cancelReason); } - /** {@inheritDoc} */ @Override public void handleDelete(final Integer messageID, final DeleteRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -543,7 +488,6 @@ public void handleDelete(final Integer messageID, final DeleteRequest request, } } - /** {@inheritDoc} */ @Override public void handleExtendedRequest(final Integer messageID, final ExtendedRequest request, @@ -579,10 +523,7 @@ public void handleExtendedRequest(final Integer messa INFO_CANCELED_BY_CANCEL_REQUEST.get(messageID); cancelledRequest.cancel(cancelReason, request, requestContext, true); } else { - /* - * Couldn't find the request. Invoke on context in order - * to remove pending request. - */ + /* Couldn't find the request. Invoke on context in order to remove pending request. */ requestContext.handleException(newLdapException(ResultCode.NO_SUCH_OPERATION)); } } @@ -599,7 +540,6 @@ public void handleExtendedRequest(final Integer messa } } - /** {@inheritDoc} */ @Override public void handleModify(final Integer messageID, final ModifyRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -612,7 +552,6 @@ public void handleModify(final Integer messageID, final ModifyRequest request, } } - /** {@inheritDoc} */ @Override public void handleModifyDN(final Integer messageID, final ModifyDNRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -625,7 +564,6 @@ public void handleModifyDN(final Integer messageID, final ModifyDNRequest reques } } - /** {@inheritDoc} */ @Override public void handleSearch(final Integer messageID, final SearchRequest request, final IntermediateResponseHandler intermediateResponseHandler, final SearchResultHandler entryHandler, @@ -708,7 +646,6 @@ private void doClose(final LocalizableMessage cancelReason) { private boolean removePendingRequest(final RequestContextImpl requestContext) { return pendingRequests.remove(requestContext.getMessageID()) != null; } - } /** @@ -738,10 +675,8 @@ static ServerConnection adaptRequestHandler( this.factory = factory; } - /** {@inheritDoc} */ @Override public ServerConnection handleAccept(final C clientContext) throws LdapException { return adaptRequestHandler(factory.handleAccept(clientContext)); } - } diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestLoadBalancer.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestLoadBalancer.java new file mode 100644 index 000000000..3e12e3cdf --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RequestLoadBalancer.java @@ -0,0 +1,251 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static org.forgerock.opendj.ldap.spi.LdapPromises.newFailedLdapPromise; +import static org.forgerock.util.Utils.closeSilently; +import static org.forgerock.util.promise.Promises.newResultPromise; + +import java.util.Collection; +import java.util.concurrent.atomic.AtomicReference; + +import org.forgerock.opendj.ldap.requests.AbandonRequest; +import org.forgerock.opendj.ldap.requests.AddRequest; +import org.forgerock.opendj.ldap.requests.BindRequest; +import org.forgerock.opendj.ldap.requests.CompareRequest; +import org.forgerock.opendj.ldap.requests.DeleteRequest; +import org.forgerock.opendj.ldap.requests.ExtendedRequest; +import org.forgerock.opendj.ldap.requests.ModifyDNRequest; +import org.forgerock.opendj.ldap.requests.ModifyRequest; +import org.forgerock.opendj.ldap.requests.Request; +import org.forgerock.opendj.ldap.requests.SearchRequest; +import org.forgerock.opendj.ldap.requests.UnbindRequest; +import org.forgerock.opendj.ldap.responses.BindResult; +import org.forgerock.opendj.ldap.responses.CompareResult; +import org.forgerock.opendj.ldap.responses.ExtendedResult; +import org.forgerock.opendj.ldap.responses.Result; +import org.forgerock.opendj.ldap.spi.ConnectionState; +import org.forgerock.opendj.ldap.spi.LdapPromises; +import org.forgerock.util.AsyncFunction; +import org.forgerock.util.Function; +import org.forgerock.util.Options; +import org.forgerock.util.promise.ExceptionHandler; +import org.forgerock.util.promise.NeverThrowsException; +import org.forgerock.util.promise.Promise; +import org.forgerock.util.promise.ResultHandler; + +/** + * A request based load balancer which load balances individual requests based on properties of the request, such as + * the target DN. + *

    + * Implementations should override the method {@code getInitialConnectionFactoryIndex()} in order to provide the policy + * for selecting the first connection factory to use for each request. + */ +final class RequestLoadBalancer extends LoadBalancer { + /** + * A function which returns the index of the first connection factory which should be used in order to satisfy the + * next request. Implementations may base the decision on properties of the provided request, such as the target DN, + * whether the request is a read or update request, etc. + */ + private final Function nextFactoryFunction; + + RequestLoadBalancer(final String loadBalancerName, + final Collection factories, + final Options options, + final Function nextFactoryFunction) { + super(loadBalancerName, factories, options); + this.nextFactoryFunction = nextFactoryFunction; + } + + @Override + public final Connection getConnection() throws LdapException { + return new ConnectionImpl(); + } + + @Override + public final Promise getConnectionAsync() { + return newResultPromise((Connection) new ConnectionImpl()); + } + + private class ConnectionImpl extends AbstractAsynchronousConnection { + private final ConnectionState state = new ConnectionState(); + + @Override + public String toString() { + return getLoadBalancerName() + "Connection"; + } + + @Override + public LdapPromise abandonAsync(final AbandonRequest request) { + // We cannot possibly route these correctly, so just drop them. + return LdapPromises.newSuccessfulLdapPromise(null); + } + + @Override + public LdapPromise addAsync( + final AddRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.addAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public void addConnectionEventListener(final ConnectionEventListener listener) { + state.addConnectionEventListener(listener); + } + + @Override + public LdapPromise bindAsync( + final BindRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.bindAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public void close(final UnbindRequest request, final String reason) { + state.notifyConnectionClosed(); + } + + @Override + public LdapPromise compareAsync( + final CompareRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.compareAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public LdapPromise deleteAsync( + final DeleteRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.deleteAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public LdapPromise extendedRequestAsync( + final ExtendedRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.extendedRequestAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public boolean isClosed() { + return state.isClosed(); + } + + @Override + public boolean isValid() { + return state.isValid(); + } + + @Override + public LdapPromise modifyAsync( + final ModifyRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.modifyAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public LdapPromise modifyDNAsync( + final ModifyDNRequest request, final IntermediateResponseHandler intermediateResponseHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.modifyDNAsync(request, intermediateResponseHandler); + } + }); + } + + @Override + public void removeConnectionEventListener(final ConnectionEventListener listener) { + state.removeConnectionEventListener(listener); + } + + @Override + public LdapPromise searchAsync( + final SearchRequest request, + final IntermediateResponseHandler intermediateResponseHandler, + final SearchResultHandler entryHandler) { + return getConnectionAndSendRequest(request, new AsyncFunction() { + @Override + public Promise apply(final Connection connection) throws LdapException { + return connection.searchAsync(request, intermediateResponseHandler, entryHandler); + } + }); + } + + private LdapPromise getConnectionAndSendRequest( + final Request request, final AsyncFunction sendRequest) { + if (state.isClosed()) { + throw new IllegalStateException(); + } + final AtomicReference connectionHolder = new AtomicReference<>(); + return getConnectionAsync(request) + .thenOnResult(new ResultHandler() { + @Override + public void handleResult(final Connection connection) { + connectionHolder.set(connection); + } + }) + .thenAsync(sendRequest) + .thenFinally(new Runnable() { + @Override + public void run() { + closeSilently(connectionHolder.get()); + } + }); + } + + private LdapPromise getConnectionAsync(final Request request) { + try { + final int index = nextFactoryFunction.apply(request); + final ConnectionFactory factory = getMonitoredConnectionFactory(index); + return LdapPromises.asPromise(factory.getConnectionAsync() + .thenOnException(new ExceptionHandler() { + @Override + public void handleException(final LdapException e) { + state.notifyConnectionError(false, e); + } + })); + } catch (final LdapException e) { + state.notifyConnectionError(false, e); + return newFailedLdapPromise(e); + } + } + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ResultCode.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ResultCode.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ResultCode.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ResultCode.java index d72c6fa03..f60c5eac0 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ResultCode.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ResultCode.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -48,7 +38,6 @@ * Lightweight Directory Access Protocol (LDAP): The Protocol */ public final class ResultCode { - /** * Contains equivalent values for the ResultCode values. * This allows easily using ResultCode values with switch statements. @@ -933,7 +922,6 @@ private ResultCode(final int intValue, final LocalizableMessage name, final bool this.resultCodeEnum = resultCodeEnum; } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -954,7 +942,6 @@ public LocalizableMessage getName() { return name; } - /** {@inheritDoc} */ @Override public int hashCode() { return intValue; @@ -1010,5 +997,4 @@ public boolean isExceptional() { public String toString() { return name.toString(); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java index ac2f5ac29..5f734842c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/RootDSE.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -137,9 +127,6 @@ public final class RootDSE { * @param connection * A connection to the Directory Server whose Root DSE is to be * read. - * @param handler - * A result handler which can be used to asynchronously process - * the operation result when it is received, may be {@code null}. * @return A promise representing the result of the operation. * @throws UnsupportedOperationException * If the connection does not support search operations. @@ -149,8 +136,7 @@ public final class RootDSE { * @throws NullPointerException * If the {@code connection} was {@code null}. */ - public static LdapPromise readRootDSEAsync(final Connection connection, - final LdapResultHandler handler) { + public static LdapPromise readRootDSEAsync(final Connection connection) { return connection.searchSingleEntryAsync(SEARCH_REQUEST).then( new Function() { @Override @@ -424,19 +410,16 @@ private Collection getMultiValuedAttribute( if (attr != null) { return Collections.unmodifiableCollection(Collections2.transformedCollection(attr, function, Functions.objectToByteString())); - } else { - return Collections.emptySet(); } + return Collections.emptySet(); } private N getSingleValuedAttribute(final AttributeDescription attributeDescription, final Function function) { final Attribute attr = entry.getAttribute(attributeDescription); - if (attr == null || attr.isEmpty()) { - return null; - } else { + if (attr != null && !attr.isEmpty()) { return function.apply(attr.firstValue()); } + return null; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java similarity index 81% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java index 3784371c1..169d966ca 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SSLContextBuilder.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.security.GeneralSecurityException; @@ -60,39 +50,24 @@ * */ public final class SSLContextBuilder { - - /** - * SSL protocol: supports some version of SSL; may support other versions. - */ + /** SSL protocol: supports some version of SSL; may support other versions. */ public static final String PROTOCOL_SSL = "SSL"; - - /** - * SSL protocol: supports SSL version 2 or higher; may support other - * versions. - */ + /** SSL protocol: supports SSL version 2 or higher; may support other versions. */ public static final String PROTOCOL_SSL2 = "SSLv2"; - - /** - * SSL protocol: supports SSL version 3; may support other versions. - */ + /** SSL protocol: supports SSL version 3; may support other versions. */ public static final String PROTOCOL_SSL3 = "SSLv3"; - - /** - * SSL protocol: supports some version of TLS; may support other versions. - */ + /** SSL protocol: supports some version of TLS; may support other versions. */ public static final String PROTOCOL_TLS = "TLS"; - /** - * SSL protocol: supports RFC 2246: TLS version 1.0 ; may support other - * versions. + * SSL protocol: supports RFC 2246: TLS version 1.0 ; may support other versions. + *

    + * This is the default version. */ public static final String PROTOCOL_TLS1 = "TLSv1"; - - /** - * SSL protocol: supports RFC 4346: TLS version 1.1 ; may support other - * versions. - */ + /** SSL protocol: supports RFC 4346: TLS version 1.1 ; may support other versions. */ public static final String PROTOCOL_TLS1_1 = "TLSv1.1"; + /** SSL protocol: supports RFC 5246: TLS version 1.2 ; may support other versions. */ + public static final String PROTOCOL_TLS1_2 = "TLSv1.2"; private TrustManager trustManager; private KeyManager keyManager; @@ -103,9 +78,7 @@ public final class SSLContextBuilder { private Provider provider; private String providerName; - /** - * Creates a new SSL context builder using default parameters. - */ + /** Creates a new SSL context builder using default parameters. */ public SSLContextBuilder() { // Do nothing. } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java index adb3d7a48..2e285dace 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SchemaResolver.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -47,7 +37,7 @@ public interface SchemaResolver { * returned by {@link Schema#getDefaultSchema()}. */ SchemaResolver DEFAULT = new SchemaResolver() { - + @Override public Schema resolveSchema(String dn) { return Schema.getDefaultSchema(); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java index 3ac214397..c9be04cf8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchResultHandler.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java similarity index 60% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java index 248543e02..7952b330f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchResultReferenceIOException.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchScope.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchScope.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchScope.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchScope.java index 94e8b4c06..d3727ca6f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SearchScope.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SearchScope.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2013 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -42,7 +32,6 @@ * Scope for LDAP */ public final class SearchScope { - /** * Contains equivalent values for the SearchScope values. * This allows easily using SearchScope values with switch statements. @@ -67,21 +56,13 @@ public static enum Enum { private static final List IMMUTABLE_ELEMENTS = Collections.unmodifiableList(Arrays .asList(ELEMENTS)); - /** - * The scope is constrained to the search base entry. - */ + /** The scope is constrained to the search base entry. */ public static final SearchScope BASE_OBJECT = register(0, "base", Enum.BASE_OBJECT); - /** - * The scope is constrained to the immediate subordinates of the search base - * entry. - */ + /** The scope is constrained to the immediate subordinates of the search base entry. */ public static final SearchScope SINGLE_LEVEL = register(1, "one", Enum.SINGLE_LEVEL); - /** - * The scope is constrained to the search base entry and to all its - * subordinates. - */ + /** The scope is constrained to the search base entry and to all its subordinates. */ public static final SearchScope WHOLE_SUBTREE = register(2, "sub", Enum.WHOLE_SUBTREE); /** @@ -174,7 +155,6 @@ private SearchScope(final int intValue, final String name, Enum searchScopeEnum) this.searchScopeEnum = searchScopeEnum; } - /** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if (this == obj) { @@ -186,7 +166,6 @@ public boolean equals(final Object obj) { } } - /** {@inheritDoc} */ @Override public int hashCode() { return intValue; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java index 26c928b8c..a8eab85b4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ServerConnection.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java similarity index 64% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java index 2de690438..996b21638 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/ServerConnectionFactory.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SortKey.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SortKey.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/SortKey.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SortKey.java index dd7217e9e..30555eb62 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/SortKey.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/SortKey.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -80,6 +70,7 @@ private CompositeEntryComparator(final List> comparators) { this.comparators = comparators; } + @Override public int compare(final Entry entry1, final Entry entry2) { for (final Comparator comparator : comparators) { final int result = comparator.compare(entry1, entry2); @@ -111,6 +102,7 @@ private EntryComparator(final AttributeDescription attributeDescription, * 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); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java index 92b73d8d9..5f849187a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutChecker.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutEventListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutEventListener.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutEventListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutEventListener.java index 438e4e481..5832dcf15 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TimeoutEventListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutEventListener.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013-2014 ForgeRock AS. + * Copyright 2013-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java new file mode 100644 index 000000000..9163da7ed --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TimeoutResultException.java @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap; + +import org.forgerock.opendj.ldap.responses.Result; + +/** + * Thrown when the result code returned in a Result indicates that the Request + * was aborted because it did not complete in the required time out period. + */ +@SuppressWarnings("serial") +public class TimeoutResultException extends LdapException { + TimeoutResultException(final Result result) { + super(result); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java index fd8e290a6..658eecd54 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TreeMapEntry.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -69,6 +59,7 @@ public final class TreeMapEntry extends AbstractMapEntry { * 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); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java index a2e2a8319..91614eab3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/TrustManagers.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.io.File; @@ -48,9 +37,7 @@ 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 { /** @@ -68,21 +55,21 @@ private CheckHostName(final X509TrustManager trustManager, final String hostName 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(); } @@ -134,10 +121,7 @@ private void verifyHostName(final X509Certificate[] chain) { } } - /** - * 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; @@ -146,21 +130,21 @@ private CheckValidityDates(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(); } @@ -187,9 +171,7 @@ private void verifyExpiration(final X509Certificate[] chain) throws CertificateE } } - /** - * 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(); @@ -199,27 +181,25 @@ private 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. */ @@ -230,17 +210,17 @@ private TrustAll() { // 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]; } @@ -326,19 +306,8 @@ public static X509TrustManager checkUsingTrustStore(final String file, final cha final String trustStoreFormat = format != null ? format : KeyStore.getDefaultType(); final KeyStore keyStore = KeyStore.getInstance(trustStoreFormat); - - FileInputStream fos = null; - try { - fos = new FileInputStream(trustStoreFile); + try (FileInputStream fos = new FileInputStream(trustStoreFile)) { keyStore.load(fos, password); - } finally { - if (fos != null) { - try { - fos.close(); - } catch (final IOException ignored) { - // Ignore. - } - } } final TrustManagerFactory tmf = diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ADNotificationRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ADNotificationRequestControl.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ADNotificationRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ADNotificationRequestControl.java index 9f5a06d7e..c2c6ea366 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ADNotificationRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ADNotificationRequestControl.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013 ForgeRock AS + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -134,31 +125,26 @@ public static ADNotificationRequestControl newControl(final boolean isCritical) return new ADNotificationRequestControl(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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java index 4a2d62d18..18ccff8d7 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AssertionRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -77,18 +67,14 @@ * Directory Access Protocol (LDAP) Assertion Control */ 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 DECODER = new ControlDecoder() { + @Override public AssertionRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -119,6 +105,7 @@ public AssertionRequestControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -163,12 +150,12 @@ public Filter getFilter() { 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); @@ -181,17 +168,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java index bd1dd4d55..8dea2a9bd 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -70,9 +61,7 @@ * Directory Access Protocol (LDAP) "Who am I?" Operation */ 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; @@ -83,13 +72,11 @@ public final class AuthorizationIdentityRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public AuthorizationIdentityRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -112,6 +99,7 @@ public AuthorizationIdentityRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -136,27 +124,26 @@ private AuthorizationIdentityRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java index bb75f3889..5518a3fef 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/AuthorizationIdentityResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -77,9 +67,7 @@ */ 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"; /** @@ -101,13 +89,11 @@ public static AuthorizationIdentityResponseControl newControl(final String autho 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 DECODER = new ControlDecoder() { + @Override public AuthorizationIdentityResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -132,6 +118,7 @@ public AuthorizationIdentityResponseControl decodeControl(final Control control, return new AuthorizationIdentityResponseControl(control.isCritical(), authID); } + @Override public String getOID() { return OID; } @@ -157,27 +144,26 @@ public String getAuthorizationID() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/Control.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/Control.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/Control.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/Control.java index ea035f3c8..ae1c61369 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/Control.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/Control.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.controls; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java similarity index 56% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java index 04a85f348..692330aab 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ControlDecoder.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.controls; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java index e17b8642e..f9d45e4fb 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/EntryChangeNotificationResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -92,20 +82,15 @@ * - Persistent Search: A Simple LDAP Change Notification Mechanism */ public final class EntryChangeNotificationResponseControl implements Control { - private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); - /** - * The OID for the entry change notification response control. - */ + /** The OID for the entry change notification response control. */ public static final String OID = "2.16.840.1.113730.3.4.7"; - /** - * A decoder which can be used for decoding the entry change notification - * response control. - */ + /** A decoder which can be used for decoding the entry change notification response control. */ public static final ControlDecoder DECODER = new ControlDecoder() { + @Override public EntryChangeNotificationResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control, options); @@ -192,6 +177,7 @@ public EntryChangeNotificationResponseControl decodeControl(final Control contro changeType, previousDN, changeNumber); } + @Override public String getOID() { return OID; } @@ -289,7 +275,7 @@ public PersistentSearchChangeType getChangeType() { return changeType; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } @@ -305,7 +291,7 @@ public DN getPreviousName() { return previousName; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); final ASN1Writer writer = ASN1.getWriter(buffer); @@ -328,17 +314,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -356,5 +341,4 @@ public String toString() { builder.append(")"); return builder.toString(); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java index b2bf348e7..066e1550c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/GenericControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -127,27 +117,26 @@ private GenericControl(final String oid, final boolean isCritical, final ByteStr 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java index 184e5222a..43200e41d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/GetEffectiveRightsRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -101,20 +91,16 @@ * @see draft-ietf-ldapext-acl-model * - Access Control Model for LDAPv3 - **/ + */ public final class GetEffectiveRightsRequestControl implements Control { - /** - * The OID for the get effective rights request 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 DECODER = new ControlDecoder() { + @Override public GetEffectiveRightsRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -201,6 +187,7 @@ public GetEffectiveRightsRequestControl decodeControl(final Control control, } + @Override public String getOID() { return OID; } @@ -322,12 +309,12 @@ public DN getAuthorizationName() { 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); @@ -352,17 +339,16 @@ public ByteString getValue() { } } - /** {@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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java index 41b62dd92..d9966da01 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ManageDsaITRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -73,9 +64,7 @@ * Directories */ 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 = @@ -83,13 +72,11 @@ public final class ManageDsaITRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public ManageDsaITRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -113,6 +100,7 @@ public ManageDsaITRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -138,27 +126,26 @@ private ManageDsaITRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java index f2594c868..2e4556b61 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/MatchedValuesRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -98,9 +88,7 @@ * (LDAPv3) */ 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 { @@ -154,13 +142,11 @@ public LocalizedIllegalArgumentException visitUnrecognizedFilter(final Filter p, */ 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 DECODER = new ControlDecoder() { + @Override public MatchedValuesRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -214,6 +200,7 @@ public MatchedValuesRequestControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -321,12 +308,11 @@ public Collection getFilters() { return filters; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } - /** {@inheritDoc} */ @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); @@ -344,17 +330,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java index d4cfb6847..a19e0b72b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiredResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -69,9 +59,7 @@ * - Password Policy for LDAP Directories */ 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; @@ -81,13 +69,11 @@ public final class PasswordExpiredResponseControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public PasswordExpiredResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -115,6 +101,7 @@ public PasswordExpiredResponseControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -135,27 +122,26 @@ private PasswordExpiredResponseControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java similarity index 81% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java index c469da10e..d46cace1f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordExpiringResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -68,18 +58,14 @@ 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 DECODER = new ControlDecoder() { + @Override public PasswordExpiringResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -115,6 +101,7 @@ public PasswordExpiringResponseControl decodeControl(final Control control, secondsUntilExpiration); } + @Override public String getOID() { return OID; } @@ -144,7 +131,7 @@ private PasswordExpiringResponseControl(final boolean isCritical, this.secondsUntilExpiration = secondsUntilExpiration; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } @@ -160,22 +147,21 @@ public int getSecondsUntilExpiration() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java index acbeaf5fa..3a8b48bff 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyErrorType.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -37,15 +28,10 @@ * */ public enum PasswordPolicyErrorType { - - /** - * Indicates that the password has expired and must be reset. - */ + /** Indicates that the password has expired and must be reset. */ PASSWORD_EXPIRED(0, "passwordExpired"), - /** - * Indicates that the user's account has been locked. - */ + /** Indicates that the user's account has been locked. */ ACCOUNT_LOCKED(1, "accountLocked"), /** @@ -54,37 +40,22 @@ public enum PasswordPolicyErrorType { */ CHANGE_AFTER_RESET(2, "changeAfterReset"), - /** - * Indicates that a user is restricted from changing her password. - */ + /** Indicates that a user is restricted from changing her password. */ PASSWORD_MOD_NOT_ALLOWED(3, "passwordModNotAllowed"), - /** - * Indicates that the old password must be supplied in order to modify the - * password. - */ + /** Indicates that the old password must be supplied in order to modify the password. */ MUST_SUPPLY_OLD_PASSWORD(4, "mustSupplyOldPassword"), - /** - * Indicates that a password doesn't pass quality checking. - */ + /** Indicates that a password doesn't pass quality checking. */ INSUFFICIENT_PASSWORD_QUALITY(5, "insufficientPasswordQuality"), - /** - * Indicates that a password is not long enough. - */ + /** Indicates that a password is not long enough. */ PASSWORD_TOO_SHORT(6, "passwordTooShort"), - /** - * Indicates that the age of the password to be modified is not yet old - * enough. - */ + /** Indicates that the age of the password to be modified is not yet old enough. */ PASSWORD_TOO_YOUNG(7, "passwordTooYoung"), - /** - * Indicates that a password has already been used and the user must choose - * a different one. - */ + /** Indicates that a password has already been used and the user must choose a different one. */ PASSWORD_IN_HISTORY(8, "passwordInHistory"); private final int intValue; @@ -96,7 +67,6 @@ private PasswordPolicyErrorType(final int intValue, final String name) { this.name = name; } - /** {@inheritDoc} */ @Override public String toString() { return name; @@ -110,5 +80,4 @@ public String toString() { int intValue() { return intValue; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java index 5b10e7015..fa6c3dddf 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -86,10 +76,7 @@ * */ 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; @@ -99,13 +86,11 @@ public final class PasswordPolicyRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public PasswordPolicyRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -128,6 +113,7 @@ public PasswordPolicyRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -151,27 +137,26 @@ private PasswordPolicyRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java index be9cbe248..9351647cf 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -99,10 +89,7 @@ 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; @@ -111,13 +98,11 @@ public final class PasswordPolicyResponseControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public PasswordPolicyResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -191,6 +176,7 @@ public PasswordPolicyResponseControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -260,14 +246,10 @@ public static PasswordPolicyResponseControl newControl( 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, @@ -289,12 +271,12 @@ public PasswordPolicyErrorType getErrorType() { 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); @@ -339,17 +321,16 @@ public int getWarningValue() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java index 6cabb11a2..4f9d0303c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PasswordPolicyWarningType.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -40,9 +31,7 @@ * */ public enum PasswordPolicyWarningType { - /** - * Indicates the number of seconds before a password will expire. - */ + /** Indicates the number of seconds before a password will expire. */ TIME_BEFORE_EXPIRATION(0, "timeBeforeExpiration"), /** @@ -60,7 +49,6 @@ private PasswordPolicyWarningType(final int intValue, final String name) { this.name = name; } - /** {@inheritDoc} */ @Override public String toString() { return name; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java index 25e45cf6b..a8fdc912a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PermissiveModifyRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -70,9 +61,7 @@ * */ 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 = @@ -81,13 +70,11 @@ public final class PermissiveModifyRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public PermissiveModifyRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -111,6 +98,7 @@ public PermissiveModifyRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -136,27 +124,26 @@ private PermissiveModifyRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java similarity index 56% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java index 800ac0d9f..8e75f7c10 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchChangeType.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -38,27 +28,13 @@ * - Persistent Search: A Simple LDAP Change Notification Mechanism */ public enum PersistentSearchChangeType { - /** - * Indicates that an Add operation triggered the entry change notification. - */ + /** Indicates that an Add operation triggered the entry change notification. */ ADD(1, "add"), - - /** - * Indicates that an Delete operation triggered the entry change - * notification. - */ + /** Indicates that an Delete operation triggered the entry change notification. */ DELETE(2, "delete"), - - /** - * Indicates that an Modify operation triggered the entry change - * notification. - */ + /** Indicates that an Modify operation triggered the entry change notification. */ MODIFY(4, "modify"), - - /** - * Indicates that an Modify DN operation triggered the entry change - * notification. - */ + /** Indicates that an Modify DN operation triggered the entry change notification. */ MODIFY_DN(8, "modifyDN"); private final String name; @@ -69,7 +45,6 @@ private PersistentSearchChangeType(final int intValue, final String name) { this.intValue = intValue; } - /** {@inheritDoc} */ @Override public String toString() { return name; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java index 4f51e3569..e0fe8eb16 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PersistentSearchRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -98,18 +88,14 @@ 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 DECODER = new ControlDecoder() { + @Override public PersistentSearchRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -180,6 +166,7 @@ public PersistentSearchRequestControl decodeControl(final Control control, returnECs, Collections.unmodifiableSet(changeTypeSet)); } + @Override public String getOID() { return OID; } @@ -289,12 +276,12 @@ public Set getChangeTypes() { 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); @@ -317,7 +304,7 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } @@ -337,7 +324,7 @@ public boolean isChangesOnly() { return changesOnly; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } @@ -354,7 +341,6 @@ public boolean isReturnECs() { return returnECs; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java index 7d16df052..6bb6a7ac7 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -98,12 +88,11 @@ public final class PostReadRequestControl implements Control { private static final PostReadRequestControl NONCRITICAL_EMPTY_INSTANCE = new PostReadRequestControl(false, Collections. 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 DECODER = new ControlDecoder() { + @Override public PostReadRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -160,6 +149,7 @@ public PostReadRequestControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -244,12 +234,12 @@ public List getAttributes() { 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); @@ -268,17 +258,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java index 817b6d729..92e6cad36 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PostReadResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -84,12 +74,11 @@ public final class PostReadResponseControl implements Control { */ 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 DECODER = new ControlDecoder() { + @Override public PostReadResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -131,6 +120,7 @@ public PostReadResponseControl decodeControl(final Control control, .unmodifiableEntry(entry)); } + @Override public String getOID() { return OID; } @@ -178,12 +168,12 @@ public Entry getEntry() { return entry; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { try { final ByteStringBuilder buffer = new ByteStringBuilder(); @@ -195,17 +185,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java index feccc062b..01ebac84b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -99,12 +89,11 @@ public final class PreReadRequestControl implements Control { private static final PreReadRequestControl NONCRITICAL_EMPTY_INSTANCE = new PreReadRequestControl(false, Collections. 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 DECODER = new ControlDecoder() { + @Override public PreReadRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -161,6 +150,7 @@ public PreReadRequestControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -245,12 +235,12 @@ public List getAttributes() { 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); @@ -269,17 +259,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java index 3b474007d..1b4b77f89 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/PreReadResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -83,12 +73,11 @@ public final class PreReadResponseControl implements Control { */ 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 DECODER = new ControlDecoder() { + @Override public PreReadResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -130,6 +119,7 @@ public PreReadResponseControl decodeControl(final Control control, .unmodifiableEntry(entry)); } + @Override public String getOID() { return OID; } @@ -177,12 +167,12 @@ public Entry getEntry() { return entry; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { try { final ByteStringBuilder buffer = new ByteStringBuilder(); @@ -194,17 +184,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java index 04b0d77bf..3395a6c8d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV1RequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -65,18 +55,14 @@ 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 DECODER = new ControlDecoder() { + @Override public ProxiedAuthV1RequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -131,6 +117,7 @@ public ProxiedAuthV1RequestControl decodeControl(final Control control, return new ProxiedAuthV1RequestControl(authorizationDN); } + @Override public String getOID() { return OID; } @@ -188,12 +175,12 @@ public DN getAuthorizationDNName() { 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); @@ -208,17 +195,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return true; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder buffer = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java index 82025f9a8..8ac94a3f0 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ProxiedAuthV2RequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -78,21 +68,17 @@ 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 DECODER = new ControlDecoder() { + @Override public ProxiedAuthV2RequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -152,6 +138,7 @@ public ProxiedAuthV2RequestControl decodeControl(final Control control, return new ProxiedAuthV2RequestControl(authorizationID); } + @Override public String getOID() { return OID; } @@ -209,27 +196,26 @@ public String getAuthorizationID() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java index 66539db54..134bc63ef 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -89,28 +79,20 @@ * Extension for Server Side Sorting of Search Results */ 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 DECODER = new ControlDecoder() { + @Override public ServerSideSortRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -171,6 +153,7 @@ public ServerSideSortRequestControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -268,7 +251,7 @@ private ServerSideSortRequestControl(final boolean isCritical, final List getSortKeys() { return sortKeys; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); final ASN1Writer writer = ASN1.getWriter(buffer); @@ -314,17 +297,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder buffer = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java index 5cd825e3e..2b7f41227 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/ServerSideSortResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -82,18 +72,14 @@ * Extension for Server Side Sorting of Search Results */ 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 DECODER = new ControlDecoder() { + @Override public ServerSideSortResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control, options); @@ -140,14 +126,13 @@ public ServerSideSortResponseControl decodeControl(final Control control, } } + @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; /** @@ -258,7 +243,7 @@ public AttributeDescription getAttributeDescription() { return attributeDescription; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } @@ -278,7 +263,7 @@ public ResultCode getResult() { return result; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); final ASN1Writer writer = ASN1.getWriter(buffer); @@ -296,17 +281,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java index 4a105ceab..e79b58ad0 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SimplePagedResultsControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -134,19 +124,14 @@ 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 DECODER = new ControlDecoder() { + @Override public SimplePagedResultsControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -198,6 +183,7 @@ public SimplePagedResultsControl decodeControl(final Control control, return new SimplePagedResultsControl(control.isCritical(), size, cookie); } + @Override public String getOID() { return OID; } @@ -240,9 +226,7 @@ public static SimplePagedResultsControl newControl(final boolean isCritical, fin */ private final int size; - /** - * The control value cookie element. - */ + /** The control value cookie element. */ private final ByteString cookie; private final boolean isCritical; @@ -269,7 +253,7 @@ public ByteString getCookie() { return cookie; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } @@ -288,7 +272,7 @@ public int getSize() { return size; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); final ASN1Writer writer = ASN1.getWriter(buffer); @@ -304,17 +288,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java index d45ce3d61..2e7535840 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SubentriesRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -94,9 +84,7 @@ 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 = @@ -108,12 +96,11 @@ public final class SubentriesRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public SubentriesRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -148,6 +135,7 @@ public SubentriesRequestControl decodeControl(final Control control, return newControl(control.isCritical(), visibility); } + @Override public String getOID() { return OID; } @@ -184,12 +172,12 @@ private SubentriesRequestControl(final boolean isCritical, final boolean visibil 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); @@ -214,17 +202,16 @@ public boolean getVisibility() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java similarity index 77% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java index 6db2cdf61..ccf9bc3ee 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/SubtreeDeleteRequestControl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -55,9 +46,7 @@ * - Tree Delete Control */ 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 = @@ -66,13 +55,11 @@ public final class SubtreeDeleteRequestControl implements Control { 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 DECODER = new ControlDecoder() { + @Override public SubtreeDeleteRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -96,6 +83,7 @@ public SubtreeDeleteRequestControl decodeControl(final Control control, return control.isCritical() ? CRITICAL_INSTANCE : NONCRITICAL_INSTANCE; } + @Override public String getOID() { return OID; } @@ -121,27 +109,26 @@ private SubtreeDeleteRequestControl(final boolean isCritical) { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java index fd9993dfd..334a945bf 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewRequestControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -130,18 +120,14 @@ * Browsing of Search Results */ 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 DECODER = new ControlDecoder() { + @Override public VirtualListViewRequestControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -204,19 +190,16 @@ public VirtualListViewRequestControl decodeControl(final Control 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; /** @@ -417,12 +400,12 @@ public int getOffset() { 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); @@ -460,17 +443,16 @@ public boolean hasTargetOffset() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java index 418dc398f..908b5825f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/VirtualListViewResponseControl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.controls; @@ -127,18 +117,14 @@ * Browsing of Search Results */ 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 DECODER = new ControlDecoder() { + @Override public VirtualListViewResponseControl decodeControl(final Control control, final DecodeOptions options) throws DecodeException { Reject.ifNull(control); @@ -180,6 +166,7 @@ public VirtualListViewResponseControl decodeControl(final Control control, } } + @Override public String getOID() { return OID; } @@ -256,7 +243,7 @@ public ByteString getContextID() { return contextID; } - /** {@inheritDoc} */ + @Override public String getOID() { return OID; } @@ -281,7 +268,7 @@ public int getTargetPosition() { return targetPosition; } - /** {@inheritDoc} */ + @Override public ByteString getValue() { final ByteStringBuilder buffer = new ByteStringBuilder(); final ASN1Writer writer = ASN1.getWriter(buffer); @@ -301,17 +288,16 @@ public ByteString getValue() { } } - /** {@inheritDoc} */ + @Override public boolean hasValue() { return true; } - /** {@inheritDoc} */ + @Override public boolean isCritical() { return isCritical; } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java new file mode 100644 index 000000000..8537df79b --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/controls/package-info.java @@ -0,0 +1,21 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009-2010 Sun Microsystems, Inc. + */ + +/** + * Classes and interfaces for common LDAP controls. + */ +package org.forgerock.opendj.ldap.controls; + diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/package-info.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/package-info.java new file mode 100644 index 000000000..b2139bd8a --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/package-info.java @@ -0,0 +1,22 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009-2010 Sun Microsystems, Inc. + */ + +/** + * Classes and interfaces for core types including connections, entries, and + * attributes. + */ +package org.forgerock.opendj.ldap; + diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java index a6a95cd88..351c4fce9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java similarity index 54% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java index 6d36b64a0..5f10671fd 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbandonRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java new file mode 100644 index 000000000..89c11e750 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractBindRequest.java @@ -0,0 +1,46 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * An abstract Bind request which can be used as the basis for implementing new + * authentication methods. + * + * @param + * The type of Bind request. + */ +abstract class AbstractBindRequest extends AbstractRequestImpl implements + BindRequest { + + AbstractBindRequest() { + // Nothing to do. + } + + AbstractBindRequest(final BindRequest bindRequest) { + super(bindRequest); + } + + @Override + public abstract String getName(); + + @Override + @SuppressWarnings("unchecked") + final R getThis() { + return (R) this; + } + +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java index 3515ecb67..474c9cbc2 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractExtendedRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java index b61d568c4..084bc4902 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java new file mode 100644 index 000000000..f3a2e3b65 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractSASLBindRequest.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +import org.forgerock.opendj.io.LDAP; + +/** + * An abstract SASL Bind request which can be used as the basis for implementing + * new SASL authentication methods. + * + * @param + * The type of SASL Bind request. + */ +abstract class AbstractSASLBindRequest extends AbstractBindRequest + implements SASLBindRequest { + + AbstractSASLBindRequest() { + + } + + AbstractSASLBindRequest(final SASLBindRequest saslBindRequest) { + super(saslBindRequest); + } + + @Override + public final byte getAuthenticationType() { + return LDAP.TYPE_AUTHENTICATION_SASL; + } + + @Override + public final String getName() { + return "".intern(); + } + +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java new file mode 100644 index 000000000..1edbf4f76 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableBindRequest.java @@ -0,0 +1,50 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +import org.forgerock.opendj.ldap.LdapException; + +/** + * An abstract unmodifiable Bind request which can be used as the basis for + * implementing new unmodifiable authentication methods. + * + * @param + * The type of Bind request. + */ +abstract class AbstractUnmodifiableBindRequest extends + AbstractUnmodifiableRequest implements BindRequest { + + AbstractUnmodifiableBindRequest(final R impl) { + super(impl); + } + + @Override + public BindClient createBindClient(final String serverName) throws LdapException { + return impl.createBindClient(serverName); + } + + @Override + public byte getAuthenticationType() { + return impl.getAuthenticationType(); + } + + @Override + public String getName() { + return impl.getName(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java similarity index 56% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java index 49d62162f..09e971e9f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableExtendedRequest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java index 0e1196a64..c744b82b9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -72,24 +62,24 @@ public final C getControl(final ControlDecoder decoder, final List controls = impl.getControls(); final Control control = AbstractRequestImpl.getControl(controls, decoder.getOID()); - if (control != null) { - // Got a match. Return a defensive copy only if necessary. - final C decodedControl = decoder.decodeControl(control, options); - if (decodedControl != control) { - // This was not the original control so return it - // immediately. - return decodedControl; - } else if (decodedControl instanceof GenericControl) { - // Generic controls are immutable, so return it immediately. - return decodedControl; - } else { - // Re-decode to get defensive copy. - final GenericControl genericControl = GenericControl.newControl(control); - return decoder.decodeControl(genericControl, options); - } - } else { + if (control == null) { return null; } + + // Got a match. Return a defensive copy only if necessary. + final C decodedControl = decoder.decodeControl(control, options); + if (decodedControl != control) { + // This was not the original control so return it + // immediately. + return decodedControl; + } else if (decodedControl instanceof GenericControl) { + // Generic controls are immutable, so return it immediately. + return decodedControl; + } else { + // Re-decode to get defensive copy. + final GenericControl genericControl = GenericControl.newControl(control); + return decoder.decodeControl(genericControl, options); + } } @Override diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java new file mode 100644 index 000000000..3f31bfb96 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AbstractUnmodifiableSASLBindRequest.java @@ -0,0 +1,37 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * An abstract unmodifiable SASL Bind request which can be used as the basis for + * implementing new unmodifiable SASL authentication methods. + * + * @param + * The type of SASL Bind request. + */ +abstract class AbstractUnmodifiableSASLBindRequest extends + AbstractUnmodifiableBindRequest implements SASLBindRequest { + + AbstractUnmodifiableSASLBindRequest(final R impl) { + super(impl); + } + + @Override + public String getSASLMechanism() { + return impl.getSASLMechanism(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java index fe20a8135..e7d5b65fd 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java index 252c785d3..9660f2121 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AddRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java similarity index 79% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java index f1a40eca7..bda1bd65e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java index 92611055a..5f858acd4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestImpl.java @@ -1,34 +1,22 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.requests; import org.forgerock.opendj.ldap.ByteString; - import org.forgerock.util.Reject; /** @@ -37,8 +25,7 @@ final class AnonymousSASLBindRequestImpl extends AbstractSASLBindRequest implements AnonymousSASLBindRequest { private static final class Client extends SASLBindClientImpl { - private Client(final AnonymousSASLBindRequestImpl initialBindRequest, - final String serverName) { + private Client(final AnonymousSASLBindRequestImpl initialBindRequest) { super(initialBindRequest); setNextSASLCredentials(ByteString.valueOfUtf8(initialBindRequest.getTraceString())); } @@ -58,7 +45,7 @@ private Client(final AnonymousSASLBindRequestImpl initialBindRequest, @Override public BindClient createBindClient(final String serverName) { - return new Client(this, serverName); + return new Client(this); } @Override diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java index b0ddf0298..fcd203b05 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClient.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java index 8f7311e11..ba4a06bf1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindClientImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java index 9f312ab2b..31a1c1788 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java index 6bbe19828..62b07d2f3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java index 75ff8d116..568c7955f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java index cb05081d0..769da6b2b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java index e1888323b..8ead8b6b7 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java index 38a8d450e..7b70cfb8c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java index 4184780e7..5d268333d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/CompareRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java index 3c994e544..08ff694a3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java index 8db62eb86..094df33cc 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DeleteRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java index a067cda48..94f481477 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java index 078a4d279..5ad1118f6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java index 32ab2fd05..a3cdeaff1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java index 353359239..8b48411be 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExtendedRequestDecoder.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java similarity index 81% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java index 91b6e9875..635865457 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java similarity index 81% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java index b23acf401..af07105c8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java index 935db60aa..58df4174e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java index e00a61c8f..0b5e05745 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java similarity index 81% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java index d4d4ffd42..c59441358 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java similarity index 77% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java index 8b095915d..52e553ac2 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java index fc27b2924..32d79d0de 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java similarity index 83% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java index 9fbd601c1..635ed9e42 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java index 08346539c..c206ca851 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java index 1cebae285..351c9d59d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java index 768cf3219..8066f9136 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java index 9ef22c29f..37c55e367 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/ModifyRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java index 71b135a74..d0c6b969d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java index f8e72f873..692ed5759 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java index 76c045f5e..bf9549272 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java index 72aa2887f..2c8bcb2b5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Request.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/Request.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Request.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/Request.java index 908720f92..2004689d0 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Request.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/Request.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java similarity index 98% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java index 67191e4bd..0963615d4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/Requests.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java index 366081dab..a82efcfca 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindClientImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java index 2df1e79e6..8bb67dba0 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SASLBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java index 810209345..6bef41d94 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java index 1c46b1017..e59d452fe 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SearchRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java index 86da42a6e..50dbd4ff1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java index 3c2d14d6f..483513c3b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java similarity index 87% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java index 2dd3b88b6..8de4d22a3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java index 56c38ad94..c0ea5bb6c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java new file mode 100644 index 000000000..0fcab4fe2 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequest.java @@ -0,0 +1,41 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +import java.util.List; + +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; + +/** + * The Unbind operation allows a client to terminate an LDAP session. + */ +public interface UnbindRequest extends Request { + + @Override + UnbindRequest addControl(Control control); + + @Override + C getControl(ControlDecoder decoder, DecodeOptions options) + throws DecodeException; + + @Override + List getControls(); +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java new file mode 100644 index 000000000..3bd33373f --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnbindRequestImpl.java @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * Unbind request implementation. + */ +final class UnbindRequestImpl extends AbstractRequestImpl implements UnbindRequest { + + UnbindRequestImpl() { + // Do nothing. + } + + UnbindRequestImpl(final UnbindRequest unbindRequest) { + super(unbindRequest); + } + + @Override + public String toString() { + final StringBuilder builder = new StringBuilder(); + builder.append("UnbindRequest(controls="); + builder.append(getControls()); + builder.append(")"); + return builder.toString(); + } + + @Override + UnbindRequest getThis() { + return this; + } + +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java new file mode 100644 index 000000000..c1265b7ab --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAbandonRequestImpl.java @@ -0,0 +1,37 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * Unmodifiable abandon request implementation. + */ +final class UnmodifiableAbandonRequestImpl extends AbstractUnmodifiableRequest + implements AbandonRequest { + UnmodifiableAbandonRequestImpl(final AbandonRequest request) { + super(request); + } + + @Override + public int getRequestID() { + return impl.getRequestID(); + } + + @Override + public AbandonRequest setRequestID(final int id) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java index a38d5441a..cc98f18a1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAddRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java new file mode 100644 index 000000000..1d9df297d --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableAnonymousSASLBindRequestImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * Unmodifiable anonymous SASL bind request implementation. + */ +final class UnmodifiableAnonymousSASLBindRequestImpl extends + AbstractUnmodifiableSASLBindRequest implements + AnonymousSASLBindRequest { + UnmodifiableAnonymousSASLBindRequestImpl(final AnonymousSASLBindRequest impl) { + super(impl); + } + + @Override + public String getTraceString() { + return impl.getTraceString(); + } + + @Override + public AnonymousSASLBindRequest setTraceString(final String traceString) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java similarity index 55% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java index f82cc7d5c..863f6eb71 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCRAMMD5SASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java new file mode 100644 index 000000000..d83e43ac7 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCancelExtendedRequestImpl.java @@ -0,0 +1,41 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +import org.forgerock.opendj.ldap.responses.ExtendedResult; + +/** + * Unmodifiable cancel extended request implementation. + */ +final class UnmodifiableCancelExtendedRequestImpl extends + AbstractUnmodifiableExtendedRequest implements + CancelExtendedRequest { + UnmodifiableCancelExtendedRequestImpl(final CancelExtendedRequest impl) { + super(impl); + } + + @Override + public int getRequestID() { + return impl.getRequestID(); + } + + @Override + public CancelExtendedRequest setRequestID(final int id) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java similarity index 63% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java index e6190e4e3..c897005f6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableCompareRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java new file mode 100644 index 000000000..d67f45db6 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDeleteRequestImpl.java @@ -0,0 +1,51 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +import org.forgerock.opendj.ldap.DN; +import org.forgerock.opendj.ldif.ChangeRecordVisitor; + +/** + * Unmodifiable delete request implementation. + */ +final class UnmodifiableDeleteRequestImpl extends AbstractUnmodifiableRequest + implements DeleteRequest { + UnmodifiableDeleteRequestImpl(final DeleteRequest impl) { + super(impl); + } + + @Override + public R accept(final ChangeRecordVisitor v, final P p) { + return v.visitChangeRecord(p, this); + } + + @Override + public DN getName() { + return impl.getName(); + } + + @Override + public DeleteRequest setName(final DN dn) { + throw new UnsupportedOperationException(); + } + + @Override + public DeleteRequest setName(final String dn) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java similarity index 77% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java index 4081f4bff..dcf7c4718 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableDigestMD5SASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java new file mode 100644 index 000000000..2e70fcc76 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableExternalSASLBindRequestImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * Unmodifiable external SASL bind request implementation. + */ +final class UnmodifiableExternalSASLBindRequestImpl extends + AbstractUnmodifiableSASLBindRequest implements + ExternalSASLBindRequest { + UnmodifiableExternalSASLBindRequestImpl(final ExternalSASLBindRequest impl) { + super(impl); + } + + @Override + public String getAuthorizationID() { + return impl.getAuthorizationID(); + } + + @Override + public ExternalSASLBindRequest setAuthorizationID(final String authorizationID) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java index e116f55d0..59f12cc0d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGSSAPISASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java similarity index 51% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java index 142a43823..4cde72bce 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java new file mode 100644 index 000000000..9d91b68c9 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableGenericExtendedRequestImpl.java @@ -0,0 +1,41 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.requests; + +import org.forgerock.opendj.ldap.responses.GenericExtendedResult; + +/** + * Unmodifiable generic extended request implementation. + */ +final class UnmodifiableGenericExtendedRequestImpl extends + AbstractUnmodifiableExtendedRequest + implements GenericExtendedRequest { + UnmodifiableGenericExtendedRequestImpl(final GenericExtendedRequest impl) { + super(impl); + } + + @Override + public GenericExtendedRequest setOID(final String oid) { + throw new UnsupportedOperationException(); + } + + @Override + public GenericExtendedRequest setValue(final Object value) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java index 7b591696f..93934d616 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyDNRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java index 4fe18881a..e49031e2a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableModifyRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java index 6e6e9888c..c8bd634bb 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePasswordModifyExtendedRequestImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java index ed525992d..25a19df6f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiablePlainSASLBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java index fd3bd76b5..a2b2d7855 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSearchRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java index bcbbf13b3..f577bb40f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableSimpleBindRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2012 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java similarity index 65% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java index 77f86c0c6..85762a204 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableStartTLSExtendedRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java new file mode 100644 index 000000000..c82efc02f --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableUnbindRequestImpl.java @@ -0,0 +1,27 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.requests; + +/** + * Unmodifiable unbind request implementation. + */ +final class UnmodifiableUnbindRequestImpl extends AbstractUnmodifiableRequest + implements UnbindRequest { + UnmodifiableUnbindRequestImpl(final UnbindRequest impl) { + super(impl); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java new file mode 100644 index 000000000..3c8383cc7 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/UnmodifiableWhoAmIExtendedRequestImpl.java @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.requests; + +import org.forgerock.opendj.ldap.responses.WhoAmIExtendedResult; + +/** + * Unmodifiable Who Am I extended request implementation. + */ +final class UnmodifiableWhoAmIExtendedRequestImpl extends + AbstractUnmodifiableExtendedRequest implements + WhoAmIExtendedRequest { + UnmodifiableWhoAmIExtendedRequestImpl(final WhoAmIExtendedRequest impl) { + super(impl); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java index a7af9dcfe..f1ad75c8d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java index b748d7b98..3d284c4be 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java new file mode 100644 index 000000000..437be6fb0 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/requests/package-info.java @@ -0,0 +1,21 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ + +/** + * Classes and interfaces for core LDAP requests. + */ +package org.forgerock.opendj.ldap.requests; + diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java similarity index 71% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java index d0b481ac2..9583f82be 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java index 958fb4356..63152ffe5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractExtendedResultDecoder.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java index 793bd0599..b6d301060 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractIntermediateResponse.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java index 59a235ba9..ba4dd507b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResponseImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java similarity index 74% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java index 1e8911def..ddcd8cf92 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java new file mode 100644 index 000000000..ed6521ac1 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableExtendedResultImpl.java @@ -0,0 +1,48 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.responses; + +import org.forgerock.opendj.ldap.ByteString; + +/** + * An abstract unmodifiable Extended result which can be used as the basis for + * implementing new unmodifiable Extended operations. + * + * @param + * The type of Extended result. + */ +abstract class AbstractUnmodifiableExtendedResultImpl extends + AbstractUnmodifiableResultImpl implements ExtendedResult { + AbstractUnmodifiableExtendedResultImpl(final S impl) { + super(impl); + } + + @Override + public String getOID() { + return impl.getOID(); + } + + @Override + public ByteString getValue() { + return impl.getValue(); + } + + @Override + public boolean hasValue() { + return impl.hasValue(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java new file mode 100644 index 000000000..adc952065 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableIntermediateResponseImpl.java @@ -0,0 +1,48 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.responses; + +import org.forgerock.opendj.ldap.ByteString; + +/** + * An abstract unmodifiable Intermediate response which can be used as the basis + * for implementing new unmodifiable Intermediate responses. + * + * @param + * The type of Intermediate response. + */ +abstract class AbstractUnmodifiableIntermediateResponseImpl extends + AbstractUnmodifiableResponseImpl implements IntermediateResponse { + AbstractUnmodifiableIntermediateResponseImpl(final S impl) { + super(impl); + } + + @Override + public String getOID() { + return impl.getOID(); + } + + @Override + public ByteString getValue() { + return impl.getValue(); + } + + @Override + public boolean hasValue() { + return impl.hasValue(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java index 1b6df59e5..e97fe0a3d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResponseImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java index c1c4ec8c6..c9936c6fc 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/AbstractUnmodifiableResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java similarity index 79% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java index f53a66a58..ded8f50c4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java index 477ddacb3..cc9ea6cc4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/BindResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java index d1d109ba2..2dabbac2b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java similarity index 57% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java index 81da66da4..d5e795ab1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/CompareResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java index 340914f74..b00580331 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java similarity index 81% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java index 92b18c7e6..a7a141197 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ExtendedResultDecoder.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java index 559749b56..e2ae9be0a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java index 917433e19..dc1402c11 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericExtendedResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java index d0804b21e..8948aa4d1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponse.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java index 1fe6f3e51..a68769dc2 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/GenericIntermediateResponseImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java index 952d4afad..2d5aa79b7 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/IntermediateResponse.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java index 630ea11b7..f1116f3d6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java index 100d973b4..930b77e4e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/PasswordModifyExtendedResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Response.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Response.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Response.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Response.java index e2632dfe3..17370461c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Response.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Response.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java index cf3e7a200..9659828dd 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Responses.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Result.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Result.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Result.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Result.java index 63ca3a5de..2fe9875da 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/Result.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/Result.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java similarity index 53% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java index 34035b7a6..4f97d9687 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/ResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java index cc176edb3..919aa2445 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntry.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java index 97d1fa1ec..549502291 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultEntryImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java similarity index 63% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java index e27acab50..5dbc89f1a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReference.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java similarity index 58% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java index 29e7b6af6..387b63cc5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/SearchResultReferenceImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java new file mode 100644 index 000000000..9065af3d0 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableBindResultImpl.java @@ -0,0 +1,45 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +import org.forgerock.opendj.ldap.ByteString; + +/** + * Unmodifiable Bind result implementation. + */ +class UnmodifiableBindResultImpl extends AbstractUnmodifiableResultImpl implements + BindResult { + UnmodifiableBindResultImpl(final BindResult impl) { + super(impl); + } + + @Override + public ByteString getServerSASLCredentials() { + return impl.getServerSASLCredentials(); + } + + @Override + public boolean isSASLBindInProgress() { + return impl.isSASLBindInProgress(); + } + + @Override + public BindResult setServerSASLCredentials(final ByteString credentials) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java new file mode 100644 index 000000000..f90a8625a --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableCompareResultImpl.java @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.responses; + +/** + * Unmodifiable Compare result implementation. + */ +class UnmodifiableCompareResultImpl extends AbstractUnmodifiableResultImpl implements + CompareResult { + UnmodifiableCompareResultImpl(final CompareResult impl) { + super(impl); + } + + @Override + public boolean matched() { + return impl.matched(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java new file mode 100644 index 000000000..3fa20f8ed --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericExtendedResultImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +/** + * Unmodifiable Generic extended result implementation. + */ +class UnmodifiableGenericExtendedResultImpl extends + AbstractUnmodifiableExtendedResultImpl implements ExtendedResult, + GenericExtendedResult { + UnmodifiableGenericExtendedResultImpl(final GenericExtendedResult impl) { + super(impl); + } + + @Override + public GenericExtendedResult setOID(final String oid) { + throw new UnsupportedOperationException(); + } + + @Override + public GenericExtendedResult setValue(final Object value) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java new file mode 100644 index 000000000..08b82fd6d --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableGenericIntermediateResponseImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +/** + * Unmodifiable Generic extended result implementation. + */ +class UnmodifiableGenericIntermediateResponseImpl extends + AbstractUnmodifiableIntermediateResponseImpl implements + GenericIntermediateResponse { + UnmodifiableGenericIntermediateResponseImpl(final GenericIntermediateResponse impl) { + super(impl); + } + + @Override + public GenericIntermediateResponse setOID(final String oid) { + throw new UnsupportedOperationException(); + } + + @Override + public GenericIntermediateResponse setValue(final Object value) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java new file mode 100644 index 000000000..35cacaab0 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiablePasswordModifyExtendedResultImpl.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +/** + * Unmodifiable Password modify extended result implementation. + */ +class UnmodifiablePasswordModifyExtendedResultImpl extends + AbstractUnmodifiableExtendedResultImpl implements + PasswordModifyExtendedResult { + UnmodifiablePasswordModifyExtendedResultImpl(final PasswordModifyExtendedResult impl) { + super(impl); + } + + @Override + public byte[] getGeneratedPassword() { + return impl.getGeneratedPassword(); + } + + @Override + public PasswordModifyExtendedResult setGeneratedPassword(final byte[] password) { + throw new UnsupportedOperationException(); + } + + @Override + public PasswordModifyExtendedResult setGeneratedPassword(final char[] password) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java new file mode 100644 index 000000000..0f6e50f38 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableResultImpl.java @@ -0,0 +1,26 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.responses; + +/** + * A unmodifiable generic result indicates the final status of an operation. + */ +class UnmodifiableResultImpl extends AbstractUnmodifiableResultImpl implements Result { + UnmodifiableResultImpl(final Result impl) { + super(impl); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java index 6d9c15a52..ef7e8fb76 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultEntryImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java new file mode 100644 index 000000000..dd330db26 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableSearchResultReferenceImpl.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +import java.util.List; + +/** + * Unmodifiable Search result reference implementation. + */ +class UnmodifiableSearchResultReferenceImpl extends + AbstractUnmodifiableResponseImpl implements SearchResultReference { + UnmodifiableSearchResultReferenceImpl(final SearchResultReference impl) { + super(impl); + } + + @Override + public SearchResultReference addURI(final String uri) { + throw new UnsupportedOperationException(); + } + + @Override + public List getURIs() { + return impl.getURIs(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java new file mode 100644 index 000000000..a9c9a7f7d --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/UnmodifiableWhoAmIExtendedResultImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +/** + * Unmodifiable Who Am I extended result implementation. + */ +class UnmodifiableWhoAmIExtendedResultImpl extends + AbstractUnmodifiableExtendedResultImpl implements + WhoAmIExtendedResult { + UnmodifiableWhoAmIExtendedResultImpl(final WhoAmIExtendedResult impl) { + super(impl); + } + + @Override + public String getAuthorizationID() { + return impl.getAuthorizationID(); + } + + @Override + public WhoAmIExtendedResult setAuthorizationID(final String authorizationID) { + throw new UnsupportedOperationException(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java similarity index 82% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java index 758e83aa6..1787f7d51 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResult.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java similarity index 73% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java index 80508e13e..4f7b1847e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/WhoAmIExtendedResultImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.responses; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java new file mode 100644 index 000000000..171eaf0b1 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/responses/package-info.java @@ -0,0 +1,21 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ + +/** + * Classes and interfaces for core LDAP responses. + */ +package org.forgerock.opendj.ldap.responses; + diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java similarity index 55% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java index 057d32179..66d90a039 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractApproximateMatchingRuleImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -39,7 +29,6 @@ * values in byte order. */ abstract class AbstractApproximateMatchingRuleImpl extends AbstractMatchingRuleImpl { - private final Indexer indexer; AbstractApproximateMatchingRuleImpl(String indexID) { @@ -52,7 +41,6 @@ public final Assertion getAssertion(final Schema schema, final ByteSequence asse return named(indexer.getIndexID(), normalizeAttributeValue(schema, assertionValue)); } - /** {@inheritDoc} */ @Override public final Collection createIndexers(IndexingOptions options) { return Collections.singleton(indexer); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java similarity index 57% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java index a521bf688..2fe8af9d6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractEqualityMatchingRuleImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -52,7 +42,6 @@ public Assertion getAssertion(final Schema schema, final ByteSequence assertionV return defaultAssertion(normalizeAttributeValue(schema, assertionValue)); } - /** {@inheritDoc} */ @Override public Collection createIndexers(IndexingOptions options) { return Collections.singleton(indexer); @@ -61,5 +50,4 @@ public Collection createIndexers(IndexingOptions options) { Assertion defaultAssertion(final ByteSequence normalizedAssertionValue) { return named(indexer.getIndexID(), normalizedAssertionValue); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java similarity index 74% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java index f001f9210..7313783c6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractMatchingRuleImpl.java @@ -1,31 +1,23 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; +import static org.forgerock.opendj.ldap.Assertion.*; + import java.util.Collection; import java.util.List; @@ -37,9 +29,6 @@ import org.forgerock.opendj.ldap.spi.IndexQueryFactory; import org.forgerock.opendj.ldap.spi.Indexer; -import static org.forgerock.opendj.ldap.Assertion.*; -import static com.forgerock.opendj.util.StaticUtils.*; - /** * This class implements a default equality or approximate matching rule that * matches normalized values in byte order. @@ -51,7 +40,7 @@ static DefaultAssertion named(final String indexID, final ByteSequence normalize } private static final class DefaultAssertion implements Assertion { - /** The ID of the DB index to use with this assertion.*/ + /** The ID of the DB index to use with this assertion. */ private final String indexID; private final ByteSequence normalizedAssertionValue; @@ -72,7 +61,7 @@ public T createIndexQuery(IndexQueryFactory factory) throws DecodeExcepti } final class DefaultIndexer implements Indexer { - /** The ID of the DB index to use with this indexer.*/ + /** The ID of the DB index to use with this indexer. */ private final String indexID; DefaultIndexer(String indexID) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java similarity index 77% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java index d3ef2bcdc..96db48dc3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractOrderingMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -54,7 +44,6 @@ abstract class AbstractOrderingMatchingRuleImpl extends AbstractMatchingRuleImpl this.indexer = new DefaultIndexer(indexId); } - /** {@inheritDoc} */ @Override public final Assertion getAssertion(final Schema schema, final ByteSequence value) throws DecodeException { @@ -73,7 +62,6 @@ public T createIndexQuery(IndexQueryFactory factory) throws DecodeExcepti }; } - /** {@inheritDoc} */ @Override public final Assertion getGreaterOrEqualAssertion(final Schema schema, final ByteSequence value) throws DecodeException { @@ -92,7 +80,6 @@ public T createIndexQuery(IndexQueryFactory factory) throws DecodeExcepti }; } - /** {@inheritDoc} */ @Override public final Assertion getLessOrEqualAssertion(final Schema schema, final ByteSequence value) throws DecodeException { @@ -111,10 +98,8 @@ public T createIndexQuery(IndexQueryFactory factory) throws DecodeExcepti }; } - /** {@inheritDoc} */ @Override public final Collection createIndexers(IndexingOptions options) { return Collections.singleton(indexer); } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java index a9a3e453b..83b0c42e8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -195,12 +185,13 @@ private T rangeMatch(IndexQueryFactory factory, String indexID, ByteSeque private void substringMatch(final IndexQueryFactory factory, final ByteString normSubstring, final Collection subqueries) { - int substrLength = factory.getIndexingOptions().substringKeySize(); + final int substrLength = factory.getIndexingOptions().substringKeySize(); + final String indexId = substringIndexId + ":" + substrLength; // There are two cases, depending on whether the user-provided // substring is smaller than the configured index substring length or not. if (normSubstring.length() < substrLength) { - subqueries.add(rangeMatch(factory, substringIndexId, normSubstring)); + subqueries.add(rangeMatch(factory, indexId, normSubstring)); } else { // Break the value up into fragments of length equal to the // index substring length, and read those keys. @@ -216,7 +207,7 @@ private void substringMatch(final IndexQueryFactory factory, final ByteSt } for (ByteSequence key : substringKeys) { - subqueries.add(factory.createExactMatchQuery(substringIndexId, key)); + subqueries.add(factory.createExactMatchQuery(indexId, key)); } } } diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java new file mode 100644 index 000000000..aeb49ec21 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxImpl.java @@ -0,0 +1,53 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.schema; + +/** + * This class defines the set of methods and structures that must be implemented + * to define a new attribute syntax. + */ +abstract class AbstractSyntaxImpl implements SyntaxImpl { + AbstractSyntaxImpl() { + // 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; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java index 12adfd289..601cc5298 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeType.java @@ -1,35 +1,25 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import static java.util.Arrays.*; import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; +import static org.forgerock.opendj.ldap.schema.SchemaOptions.ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX; import static org.forgerock.opendj.ldap.schema.SchemaUtils.*; import static com.forgerock.opendj.ldap.CoreMessages.*; @@ -108,7 +98,7 @@ public static final class Builder extends SchemaElementBuilder { * numeric OID. */ public SchemaBuilder addToSchema() { - return getSchemaBuilder().addAttributeType(new AttributeType(this), false); + return addToSchema(false); } /** @@ -118,7 +108,11 @@ public SchemaBuilder addToSchema() { * @return The parent schema builder. */ public SchemaBuilder addToSchemaOverwrite() { - return getSchemaBuilder().addAttributeType(new AttributeType(this), true); + return addToSchema(true); + } + + SchemaBuilder addToSchema(final boolean overwrite) { + return getSchemaBuilder().addAttributeType(new AttributeType(this), overwrite); } /** @@ -423,8 +417,11 @@ public Builder usage(AttributeUsage attributeUsage) { private AttributeType(Builder builder) { super(builder); Reject.ifTrue(builder.oid == null || builder.oid.isEmpty(), "An OID must be specified."); - Reject.ifTrue(builder.superiorTypeOID == null && builder.syntaxOID == null, - "Superior type and/or Syntax must not be null"); + + if (builder.superiorTypeOID == null && builder.syntaxOID == null + && !builder.getSchemaBuilder().getOptions().get(ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX)) { + throw new IllegalArgumentException("Superior type and/or Syntax must not be null"); + } oid = builder.oid; names = unmodifiableCopyOfList(builder.names); @@ -450,12 +447,14 @@ private AttributeType(Builder builder) { * attribute will be the normalized attribute type name followed by the * suffix "-oid". * - * @param schema - * The parent schema. * @param name * The name of the place-holder attribute type. + * @param syntax + * The syntax of the place-holder attribute type. + * @param equalityMatchingRule + * The equality matching rule of the place-holder attribute type. */ - AttributeType(final Schema schema, final String name) { + AttributeType(final String name, final Syntax syntax, final MatchingRule equalityMatchingRule) { final StringBuilder builder = new StringBuilder(name.length() + 4); StaticUtils.toLowerCase(name, builder); builder.append("-oid"); @@ -465,12 +464,12 @@ private AttributeType(Builder builder) { this.isObsolete = false; this.superiorTypeOID = null; this.superiorType = null; - this.equalityMatchingRule = schema.getDefaultMatchingRule(); + this.equalityMatchingRule = equalityMatchingRule; this.equalityMatchingRuleOID = equalityMatchingRule.getOID(); this.orderingMatchingRuleOID = null; this.substringMatchingRuleOID = null; this.approximateMatchingRuleOID = null; - this.syntax = schema.getDefaultSyntax(); + this.syntax = syntax; this.syntaxOID = syntax.getOID(); this.isSingleValue = false; this.isCollective = false; @@ -500,6 +499,7 @@ private AttributeType(Builder builder) { * @throws NullPointerException * If {@code name} was {@code null}. */ + @Override public int compareTo(final AttributeType type) { if (isObjectClassType) { return type.isObjectClassType ? 0 : -1; @@ -985,6 +985,8 @@ boolean validate(final Schema schema, final List invalidSchemaEle } else if (getSuperiorType() != null && getSuperiorType().getSyntax() != null) { // Try to inherit the syntax from the superior type if possible syntax = getSuperiorType().getSyntax(); + } else { + syntax = schema.getDefaultSyntax(); } if (equalityMatchingRuleOID != null) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java index 450ca44eb..75bd65ca1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java index e19f28047..f37319868 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AttributeUsage.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java similarity index 57% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java index 04b118708..1e61b4d75 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordExactEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java index 0d3683f2f..b24e5a8b9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java new file mode 100644 index 000000000..aff428a34 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BinarySyntaxImpl.java @@ -0,0 +1,58 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BINARY_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class defines the binary attribute syntax, which is essentially a byte + * array using very strict matching. Equality, ordering, and substring matching + * will be allowed by default. + */ +final class BinarySyntaxImpl extends AbstractSyntaxImpl { + @Override + public String getEqualityMatchingRule() { + return EMR_OCTET_STRING_OID; + } + + @Override + public String getName() { + return SYNTAX_BINARY_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_OCTET_STRING_OID; + } + + @Override + public boolean isHumanReadable() { + return false; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // All values will be acceptable for the binary syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java index cb18e0c46..48861b0d1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java similarity index 60% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java index 25449230d..887ecf6e9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -46,28 +37,17 @@ public String getEqualityMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { final String valueString = value.toString().toUpperCase(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java similarity index 58% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java index dfa15d746..529727622 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java new file mode 100644 index 000000000..c8feaaa77 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxImpl.java @@ -0,0 +1,65 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.schema; + +import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_BOOLEAN_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BOOLEAN_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class defines the Boolean attribute syntax, which only allows values of + * "TRUE" or "FALSE" (although this implementation is more flexible and will + * also allow "YES", "ON", or "1" instead of "TRUE", or "NO", "OFF", or "0" + * instead of "FALSE"). Only equality matching is allowed by default for this + * syntax. + */ +final class BooleanSyntaxImpl extends AbstractSyntaxImpl { + @Override + public String getEqualityMatchingRule() { + return EMR_BOOLEAN_OID; + } + + @Override + public String getName() { + return SYNTAX_BOOLEAN_NAME; + } + + @Override + public boolean isHumanReadable() { + return true; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + final String valueString = value.toString(); + final String valueUpperCase = valueString.toUpperCase(); + + if (!"TRUE".equals(valueUpperCase) && !"YES".equals(valueUpperCase) + && !"ON".equals(valueUpperCase) && !"1".equals(valueUpperCase) + && !"FALSE".equals(valueUpperCase) && !"NO".equals(valueUpperCase) + && !"OFF".equals(valueUpperCase) && !"0".equals(valueUpperCase)) { + invalidReason.append(WARN_ATTR_SYNTAX_ILLEGAL_BOOLEAN.get(valueString)); + return false; + } + return true; + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java new file mode 100644 index 000000000..bc8237056 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleImpl.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +import static com.forgerock.opendj.util.StringPrepProfile.*; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +/** + * This class defines the caseExactMatch matching rule defined in X.520 and + * referenced in RFC 4519. + */ +final class CaseExactEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { + + CaseExactEqualityMatchingRuleImpl() { + super(EMR_CASE_EXACT_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeStringAttributeValue(value, TRIM, NO_CASE_FOLD); + } + + @Override + public String keyToHumanReadableString(ByteSequence key) { + return key.toString(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java index edce186ce..7f31eae58 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java similarity index 59% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java index 16ae03e9f..71b7de50c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java new file mode 100644 index 000000000..abd6eceac --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleImpl.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +import static com.forgerock.opendj.util.StringPrepProfile.*; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +/** + * This class defines the caseExactOrderingMatch matching rule defined in X.520 + * and referenced in RFC 4519. + */ +final class CaseExactOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { + + public CaseExactOrderingMatchingRuleImpl() { + // Reusing equality index since OPENDJ-1864 + super(EMR_CASE_EXACT_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeStringAttributeValue(value, TRIM, NO_CASE_FOLD); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java similarity index 55% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java index e8b691098..af43f461e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java new file mode 100644 index 000000000..d085ce9a5 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleImpl.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static com.forgerock.opendj.util.StringPrepProfile.*; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This class defines the caseIgnoreMatch matching rule defined in X.520 and + * referenced in RFC 2252. + */ +final class CaseIgnoreEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { + + CaseIgnoreEqualityMatchingRuleImpl() { + super(EMR_CASE_IGNORE_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeStringAttributeValue(value, TRIM, CASE_FOLD); + } + + @Override + public String keyToHumanReadableString(ByteSequence key) { + return key.toString(); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java index b6a4a1d4a..ba31a8a65 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java similarity index 56% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java index bb0402407..39d4a7ceb 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java new file mode 100644 index 000000000..ec65dd2bb --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListEqualityMatchingRuleImpl.java @@ -0,0 +1,41 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static com.forgerock.opendj.util.StringPrepProfile.CASE_FOLD; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +import static com.forgerock.opendj.util.StringPrepProfile.*; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +/** + * This class implements the caseIgnoreListMatch matching rule defined in X.520 + * and referenced in RFC 2252. + */ +final class CaseIgnoreListEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { + + CaseIgnoreListEqualityMatchingRuleImpl() { + super(EMR_CASE_IGNORE_LIST_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeStringListAttributeValue(value, TRIM, CASE_FOLD); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java similarity index 58% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java index 4c95a6757..56d2a7d99 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreListSubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java new file mode 100644 index 000000000..1a30f0371 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleImpl.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +import static com.forgerock.opendj.util.StringPrepProfile.*; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +/** + * This class defines the caseIgnoreOrderingMatch matching rule defined in X.520 + * and referenced in RFC 2252. + */ +final class CaseIgnoreOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { + + public CaseIgnoreOrderingMatchingRuleImpl() { + // Reusing equality index since OPENDJ-1864 + super(EMR_CASE_IGNORE_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeStringAttributeValue(value, TRIM, CASE_FOLD); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java similarity index 55% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java index 547403549..3bc1a5fee 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactAssertionSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactAssertionSyntaxImpl.java new file mode 100644 index 000000000..dff39108a --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactAssertionSyntaxImpl.java @@ -0,0 +1,53 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 Manuel Gaupp + * Portions Copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTIFICATE_EXACT_ASSERTION_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class defines the Certificate Exact Assertion attribute syntax, which + * contains components for matching X.509 certificates. + */ +final class CertificateExactAssertionSyntaxImpl extends AbstractSyntaxImpl { + + @Override + public String getName() { + return SYNTAX_CERTIFICATE_EXACT_ASSERTION_NAME; + } + + @Override + public boolean isBEREncodingRequired() { + return false; + } + + @Override + public boolean isHumanReadable() { + return true; + } + + @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 + // within assertions. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImpl.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImpl.java index e9c05c671..c81a94b8e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImpl.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions Copyright 2013-2014 Manuel Gaupp - * Copyright 2014-2015 ForgeRock AS + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions Copyright 2013-2014 Manuel Gaupp + * Copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java new file mode 100644 index 000000000..bae480edb --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateListSyntaxImpl.java @@ -0,0 +1,65 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTLIST_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the certificate list attribute syntax. This should be + * restricted to holding only X.509 certificate lists, but we will accept any + * set of bytes. It will be treated much like the octet string attribute syntax. + */ +final class CertificateListSyntaxImpl extends AbstractSyntaxImpl { + + @Override + public String getEqualityMatchingRule() { + return EMR_OCTET_STRING_OID; + } + + @Override + public String getName() { + return SYNTAX_CERTLIST_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_OCTET_STRING_OID; + } + + @Override + public boolean isBEREncodingRequired() { + return true; + } + + @Override + public boolean isHumanReadable() { + return false; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // All values will be acceptable for the certificate list syntax. + return true; + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java new file mode 100644 index 000000000..4f2cfc83a --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificatePairSyntaxImpl.java @@ -0,0 +1,64 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_CERTPAIR_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the certificate pair attribute syntax. This should be + * restricted to holding only X.509 certificate pairs, but we will accept any + * set of bytes. It will be treated much like the octet string attribute syntax. + */ +final class CertificatePairSyntaxImpl extends AbstractSyntaxImpl { + @Override + public String getEqualityMatchingRule() { + return EMR_OCTET_STRING_OID; + } + + @Override + public String getName() { + return SYNTAX_CERTPAIR_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_OCTET_STRING_OID; + } + + @Override + public boolean isBEREncodingRequired() { + return true; + } + + @Override + public boolean isHumanReadable() { + return false; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // All values will be acceptable for the certificate pair syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java index ec1ea87ba..abb5aaf63 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxImpl.java @@ -1,30 +1,20 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 Manuel Gaupp + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import java.io.IOException; @@ -48,44 +38,36 @@ import org.forgerock.opendj.ldap.ByteSequence; import org.forgerock.opendj.ldap.DecodeException; - - /** * This class implements the certificate attribute syntax. It is restricted to * accept only X.509 certificates. */ final class CertificateSyntaxImpl extends AbstractSyntaxImpl { - /** {@inheritDoc} */ @Override public String getEqualityMatchingRule() { return EMR_CERTIFICATE_EXACT_OID; } - /** {@inheritDoc} */ @Override public String getName() { return SYNTAX_CERTIFICATE_NAME; } - /** {@inheritDoc} */ @Override public String getOrderingMatchingRule() { return OMR_OCTET_STRING_OID; } - /** {@inheritDoc} */ @Override public boolean isBEREncodingRequired() { return true; } - /** {@inheritDoc} */ @Override public boolean isHumanReadable() { return false; } - /** {@inheritDoc} */ @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CollationMatchingRulesImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CollationMatchingRulesImpl.java similarity index 87% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CollationMatchingRulesImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CollationMatchingRulesImpl.java index e01bf687d..83daaf5c6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CollationMatchingRulesImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CollationMatchingRulesImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -54,7 +44,6 @@ * ordering rules) and a substring one (for substring rule). */ final class CollationMatchingRulesImpl { - private static final String INDEX_ID_SHARED = "shared"; private static final String INDEX_ID_SUBSTRING = "substring"; @@ -128,9 +117,7 @@ static MatchingRuleImpl collationGreaterThanOrEqualToMatchingRule(Locale locale) return new CollationGreaterThanOrEqualToMatchingRuleImpl(locale); } - /** - * Defines the base for collation matching rules. - */ + /** Defines the base for collation matching rules. */ private static abstract class AbstractCollationMatchingRuleImpl extends AbstractMatchingRuleImpl { private final Locale locale; final Collator collator; @@ -182,13 +169,11 @@ String getPrefixIndexName() { return builder.toString(); } - /** {@inheritDoc} */ @Override public Collection createIndexers(IndexingOptions options) { return Collections.singletonList(indexer); } - /** {@inheritDoc} */ @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { @@ -202,11 +187,8 @@ public ByteString normalizeAttributeValue(final Schema schema, final ByteSequenc } } - /** - * Defines the collation equality matching rule. - */ + /** Defines the collation equality matching rule. */ private static final class CollationEqualityMatchingRuleImpl extends AbstractCollationMatchingRuleImpl { - /** * Creates the matching rule with the provided locale. * @@ -222,14 +204,10 @@ public Assertion getAssertion(final Schema schema, final ByteSequence assertionV throws DecodeException { return named(indexName, normalizeAttributeValue(schema, assertionValue)); } - } - /** - * Defines the collation substring matching rule. - */ + /** Defines the collation substring matching rule. */ private static final class CollationSubstringMatchingRuleImpl extends AbstractCollationMatchingRuleImpl { - private final AbstractSubstringMatchingRuleImpl substringMatchingRule; /** @@ -255,14 +233,12 @@ public Assertion getAssertion(final Schema schema, final ByteSequence assertionV return substringMatchingRule.getAssertion(schema, assertionValue); } - /** {@inheritDoc} */ @Override public Assertion getSubstringAssertion(Schema schema, ByteSequence subInitial, List subAnyElements, ByteSequence subFinal) throws DecodeException { return substringMatchingRule.getSubstringAssertion(schema, subInitial, subAnyElements, subFinal); } - /** {@inheritDoc} */ @Override public final Collection createIndexers(IndexingOptions options) { final Collection indexers = new ArrayList<>(substringMatchingRule.createIndexers(options)); @@ -271,11 +247,8 @@ public final Collection createIndexers(IndexingOptions option } } - /** - * Defines the collation ordering matching rule. - */ + /** Defines the collation ordering matching rule. */ private static abstract class CollationOrderingMatchingRuleImpl extends AbstractCollationMatchingRuleImpl { - final AbstractOrderingMatchingRuleImpl orderingMatchingRule; /** @@ -296,48 +269,36 @@ public ByteString normalizeAttributeValue(Schema schema, ByteSequence value) thr } } - /** - * Defines the collation less than matching rule. - */ + /** Defines the collation less than matching rule. */ private static final class CollationLessThanMatchingRuleImpl extends CollationOrderingMatchingRuleImpl { - CollationLessThanMatchingRuleImpl(Locale locale) { super(locale); } - /** {@inheritDoc} */ @Override public Assertion getAssertion(Schema schema, ByteSequence assertionValue) throws DecodeException { return orderingMatchingRule.getAssertion(schema, assertionValue); } } - /** - * Defines the collation less than or equal matching rule. - */ + /** Defines the collation less than or equal matching rule. */ private static final class CollationLessThanOrEqualToMatchingRuleImpl extends CollationOrderingMatchingRuleImpl { - CollationLessThanOrEqualToMatchingRuleImpl(Locale locale) { super(locale); } - /** {@inheritDoc} */ @Override public Assertion getAssertion(Schema schema, ByteSequence assertionValue) throws DecodeException { return orderingMatchingRule.getLessOrEqualAssertion(schema, assertionValue); } } - /** - * Defines the collation greater than matching rule. - */ + /** Defines the collation greater than matching rule. */ private static final class CollationGreaterThanMatchingRuleImpl extends CollationOrderingMatchingRuleImpl { - CollationGreaterThanMatchingRuleImpl(Locale locale) { super(locale); } - /** {@inheritDoc} */ @Override public Assertion getAssertion(Schema schema, ByteSequence assertionValue) throws DecodeException { @@ -357,17 +318,13 @@ public T createIndexQuery(IndexQueryFactory factory) throws DecodeExcepti } } - /** - * Defines the collation greater than or equal matching rule. - */ + /** Defines the collation greater than or equal matching rule. */ private static final class CollationGreaterThanOrEqualToMatchingRuleImpl extends CollationOrderingMatchingRuleImpl { - CollationGreaterThanOrEqualToMatchingRuleImpl(Locale locale) { super(locale); } - /** {@inheritDoc} */ @Override public Assertion getAssertion(Schema schema, ByteSequence assertionValue) throws DecodeException { return orderingMatchingRule.getGreaterOrEqualAssertion(schema, assertionValue); diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java new file mode 100644 index 000000000..a26ca4c47 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ConflictingSchemaElementException.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.schema; + +import org.forgerock.i18n.LocalizableMessage; +import org.forgerock.i18n.LocalizedIllegalArgumentException; + +/** + * Thrown when addition of a schema element to a schema builder fails because + * the OID of the schema element conflicts with an existing schema element and + * the caller explicitly requested not to override existing schema elements. + */ +@SuppressWarnings("serial") +public class ConflictingSchemaElementException extends LocalizedIllegalArgumentException { + /** + * Creates a new conflicting schema element exception with the provided + * message. + * + * @param message + * The message that explains the problem that occurred. + */ + public ConflictingSchemaElementException(final LocalizableMessage message) { + super(message); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java similarity index 98% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java index 276a290c6..663cf3e1c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchema.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java similarity index 98% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java index 7389cbff7..01fb4c25e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaImpl.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. - * Portions copyright 2014 Manuel Gaupp + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2013-2015 ForgeRock AS. + * Portions copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaSupportedLocales.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaSupportedLocales.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaSupportedLocales.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaSupportedLocales.java index f1d91fb52..f71a3cf4c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaSupportedLocales.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CoreSchemaSupportedLocales.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java similarity index 57% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java index db458f878..9900d4594 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxImpl.java @@ -1,28 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2012 Manuel Gaupp + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2012 Manuel Gaupp + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -52,6 +43,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_COUNTRY_STRING_NAME; } @@ -66,24 +58,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { final String stringValue = value.toString(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java similarity index 95% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java index 7f088344d..131a386b9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRule.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -103,6 +93,18 @@ public SchemaBuilder addToSchemaOverwrite() { return getSchemaBuilder().addDITContentRule(new DITContentRule(this), true); } + /** + * Adds this DIT content rule to the schema, overwriting any existing DIT content rule + * with the same numeric OID if the overwrite parameter is set to {@code true}. + * + * @param overwrite + * {@code true} if any DIT content rule with the same OID should be overwritten. + * @return The parent schema builder. + */ + SchemaBuilder addToSchema(final boolean overwrite) { + return overwrite ? addToSchemaOverwrite() : addToSchema(); + } + /** * Adds the provided auxiliary classes to the list of auxiliary object * classes that entries subject to this DIT content rule may belong to. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java index 4288c966c..f13923e3d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -53,15 +43,17 @@ public String getEqualityMatchingRule() { 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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java index 8ee8a8409..6c0ccaf8c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRule.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -98,6 +88,18 @@ public SchemaBuilder addToSchemaOverwrite() { return getSchemaBuilder().addDITStructureRule(new DITStructureRule(this), true); } + /** + * Adds this DIT structure rule to the schema, overwriting any existing DIT structure rule + * with the same numeric OID if the overwrite parameter is set to {@code true}. + * + * @param overwrite + * {@code true} if any DIT structure rule with the same OID should be overwritten. + * @return The parent schema builder. + */ + SchemaBuilder addToSchema(final boolean overwrite) { + return overwrite ? addToSchemaOverwrite() : addToSchema(); + } + @Override public Builder description(final String description) { return description0(description); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java index fbde43486..2473bcd2a 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DITStructureRuleSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DelayedSchema.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DelayedSchema.java new file mode 100644 index 000000000..9fb213c4e --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DelayedSchema.java @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2011-2014 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.schema; + +/** + * This class is used to maintain a reference to the global schemas and avoids + * having to reference the core schema in the {@link Schema} class since this + * can cause initialization errors because the CoreSchema depends on Schema. + */ +final class DelayedSchema { + static final Schema EMPTY_SCHEMA = new SchemaBuilder("Empty Schema").toSchema().asNonStrictSchema(); + static volatile Schema defaultSchema = Schema.getCoreSchema(); + + private DelayedSchema() { + // Prevent instantiation. + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java similarity index 66% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java index 0216bed53..f92318467 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DeliveryMethodSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -84,6 +74,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_DELIVERY_METHOD_NAME; } @@ -98,24 +89,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { final String stringValue = toLowerCase(value.toString()); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java index d099db52b..5343fce0c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -59,6 +49,7 @@ public Assertion getAssertion(final Schema schema, final ByteSequence assertionV SchemaUtils.normalizeStringAttributeValue(assertionValue, TRIM, CASE_FOLD)); } + @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { final String definition = value.toString(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java similarity index 52% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java index d3182080a..e27e7f93c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DirectoryStringSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -51,6 +41,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_DIRECTORY_STRING_NAME; } @@ -65,24 +56,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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)) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java similarity index 55% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java index 16c6b1985..3bd59732e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -44,7 +34,7 @@ final class DistinguishedNameEqualityMatchingRuleImpl extends AbstractEqualityMa super(EMR_DN_NAME); } - /** {@inheritDoc} */ + @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { try { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java similarity index 62% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java index a162d4223..9d6409fa1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DistinguishedNameSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -46,6 +37,7 @@ public String getEqualityMatchingRule() { return EMR_DN_OID; } + @Override public String getName() { return SYNTAX_DN_NAME; } @@ -55,10 +47,12 @@ public String getSubstringMatchingRule() { 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 { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java index 9b23da5df..0478e5e18 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/DoubleMetaphoneApproximateMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -59,7 +49,7 @@ final class DoubleMetaphoneApproximateMatchingRuleImpl extends AbstractApproxima 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java index d873a9818..3837d16f8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnhancedGuideSyntaxImpl.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import static com.forgerock.opendj.util.StaticUtils.toLowerCase; @@ -68,20 +57,6 @@ 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java similarity index 58% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java index c70d332a3..05aca0d77 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumOrderingMatchingRule.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java index 6ae8f95b8..ab7807a55 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/EnumSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -43,7 +33,6 @@ import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.opendj.ldap.ByteSequence; import org.forgerock.opendj.ldap.ByteString; -import org.forgerock.util.Reject; /** * This class provides an enumeration-based mechanism where a new syntax and its @@ -56,7 +45,6 @@ final class EnumSyntaxImpl extends AbstractSyntaxImpl { private final List entries; EnumSyntaxImpl(final String oid, final List entries) { - Reject.ifNull(oid, entries); this.oid = oid; final List entryStrings = new ArrayList<>(entries.size()); @@ -79,6 +67,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return oid; } @@ -97,10 +86,12 @@ public int indexOf(final ByteSequence value) { 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. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java index ed8ba66e3..09689b1fc 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/FacsimileNumberSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -79,6 +69,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_FAXNUMBER_NAME; } @@ -93,24 +84,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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 diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java new file mode 100644 index 000000000..21db7827d --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/FaxSyntaxImpl.java @@ -0,0 +1,60 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_FAX_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the fax attribute syntax. This should be restricted to + * holding only fax message contents, but we will accept any set of bytes. It + * will be treated much like the octet string attribute syntax. + */ +final class FaxSyntaxImpl extends AbstractSyntaxImpl { + + @Override + public String getEqualityMatchingRule() { + return EMR_OCTET_STRING_OID; + } + + @Override + public String getName() { + return SYNTAX_FAX_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_OCTET_STRING_OID; + } + + @Override + public boolean isHumanReadable() { + return false; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // All values will be acceptable for the fax syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java similarity index 64% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java index d7dce93ee..12b98c847 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -44,6 +34,7 @@ final class GeneralizedTimeEqualityMatchingRuleImpl extends AbstractEqualityMatc super(EMR_GENERALIZED_TIME_NAME); } + @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { return normalizeAttributeValue(value); } diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java new file mode 100644 index 000000000..39e8c1dc9 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleImpl.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; +import org.forgerock.opendj.ldap.DecodeException; + +/** + * This class defines the generalizedTimeOrderingMatch matching rule defined in + * X.520 and referenced in RFC 2252. + */ +final class GeneralizedTimeOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { + + GeneralizedTimeOrderingMatchingRuleImpl() { + // Reusing equality index since OPENDJ-1864 + super(EMR_GENERALIZED_TIME_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { + return GeneralizedTimeEqualityMatchingRuleImpl.normalizeAttributeValue(value); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java similarity index 53% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java index 0ba5d70b1..90865bd3b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -49,6 +39,7 @@ public String getEqualityMatchingRule() { return EMR_GENERALIZED_TIME_OID; } + @Override public String getName() { return SYNTAX_GENERALIZED_TIME_NAME; } @@ -63,24 +54,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { try { diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java new file mode 100644 index 000000000..d074f3bd7 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GenerateCoreSchema.java @@ -0,0 +1,328 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 Manuel Gaupp + * Portions Copyright 2015 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.schema; + +import java.io.PrintStream; +import java.util.Arrays; +import java.util.Calendar; +import java.util.HashSet; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * Tool for generating CoreSchema.java. + */ +final class GenerateCoreSchema { + private static final Set ABBREVIATIONS = new HashSet<>(Arrays.asList("SASL", + "LDAP", "DN", "DIT", "RDN", "JPEG", "OID", "UUID", "IA5", "UID", "UTC", "X500", "X121", + "C", "CN", "O", "OU", "L", "DC", "ISDN", "SN", "ST")); + + /** + * Tool for generating CoreSchema.java. + * + * @param args + * The command line arguments (none required). + */ + public static void main(final String[] args) { + testSplitNameIntoWords(); + + final Schema schema = Schema.getCoreSchema(); + + final SortedMap syntaxes = new TreeMap<>(); + for (final Syntax syntax : schema.getSyntaxes()) { + if (isOpenDSOID(syntax.getOID())) { + continue; + } + + final String name = syntax.getDescription().replaceAll(" Syntax$", ""); + final String fieldName = name.replace(" ", "_").replaceAll("[.-]", "") + .toUpperCase(Locale.ENGLISH).concat("_SYNTAX"); + syntaxes.put(fieldName, syntax); + } + + final SortedMap matchingRules = new TreeMap<>(); + for (final MatchingRule matchingRule : schema.getMatchingRules()) { + if (isOpenDSOID(matchingRule.getOID()) || isCollationMatchingRule(matchingRule.getOID())) { + continue; + } + + final String name = matchingRule.getNameOrOID().replaceAll("Match$", ""); + final String fieldName = splitNameIntoWords(name).concat("_MATCHING_RULE"); + matchingRules.put(fieldName, matchingRule); + } + + final SortedMap attributeTypes = new TreeMap<>(); + for (final AttributeType attributeType : schema.getAttributeTypes()) { + if (isOpenDSOID(attributeType.getOID())) { + continue; + } + final String name = attributeType.getNameOrOID(); + final String fieldName = splitNameIntoWords(name).concat("_ATTRIBUTE_TYPE"); + attributeTypes.put(fieldName, attributeType); + } + + final SortedMap objectClasses = new TreeMap<>(); + for (final ObjectClass objectClass : schema.getObjectClasses()) { + if (isOpenDSOID(objectClass.getOID())) { + continue; + } + final String name = objectClass.getNameOrOID(); + final String fieldName = splitNameIntoWords(name.replace("-", "")).concat("_OBJECT_CLASS"); + + objectClasses.put(fieldName, objectClass); + } + + final PrintStream out = System.out; + out.println("/*"); + out.println(" * The contents of this file are subject to the terms of the Common Development and"); + out.println(" * Distribution License (the License). You may not use this file except in compliance with the"); + out.println(" * License."); + out.println(" *"); + out.println(" * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the"); + out.println(" * specific language governing permission and limitations under the License."); + out.println(" *"); + out.println(" * When distributing Covered Software, include this CDDL Header Notice in each file and include"); + out.println(" * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL"); + out.println(" * Header, with the fields enclosed by brackets [] replaced by your own identifying"); + out.println(" * information: \"Portions Copyright [year] [name of copyright owner]\"."); + out.println(" *"); + out.println(" * Copyright 2009 Sun Microsystems, Inc."); + out.println(" * Portions copyright 2014-" + Calendar.getInstance().get(Calendar.YEAR) + " ForgeRock AS."); + out.println(" */"); + out.println("package org.forgerock.opendj.ldap.schema;"); + out.println(); + out.println(); + out.println("// DON'T EDIT THIS FILE!"); + out.println("// It is automatically generated using GenerateCoreSchema class."); + out.println(); + out.println("/**"); + out.println(" * The OpenDJ SDK core schema contains standard LDAP " + + "RFC schema elements. These include:"); + out.println(" *

    "); + out.println(" *

    "); + out.println(" * The core schema is non-strict: attempts to retrieve"); + out.println(" * non-existent Attribute Types will return a temporary"); + out.println(" * Attribute Type having the Octet String syntax."); + out.println(" */"); + out.println("public final class CoreSchema {"); + + out.println(" // Core Syntaxes"); + for (final Map.Entry syntax : syntaxes.entrySet()) { + out.println(" private static final Syntax " + syntax.getKey() + " ="); + out.println(" CoreSchemaImpl.getInstance().getSyntax(\"" + + syntax.getValue().getOID() + "\");"); + } + + out.println(); + out.println(" // Core Matching Rules"); + for (final Map.Entry matchingRule : matchingRules.entrySet()) { + out.println(" private static final MatchingRule " + matchingRule.getKey() + + " ="); + out.println(" CoreSchemaImpl.getInstance().getMatchingRule(\"" + + matchingRule.getValue().getOID() + "\");"); + } + + out.println(); + out.println(" // Core Attribute Types"); + for (final Map.Entry attributeType : attributeTypes.entrySet()) { + out.println(" private static final AttributeType " + attributeType.getKey() + + " ="); + out.println(" CoreSchemaImpl.getInstance().getAttributeType(\"" + + attributeType.getValue().getOID() + "\");"); + } + + out.println(); + out.println(" // Core Object Classes"); + for (final Map.Entry objectClass : objectClasses.entrySet()) { + out.println(" private static final ObjectClass " + objectClass.getKey() + " ="); + out.println(" CoreSchemaImpl.getInstance().getObjectClass(\"" + + objectClass.getValue().getOID() + "\");"); + } + + out.println(); + out.println(" // Prevent instantiation"); + out.println(" private CoreSchema() {"); + out.println(" // Nothing to do."); + out.println(" }"); + + out.println(); + out.println(" /**"); + out.println(" * Returns a reference to the singleton core schema."); + out.println(" *"); + out.println(" * @return The core schema."); + out.println(" */"); + out.println(" public static Schema getInstance() {"); + out.println(" return CoreSchemaImpl.getInstance();"); + out.println(" }"); + + for (final Map.Entry syntax : syntaxes.entrySet()) { + out.println(); + + final String description = + toCodeJavaDoc(syntax.getValue().getDescription().replaceAll(" Syntax$", "") + + " Syntax"); + out.println(" /**"); + out.println(" * Returns a reference to the " + description); + out.println(" * which has the OID " + + toCodeJavaDoc(syntax.getValue().getOID()) + "."); + out.println(" *"); + out.println(" * @return A reference to the " + description + "."); + + out.println(" */"); + out.println(" public static Syntax get" + toJavaName(syntax.getKey()) + "() {"); + out.println(" return " + syntax.getKey() + ";"); + out.println(" }"); + } + + for (final Map.Entry matchingRule : matchingRules.entrySet()) { + out.println(); + + final String description = toCodeJavaDoc(matchingRule.getValue().getNameOrOID()); + out.println(" /**"); + out.println(" * Returns a reference to the " + description + " Matching Rule"); + out.println(" * which has the OID " + + toCodeJavaDoc(matchingRule.getValue().getOID()) + "."); + out.println(" *"); + out.println(" * @return A reference to the " + description + " Matching Rule."); + + out.println(" */"); + out.println(" public static MatchingRule get" + toJavaName(matchingRule.getKey()) + "() {"); + out.println(" return " + matchingRule.getKey() + ";"); + out.println(" }"); + } + + for (final Map.Entry attributeType : attributeTypes.entrySet()) { + out.println(); + + final String description = toCodeJavaDoc(attributeType.getValue().getNameOrOID()); + out.println(" /**"); + out.println(" * Returns a reference to the " + description + " Attribute Type"); + out.println(" * which has the OID " + + toCodeJavaDoc(attributeType.getValue().getOID()) + "."); + out.println(" *"); + out.println(" * @return A reference to the " + description + " Attribute Type."); + + out.println(" */"); + out.println(" public static AttributeType get" + + toJavaName(attributeType.getKey()) + "() {"); + out.println(" return " + attributeType.getKey() + ";"); + out.println(" }"); + } + + for (final Map.Entry objectClass : objectClasses.entrySet()) { + out.println(); + + final String description = toCodeJavaDoc(objectClass.getValue().getNameOrOID()); + out.println(" /**"); + out.println(" * Returns a reference to the " + description + " Object Class"); + out.println(" * which has the OID " + + toCodeJavaDoc(objectClass.getValue().getOID()) + "."); + out.println(" *"); + out.println(" * @return A reference to the " + description + " Object Class."); + + out.println(" */"); + out.println(" public static ObjectClass get" + toJavaName(objectClass.getKey()) + + "() {"); + out.println(" return " + objectClass.getKey() + ";"); + out.println(" }"); + } + + out.println("}"); + } + + private static boolean isOpenDSOID(final String oid) { + return oid.startsWith(SchemaConstants.OID_OPENDS_SERVER_BASE + "."); + } + + private static boolean isCollationMatchingRule(final String oid) { + return oid.startsWith("1.3.6.1.4.1.42.2.27.9.4."); + } + + private static String splitNameIntoWords(final String name) { + String splitName = name.replaceAll("([A-Z][a-z])", "_$1"); + splitName = splitName.replaceAll("([a-z])([A-Z])", "$1_$2"); + splitName = splitName.replaceAll("[-.]", ""); + + return splitName.toUpperCase(Locale.ENGLISH); + } + + private static void testSplitNameIntoWords() { + final String[][] values = + new String[][] { { "oneTwoThree", "ONE_TWO_THREE" }, + { "oneTWOThree", "ONE_TWO_THREE" }, { "oneX500Three", "ONE_X500_THREE" }, + { "oneTwoX500", "ONE_TWO_X500" }, { "oneTwoX500", "ONE_TWO_X500" }, + { "x500TwoThree", "X500_TWO_THREE" }, }; + + for (final String[] test : values) { + final String actual = splitNameIntoWords(test[0]); + final String expected = test[1]; + if (!actual.equals(expected)) { + System.out.println("Test Split Failure: " + test[0] + " -> " + actual + " != " + + expected); + } + } + } + + private static String toCodeJavaDoc(final String text) { + return String.format("{@code %s}", text); + } + + private static String toJavaName(final String splitName) { + final StringBuilder builder = new StringBuilder(); + for (final String word : splitName.split("_")) { + if (ABBREVIATIONS.contains(word)) { + builder.append(word); + } else { + builder.append(word.charAt(0)); + if (word.length() > 1) { + builder.append(word.substring(1).toLowerCase(Locale.ENGLISH)); + } + } + } + return builder.toString(); + } + + private GenerateCoreSchema() { + // Prevent instantiation. + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java index 432299a62..2856fe87f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/GuideSyntaxImpl.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import static com.forgerock.opendj.util.StaticUtils.toLowerCase; @@ -290,20 +279,6 @@ 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java similarity index 56% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java index 99428ea86..1d3e4721b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -50,6 +41,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_IA5_STRING_NAME; } @@ -64,24 +56,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java similarity index 51% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java index d31f61072..c6cf7b4f8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java index 863c05c08..3bb099b76 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerFirstComponentEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -64,6 +54,7 @@ public Assertion getAssertion(final Schema schema, final ByteSequence assertionV } } + @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) throws DecodeException { final String definition = value.toString(); final SubstringReader reader = new SubstringReader(definition); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java index c891c64e3..0a14a37b1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java index b69878f7c..ada5055fd 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -49,6 +40,7 @@ public String getEqualityMatchingRule() { return EMR_INTEGER_OID; } + @Override public String getName() { return SYNTAX_INTEGER_NAME; } @@ -63,24 +55,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { final String valueString = value.toString(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java index 34358653d..35a0da10b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -59,20 +49,6 @@ 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java index 1f350f1b4..9043a96dc 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/KeywordEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -73,6 +63,7 @@ public Assertion getAssertion(final Schema schema, final ByteSequence assertionV 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. @@ -127,12 +118,12 @@ public T createIndexQuery(IndexQueryFactory factory) throws DecodeExcepti }; } - /** {@inheritDoc} */ @Override public Collection createIndexers(IndexingOptions options) { return Collections.emptySet(); } + @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { return ByteString.valueOfUtf8(normalize(value)); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java similarity index 87% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java index 8cd302339..9a70761f6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxDescriptionSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java index c282e4281..aa5f7de27 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRule.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -105,6 +95,18 @@ public SchemaBuilder addToSchemaOverwrite() { return getSchemaBuilder().addMatchingRule(new MatchingRule(this), true); } + /** + * Adds this matching rule to the schema, overwriting any existing matching rule + * with the same numeric OID if the overwrite parameter is set to {@code true}. + * + * @param overwrite + * {@code true} if any matching rule with the same OID should be overwritten. + * @return The parent schema builder. + */ + SchemaBuilder addToSchema(final boolean overwrite) { + return overwrite ? addToSchemaOverwrite() : addToSchema(); + } + @Override public Builder description(final String description) { return description0(description); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java index 98f1fad83..fe17c061e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java similarity index 77% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java index ac4447405..6901fe6e3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -63,20 +53,6 @@ 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java index 3a1ce5694..24bb8cd72 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUse.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2015-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import static java.util.Arrays.*; @@ -52,7 +41,6 @@ * attribute types that may be used for a given matching rule. */ public final class MatchingRuleUse extends SchemaElement { - /** A fluent API for incrementally constructing matching rule uses. */ public static final class Builder extends SchemaElementBuilder { private String oid; @@ -97,6 +85,18 @@ public SchemaBuilder addToSchemaOverwrite() { return getSchemaBuilder().addMatchingRuleUse(new MatchingRuleUse(this), true); } + /** + * Adds this matching rule use to the schema, overwriting any existing matching rule use + * with the same numeric OID if the overwrite parameter is set to {@code true}. + * + * @param overwrite + * {@code true} if any matching rule use with the same OID should be overwritten. + * @return The parent schema builder. + */ + SchemaBuilder addToSchema(final boolean overwrite) { + return overwrite ? addToSchemaOverwrite() : addToSchema(); + } + /** * Adds the provided list of attribute types to the list of attribute * type the matching rule applies to. @@ -245,13 +245,9 @@ public Builder removeName(String name) { this.names.remove(name); return this; } - } - /** - * The OID of the matching rule associated with this matching rule - * use definition. - */ + /** The OID of the matching rule associated with this matching rule use definition. */ private final String oid; /** The set of user defined names for this definition. */ @@ -260,10 +256,7 @@ public Builder removeName(String name) { /** Indicates whether this definition is declared "obsolete". */ private final boolean isObsolete; - /** - * The set of attribute types with which this matching rule use is - * associated. - */ + /** The set of attribute types with which this matching rule use is associated. */ private final Set attributeOIDs; private MatchingRule matchingRule; @@ -471,8 +464,7 @@ void toStringContent(final StringBuilder buffer) { } } - void validate(final Schema schema, final List warnings) - throws SchemaException { + void validate(final Schema schema) throws SchemaException { try { matchingRule = schema.getMatchingRule(oid); } catch (final UnknownSchemaElementException e) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java index d65ca3f71..52ba9f361 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -65,20 +55,6 @@ 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java index ea7b36ca3..9dfc6197c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameAndOptionalUIDSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -49,6 +40,7 @@ public String getEqualityMatchingRule() { return EMR_UNIQUE_MEMBER_OID; } + @Override public String getName() { return SYNTAX_NAME_AND_OPTIONAL_UID_NAME; } @@ -58,24 +50,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { final String valueString = value.toString().trim(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java index 592eaf1b1..5be8d5025 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameForm.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -100,6 +90,18 @@ public SchemaBuilder addToSchemaOverwrite() { return getSchemaBuilder().addNameForm(new NameForm(this), true); } + /** + * Adds this name form to the schema, overwriting any existing name form + * with the same numeric OID if the overwrite parameter is set to {@code true}. + * + * @param overwrite + * {@code true} if any name form with the same OID should be overwritten. + * @return The parent schema builder. + */ + SchemaBuilder addToSchema(final boolean overwrite) { + return overwrite ? addToSchemaOverwrite() : addToSchema(); + } + @Override public Builder description(final String description) { return description0(description); @@ -589,7 +591,7 @@ void toStringContent(final StringBuilder buffer) { } } - void validate(final Schema schema, final List warnings) throws SchemaException { + void validate(final Schema schema) throws SchemaException { try { structuralClass = schema.getObjectClass(structuralClassOID); } catch (final UnknownSchemaElementException e) { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java index bbd082876..8abe06b42 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NameFormSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -55,14 +45,17 @@ public String getEqualityMatchingRule() { 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 diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java new file mode 100644 index 000000000..ad47b2990 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleImpl.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This class implements the numericStringMatch matching rule defined in X.520 + * and referenced in RFC 2252. It allows for values with numeric digits and + * spaces, but ignores spaces when performing matching. + */ +final class NumericStringEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { + + NumericStringEqualityMatchingRuleImpl() { + super(EMR_NUMERIC_STRING_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeNumericStringAttributeValue(value); + } + + @Override + public String keyToHumanReadableString(ByteSequence key) { + return key.toString(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java new file mode 100644 index 000000000..18bca4197 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This implements defines the numericStringOrderingMatch matching rule defined + * in X.520 and referenced in RFC 2252. + */ +final class NumericStringOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { + + NumericStringOrderingMatchingRuleImpl() { + // Reusing equality index since OPENDJ-1864 + super(EMR_NUMERIC_STRING_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeNumericStringAttributeValue(value); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java new file mode 100644 index 000000000..3e38b5a15 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleImpl.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This class implements the numericStringSubstringsMatch matching rule defined + * in X.520 and referenced in RFC 2252. + */ +final class NumericStringSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl { + + NumericStringSubstringMatchingRuleImpl() { + super(SMR_NUMERIC_STRING_NAME, EMR_NUMERIC_STRING_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return SchemaUtils.normalizeNumericStringAttributeValue(value); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java index 070a5ed66..1a8843c0d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/NumericStringSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -49,6 +40,7 @@ public String getEqualityMatchingRule() { return EMR_NUMERIC_STRING_OID; } + @Override public String getName() { return SYNTAX_NUMERIC_STRING_NAME; } @@ -63,24 +55,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { final String valueString = value.toString(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java index 6963ea0d6..6b3aa04ca 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OIDSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -48,6 +38,7 @@ public String getEqualityMatchingRule() { return EMR_OID_OID; } + @Override public String getName() { return SYNTAX_OID_NAME; } @@ -57,24 +48,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, final LocalizableMessageBuilder invalidReason) { try { diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java index 48c4d5f40..a6b276c4f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClass.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -109,6 +99,18 @@ public SchemaBuilder addToSchemaOverwrite() { return getSchemaBuilder().addObjectClass(new ObjectClass(this), true); } + /** + * Adds this object class to the schema, overwriting any existing object class + * with the same numeric OID if the overwrite parameter is set to {@code true}. + * + * @param overwrite + * {@code true} if any object class with the same OID should be overwritten. + * @return The parent schema builder. + */ + SchemaBuilder addToSchema(final boolean overwrite) { + return overwrite ? addToSchemaOverwrite() : addToSchema(); + } + @Override public Builder description(final String description) { return description0(description); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java index 38c7a2caf..ba34ea979 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java similarity index 60% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java index 1ecbd50c7..45410ea64 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectClassType.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java similarity index 71% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java index a24c61706..8d37d45e2 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java index cad1c25e7..4c10cd16e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java new file mode 100644 index 000000000..63b89435f --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringEqualityMatchingRuleImpl.java @@ -0,0 +1,39 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This class defines the octetStringMatch matching rule defined in X.520. It + * will be used as the default equality matching rule for the binary and octet + * string syntaxes. + */ +final class OctetStringEqualityMatchingRuleImpl extends AbstractEqualityMatchingRuleImpl { + + OctetStringEqualityMatchingRuleImpl() { + super(EMR_OCTET_STRING_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return value.toByteString(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java new file mode 100644 index 000000000..48fefc3d8 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringOrderingMatchingRuleImpl.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2015-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This class defines the octetStringOrderingMatch matching rule defined in + * X.520. This will be the default ordering matching rule for the binary and + * octet string syntaxes. + */ +final class OctetStringOrderingMatchingRuleImpl extends AbstractOrderingMatchingRuleImpl { + + OctetStringOrderingMatchingRuleImpl() { + // Reusing equality index since OPENDJ-1864 + super(EMR_OCTET_STRING_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return value.toByteString(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java new file mode 100644 index 000000000..16798e633 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSubstringMatchingRuleImpl.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.opendj.ldap.ByteSequence; +import org.forgerock.opendj.ldap.ByteString; + +/** + * This class defines the octetStringSubstringsMatch matching rule defined in + * X.520. It will be used as the default substring matching rule for the binary + * and octet string syntaxes. + */ +final class OctetStringSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl { + + OctetStringSubstringMatchingRuleImpl() { + super(SMR_OCTET_STRING_NAME, EMR_OCTET_STRING_NAME); + } + + @Override + public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { + return value.toByteString(); + } + + @Override + String keyToHumanReadableString(ByteSequence key) { + return key.toByteString().toHexString(); + } +} diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java new file mode 100644 index 000000000..854b267f7 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OctetStringSyntaxImpl.java @@ -0,0 +1,59 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OCTET_STRING_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the octet string attribute syntax, which is equivalent + * to the binary syntax and should be considered a replacement for it. Equality, + * ordering, and substring matching will be allowed by default. + */ +final class OctetStringSyntaxImpl extends AbstractSyntaxImpl { + @Override + public String getEqualityMatchingRule() { + return EMR_OCTET_STRING_OID; + } + + @Override + public String getName() { + return SYNTAX_OCTET_STRING_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_OCTET_STRING_OID; + } + + @Override + public boolean isHumanReadable() { + return true; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // All values will be acceptable for the octet string syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java index 533a8c8f9..710817745 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -47,6 +38,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_LIST_OID; } + @Override public String getName() { return SYNTAX_OTHER_MAILBOX_NAME; } @@ -56,24 +48,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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 diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java new file mode 100644 index 000000000..6bb5bd68c --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PostalAddressSyntaxImpl.java @@ -0,0 +1,62 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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_CASE_IGNORE_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SMR_CASE_IGNORE_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_POSTAL_ADDRESS_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the postal address attribute syntax, which is a list of + * UCS (Universal Character Set, as defined in the ISO 10646 specification and + * includes UTF-8 and UTF-16) strings separated by dollar signs. By default, + * they will be treated in a case-insensitive manner, and equality and substring + * matching will be allowed. + */ +final class PostalAddressSyntaxImpl extends AbstractSyntaxImpl { + + @Override + public String getEqualityMatchingRule() { + return EMR_CASE_IGNORE_OID; + } + + @Override + public String getName() { + return SYNTAX_POSTAL_ADDRESS_NAME; + } + + @Override + public String getSubstringMatchingRule() { + return SMR_CASE_IGNORE_OID; + } + + @Override + public boolean isHumanReadable() { + return true; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // We'll allow any value. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java index 44dfda1e1..91b108b48 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java new file mode 100644 index 000000000..ffa1802e3 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PresentationAddressSyntaxImpl.java @@ -0,0 +1,67 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the presentation address attribute syntax, which is + * defined in RFC 1278. However, because this LDAP syntax is being deprecated, + * this implementation behaves exactly like the directory string syntax. + */ +final class PresentationAddressSyntaxImpl extends AbstractSyntaxImpl { + @Override + public String getApproximateMatchingRule() { + return AMR_DOUBLE_METAPHONE_OID; + } + + @Override + public String getEqualityMatchingRule() { + return EMR_CASE_IGNORE_OID; + } + + @Override + public String getName() { + return SYNTAX_PRESENTATION_ADDRESS_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_CASE_IGNORE_OID; + } + + @Override + public String getSubstringMatchingRule() { + return SMR_CASE_IGNORE_OID; + } + + @Override + public boolean isHumanReadable() { + return true; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // We will accept any value for this syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java index 2aa67d8b3..f3092b84b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/PrintableStringSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -142,6 +133,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_PRINTABLE_STRING_NAME; } @@ -156,24 +148,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java similarity index 50% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java index b457f6b46..f01de907d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java new file mode 100644 index 000000000..229797690 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/ProtocolInformationSyntaxImpl.java @@ -0,0 +1,68 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the protocol information attribute syntax, which is + * being deprecated. As such, this implementation behaves exactly like the + * directory string syntax. + */ +final class ProtocolInformationSyntaxImpl extends AbstractSyntaxImpl { + + @Override + public String getApproximateMatchingRule() { + return AMR_DOUBLE_METAPHONE_OID; + } + + @Override + public String getEqualityMatchingRule() { + return EMR_CASE_IGNORE_OID; + } + + @Override + public String getName() { + return SYNTAX_PROTOCOL_INFORMATION_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_CASE_IGNORE_OID; + } + + @Override + public String getSubstringMatchingRule() { + return SMR_CASE_IGNORE_OID; + } + + @Override + public boolean isHumanReadable() { + return true; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // We will accept any value for this syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java index c87030f82..fdec7c79b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/RegexSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -64,6 +55,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return "Regex(" + pattern + ")"; } @@ -78,10 +70,12 @@ public String getSubstringMatchingRule() { 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java index 0a928a322..e9db683e1 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/Schema.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.ldap.schema; @@ -86,7 +76,9 @@ private static interface Impl { String getOIDForName(String lowerCaseName); - AttributeType getAttributeType(Schema schema, String name); + AttributeType getAttributeType(Schema schema, String nameOrOid); + + AttributeType getAttributeType(String nameOrOid, Syntax syntax); Collection getAttributeTypes(); @@ -94,7 +86,7 @@ private static interface Impl { DITContentRule getDITContentRule(ObjectClass structuralClass); - DITContentRule getDITContentRule(String name); + DITContentRule getDITContentRule(String nameOrOid); Collection getDITContentRules(); @@ -108,7 +100,7 @@ private static interface Impl { Collection getDITStuctureRules(); - MatchingRule getMatchingRule(String name); + MatchingRule getMatchingRule(String nameOrOid); Collection getMatchingRules(); @@ -116,13 +108,13 @@ private static interface Impl { MatchingRuleUse getMatchingRuleUse(MatchingRule matchingRule); - MatchingRuleUse getMatchingRuleUse(String name); + MatchingRuleUse getMatchingRuleUse(String nameOrOid); Collection getMatchingRuleUses(); Collection getMatchingRuleUsesWithName(String name); - NameForm getNameForm(String name); + NameForm getNameForm(String nameOrOid); Collection getNameForms(); @@ -130,7 +122,7 @@ private static interface Impl { Collection getNameFormsWithName(String name); - ObjectClass getObjectClass(String name); + ObjectClass getObjectClass(String nameOrOid); Collection getObjectClasses(); @@ -144,19 +136,19 @@ private static interface Impl { Collection getWarnings(); - boolean hasAttributeType(String name); + boolean hasAttributeType(String nameOrOid); - boolean hasDITContentRule(String name); + boolean hasDITContentRule(String nameOrOid); boolean hasDITStructureRule(int ruleID); - boolean hasMatchingRule(String name); + boolean hasMatchingRule(String nameOrOid); - boolean hasMatchingRuleUse(String name); + boolean hasMatchingRuleUse(String nameOrOid); - boolean hasNameForm(String name); + boolean hasNameForm(String nameOrOid); - boolean hasObjectClass(String name); + boolean hasObjectClass(String nameOrOid); boolean hasSyntax(String numericOID); @@ -201,9 +193,18 @@ public String getOIDForName(final String lowerCaseName) { } @Override - public AttributeType getAttributeType(final Schema schema, final String name) { - final AttributeType type = strictImpl.getAttributeType0(name); - return type != null ? type : new AttributeType(schema, name); + public AttributeType getAttributeType(final Schema schema, final String nameOrOid) { + return getAttributeType0(nameOrOid, schema.getDefaultSyntax(), schema.getDefaultMatchingRule()); + } + + @Override + public AttributeType getAttributeType(final String nameOrOid, final Syntax syntax) { + return getAttributeType0(nameOrOid, syntax, syntax.getEqualityMatchingRule()); + } + + private AttributeType getAttributeType0(String nameOrOid, Syntax syntax, MatchingRule equalityMatchingRule) { + final AttributeType type = strictImpl.getAttributeType0(nameOrOid); + return type != null ? type : new AttributeType(nameOrOid, syntax, equalityMatchingRule); } @Override @@ -222,8 +223,8 @@ public DITContentRule getDITContentRule(final ObjectClass structuralClass) { } @Override - public DITContentRule getDITContentRule(final String name) { - return strictImpl.getDITContentRule(name); + public DITContentRule getDITContentRule(final String nameOrOid) { + return strictImpl.getDITContentRule(nameOrOid); } @Override @@ -257,8 +258,8 @@ public Collection getDITStuctureRules() { } @Override - public MatchingRule getMatchingRule(final String name) { - return strictImpl.getMatchingRule(name); + public MatchingRule getMatchingRule(final String nameOrOid) { + return strictImpl.getMatchingRule(nameOrOid); } @Override @@ -277,8 +278,8 @@ public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) { } @Override - public MatchingRuleUse getMatchingRuleUse(final String name) { - return strictImpl.getMatchingRuleUse(name); + public MatchingRuleUse getMatchingRuleUse(final String nameOrOid) { + return strictImpl.getMatchingRuleUse(nameOrOid); } @Override @@ -292,8 +293,8 @@ public Collection getMatchingRuleUsesWithName(final String name } @Override - public NameForm getNameForm(final String name) { - return strictImpl.getNameForm(name); + public NameForm getNameForm(final String nameOrOid) { + return strictImpl.getNameForm(nameOrOid); } @Override @@ -312,8 +313,8 @@ public Collection getNameFormsWithName(final String name) { } @Override - public ObjectClass getObjectClass(final String name) { - return strictImpl.getObjectClass(name); + public ObjectClass getObjectClass(final String nameOrOid) { + return strictImpl.getObjectClass(nameOrOid); } @Override @@ -350,17 +351,17 @@ public Collection getWarnings() { } @Override - public boolean hasAttributeType(final String name) { + public boolean hasAttributeType(final String nameOrOid) { // In theory a non-strict schema always contains the requested // attribute type, so we could always return true. However, we // should provide a way for callers to differentiate between a // real attribute type and a faked up attribute type. - return strictImpl.hasAttributeType(name); + return strictImpl.hasAttributeType(nameOrOid); } @Override - public boolean hasDITContentRule(final String name) { - return strictImpl.hasDITContentRule(name); + public boolean hasDITContentRule(final String nameOrOid) { + return strictImpl.hasDITContentRule(nameOrOid); } @Override @@ -369,23 +370,23 @@ public boolean hasDITStructureRule(final int ruleID) { } @Override - public boolean hasMatchingRule(final String name) { - return strictImpl.hasMatchingRule(name); + public boolean hasMatchingRule(final String nameOrOid) { + return strictImpl.hasMatchingRule(nameOrOid); } @Override - public boolean hasMatchingRuleUse(final String name) { - return strictImpl.hasMatchingRuleUse(name); + public boolean hasMatchingRuleUse(final String nameOrOid) { + return strictImpl.hasMatchingRuleUse(nameOrOid); } @Override - public boolean hasNameForm(final String name) { - return strictImpl.hasNameForm(name); + public boolean hasNameForm(final String nameOrOid) { + return strictImpl.hasNameForm(nameOrOid); } @Override - public boolean hasObjectClass(final String name) { - return strictImpl.hasObjectClass(name); + public boolean hasObjectClass(final String nameOrOid) { + return strictImpl.hasObjectClass(nameOrOid); } @Override @@ -504,21 +505,24 @@ public MatchingRule getDefaultMatchingRule() { @Override public String getOIDForName(String lowerCaseName) { final String oid = name2OIDs.get(lowerCaseName); - // == is correct, AMBIGUOUS_OID is singleton to mark an entry ambiguous - if (oid == SchemaBuilder.AMBIGUOUS_OID) { + if (SchemaBuilder.AMBIGUOUS_OID.equals(oid)) { throw new UnknownSchemaElementException(WARN_NAME_AMBIGUOUS.get(lowerCaseName)); } return oid; } @Override - public AttributeType getAttributeType(final Schema schema, final String name) { - final AttributeType type = getAttributeType0(name); + public AttributeType getAttributeType(String nameOrOid, Syntax syntax) { + return getAttributeType(null, nameOrOid); + } + + @Override + public AttributeType getAttributeType(final Schema schema, final String nameOrOid) { + final AttributeType type = getAttributeType0(nameOrOid); if (type != null) { return type; - } else { - throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(name)); } + throw new UnknownSchemaElementException(WARN_ATTR_TYPE_UNKNOWN.get(nameOrOid)); } @Override @@ -542,19 +546,19 @@ public DITContentRule getDITContentRule(final ObjectClass structuralClass) { } @Override - public DITContentRule getDITContentRule(final String name) { - final DITContentRule rule = numericOID2ContentRules.get(name); + public DITContentRule getDITContentRule(final String nameOrOid) { + final DITContentRule rule = numericOID2ContentRules.get(nameOrOid); if (rule != null) { return rule; } - final List rules = name2ContentRules.get(StaticUtils.toLowerCase(name)); + final List rules = name2ContentRules.get(StaticUtils.toLowerCase(nameOrOid)); if (rules != null) { if (rules.size() == 1) { return rules.get(0); } - throw new UnknownSchemaElementException(WARN_DCR_AMBIGUOUS.get(name)); + throw new UnknownSchemaElementException(WARN_DCR_AMBIGUOUS.get(nameOrOid)); } - throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(name)); + throw new UnknownSchemaElementException(WARN_DCR_UNKNOWN.get(nameOrOid)); } @Override @@ -606,19 +610,19 @@ public Collection getDITStuctureRules() { } @Override - public MatchingRule getMatchingRule(final String name) { - final MatchingRule rule = numericOID2MatchingRules.get(name); + public MatchingRule getMatchingRule(final String nameOrOid) { + final MatchingRule rule = numericOID2MatchingRules.get(nameOrOid); if (rule != null) { return rule; } - final List rules = name2MatchingRules.get(StaticUtils.toLowerCase(name)); + final List rules = name2MatchingRules.get(StaticUtils.toLowerCase(nameOrOid)); if (rules != null) { if (rules.size() == 1) { return rules.get(0); } - throw new UnknownSchemaElementException(WARN_MR_AMBIGUOUS.get(name)); + throw new UnknownSchemaElementException(WARN_MR_AMBIGUOUS.get(nameOrOid)); } - throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(name)); + throw new UnknownSchemaElementException(WARN_MR_UNKNOWN.get(nameOrOid)); } @Override @@ -641,20 +645,20 @@ public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) { } @Override - public MatchingRuleUse getMatchingRuleUse(final String name) { - final MatchingRuleUse rule = numericOID2MatchingRuleUses.get(name); + public MatchingRuleUse getMatchingRuleUse(final String nameOrOid) { + final MatchingRuleUse rule = numericOID2MatchingRuleUses.get(nameOrOid); if (rule != null) { return rule; } final List uses = - name2MatchingRuleUses.get(StaticUtils.toLowerCase(name)); + name2MatchingRuleUses.get(StaticUtils.toLowerCase(nameOrOid)); if (uses != null) { if (uses.size() == 1) { return uses.get(0); } - throw new UnknownSchemaElementException(WARN_MRU_AMBIGUOUS.get(name)); + throw new UnknownSchemaElementException(WARN_MRU_AMBIGUOUS.get(nameOrOid)); } - throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(name)); + throw new UnknownSchemaElementException(WARN_MRU_UNKNOWN.get(nameOrOid)); } @Override @@ -673,19 +677,19 @@ public Collection getMatchingRuleUsesWithName(final String name } @Override - public NameForm getNameForm(final String name) { - final NameForm form = numericOID2NameForms.get(name); + public NameForm getNameForm(final String nameOrOid) { + final NameForm form = numericOID2NameForms.get(nameOrOid); if (form != null) { return form; } - final List forms = name2NameForms.get(StaticUtils.toLowerCase(name)); + final List forms = name2NameForms.get(StaticUtils.toLowerCase(nameOrOid)); if (forms != null) { if (forms.size() == 1) { return forms.get(0); } - throw new UnknownSchemaElementException(WARN_NAMEFORM_AMBIGUOUS.get(name)); + throw new UnknownSchemaElementException(WARN_NAMEFORM_AMBIGUOUS.get(nameOrOid)); } - throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(name)); + throw new UnknownSchemaElementException(WARN_NAMEFORM_UNKNOWN.get(nameOrOid)); } @Override @@ -712,19 +716,19 @@ public Collection getNameFormsWithName(final String name) { } @Override - public ObjectClass getObjectClass(final String name) { - final ObjectClass oc = numericOID2ObjectClasses.get(name); + public ObjectClass getObjectClass(final String nameOrOid) { + final ObjectClass oc = numericOID2ObjectClasses.get(nameOrOid); if (oc != null) { return oc; } - final List classes = name2ObjectClasses.get(StaticUtils.toLowerCase(name)); + final List classes = name2ObjectClasses.get(StaticUtils.toLowerCase(nameOrOid)); if (classes != null) { if (classes.size() == 1) { return classes.get(0); } - throw new UnknownSchemaElementException(WARN_OBJECTCLASS_AMBIGUOUS.get(name)); + throw new UnknownSchemaElementException(WARN_OBJECTCLASS_AMBIGUOUS.get(nameOrOid)); } - throw new UnknownSchemaElementException(WARN_OBJECTCLASS_UNKNOWN.get(name)); + throw new UnknownSchemaElementException(WARN_OBJECTCLASS_UNKNOWN.get(nameOrOid)); } @Override @@ -766,21 +770,21 @@ public Collection getWarnings() { } @Override - public boolean hasAttributeType(final String name) { - if (numericOID2AttributeTypes.containsKey(name)) { + public boolean hasAttributeType(final String nameOrOid) { + if (numericOID2AttributeTypes.containsKey(nameOrOid)) { return true; } final List attributes = - name2AttributeTypes.get(StaticUtils.toLowerCase(name)); + name2AttributeTypes.get(StaticUtils.toLowerCase(nameOrOid)); return attributes != null && attributes.size() == 1; } @Override - public boolean hasDITContentRule(final String name) { - if (numericOID2ContentRules.containsKey(name)) { + public boolean hasDITContentRule(final String nameOrOid) { + if (numericOID2ContentRules.containsKey(nameOrOid)) { return true; } - final List rules = name2ContentRules.get(StaticUtils.toLowerCase(name)); + final List rules = name2ContentRules.get(StaticUtils.toLowerCase(nameOrOid)); return rules != null && rules.size() == 1; } @@ -790,39 +794,39 @@ public boolean hasDITStructureRule(final int ruleID) { } @Override - public boolean hasMatchingRule(final String name) { - if (numericOID2MatchingRules.containsKey(name)) { + public boolean hasMatchingRule(final String nameOrOid) { + if (numericOID2MatchingRules.containsKey(nameOrOid)) { return true; } - final List rules = name2MatchingRules.get(StaticUtils.toLowerCase(name)); + final List rules = name2MatchingRules.get(StaticUtils.toLowerCase(nameOrOid)); return rules != null && rules.size() == 1; } @Override - public boolean hasMatchingRuleUse(final String name) { - if (numericOID2MatchingRuleUses.containsKey(name)) { + public boolean hasMatchingRuleUse(final String nameOrOid) { + if (numericOID2MatchingRuleUses.containsKey(nameOrOid)) { return true; } final List uses = - name2MatchingRuleUses.get(StaticUtils.toLowerCase(name)); + name2MatchingRuleUses.get(StaticUtils.toLowerCase(nameOrOid)); return uses != null && uses.size() == 1; } @Override - public boolean hasNameForm(final String name) { - if (numericOID2NameForms.containsKey(name)) { + public boolean hasNameForm(final String nameOrOid) { + if (numericOID2NameForms.containsKey(nameOrOid)) { return true; } - final List forms = name2NameForms.get(StaticUtils.toLowerCase(name)); + final List forms = name2NameForms.get(StaticUtils.toLowerCase(nameOrOid)); return forms != null && forms.size() == 1; } @Override - public boolean hasObjectClass(final String name) { - if (numericOID2ObjectClasses.containsKey(name)) { + public boolean hasObjectClass(final String nameOrOid) { + if (numericOID2ObjectClasses.containsKey(nameOrOid)) { return true; } - final List classes = name2ObjectClasses.get(StaticUtils.toLowerCase(name)); + final List classes = name2ObjectClasses.get(StaticUtils.toLowerCase(nameOrOid)); return classes != null && classes.size() == 1; } @@ -836,18 +840,18 @@ public boolean isStrict() { return true; } - AttributeType getAttributeType0(final String name) { - final AttributeType type = numericOID2AttributeTypes.get(name); + AttributeType getAttributeType0(final String nameOrOid) { + final AttributeType type = numericOID2AttributeTypes.get(nameOrOid); if (type != null) { return type; } final List attributes = - name2AttributeTypes.get(StaticUtils.toLowerCase(name)); + name2AttributeTypes.get(StaticUtils.toLowerCase(nameOrOid)); if (attributes != null) { if (attributes.size() == 1) { return attributes.get(0); } - throw new UnknownSchemaElementException(WARN_ATTR_TYPE_AMBIGUOUS.get(name)); + throw new UnknownSchemaElementException(WARN_ATTR_TYPE_AMBIGUOUS.get(nameOrOid)); } return null; } @@ -1016,8 +1020,7 @@ public static Schema readSchemaForEntry(final Connection connection, final DN na *

    * This implementation first reads the {@code subschemaSubentry} attribute * of the entry in order to identify the schema and then invokes - * {@link #readSchemaAsync(Connection, DN, ResultHandler)} to read the - * schema. + * {@link #readSchemaAsync(Connection, DN)} to read the schema. * * @param connection * A connection to the Directory Server whose schema is to be @@ -1120,7 +1123,7 @@ String getOIDForName(String lowerCaseName) { } /** - * Returns the attribute type with the specified name or numeric OID. + * Returns the attribute type for the specified name or numeric OID. *

    * If the requested attribute type is not registered in this schema and this * schema is non-strict then a temporary "place-holder" attribute type will @@ -1129,7 +1132,7 @@ String getOIDForName(String lowerCaseName) { * In addition, they will use the directory string syntax and case ignore * matching rule. * - * @param name + * @param nameOrOid * The name or OID of the attribute type to retrieve. * @return The requested attribute type. * @throws UnknownSchemaElementException @@ -1137,8 +1140,32 @@ String getOIDForName(String lowerCaseName) { * was not found or if the provided name is ambiguous. * @see AttributeType#isPlaceHolder() */ - public AttributeType getAttributeType(final String name) { - return impl.getAttributeType(this, name); + public AttributeType getAttributeType(final String nameOrOid) { + return impl.getAttributeType(this, nameOrOid); + } + + /** + * Returns the attribute type for the specified name or numeric OID. + *

    + * If the requested attribute type is not registered in this schema and this + * schema is non-strict then a temporary "place-holder" attribute type will + * be created and returned. Place holder attribute types have an OID which + * is the normalized attribute name with the string {@code -oid} appended. + * In addition, they will use the provided syntax and the default matching + * rule associated with the syntax. + * + * @param nameOrOid + * The name or OID of the attribute type to retrieve. + * @param syntax + * The syntax to use when creating the temporary "place-holder" attribute type. + * @return The requested attribute type. + * @throws UnknownSchemaElementException + * If this is a strict schema and the requested attribute type + * was not found or if the provided name is ambiguous. + * @see AttributeType#isPlaceHolder() + */ + public AttributeType getAttributeType(final String nameOrOid, final Syntax syntax) { + return impl.getAttributeType(nameOrOid, syntax); } /** @@ -1157,7 +1184,7 @@ public Collection getAttributeTypes() { * having the specified name or numeric OID. * * @param name - * The name or OID of the attribute types to retrieve. + * The name of the attribute types to retrieve. * @return An unmodifiable collection containing all of the attribute types * having the specified name or numeric OID. */ @@ -1181,15 +1208,15 @@ public DITContentRule getDITContentRule(final ObjectClass structuralClass) { /** * Returns the DIT content rule with the specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the DIT content rule to retrieve. * @return The requested DIT content rule. * @throws UnknownSchemaElementException * If this is a strict schema and the requested DIT content rule * was not found or if the provided name is ambiguous. */ - public DITContentRule getDITContentRule(final String name) { - return impl.getDITContentRule(name); + public DITContentRule getDITContentRule(final String nameOrOid) { + return impl.getDITContentRule(nameOrOid); } /** @@ -1208,7 +1235,7 @@ public Collection getDITContentRules() { * rules having the specified name or numeric OID. * * @param name - * The name or OID of the DIT content rules to retrieve. + * The name of the DIT content rules to retrieve. * @return An unmodifiable collection containing all of the DIT content * rules having the specified name or numeric OID. */ @@ -1248,7 +1275,7 @@ public Collection getDITStructureRules(final NameForm nameForm * rules having the specified name or numeric OID. * * @param name - * The name or OID of the DIT structure rules to retrieve. + * The name of the DIT structure rules to retrieve. * @return An unmodifiable collection containing all of the DIT structure * rules having the specified name or numeric OID. */ @@ -1270,15 +1297,15 @@ public Collection getDITStuctureRules() { /** * Returns the matching rule with the specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the matching rule to retrieve. * @return The requested matching rule. * @throws UnknownSchemaElementException * If this is a strict schema and the requested matching rule * was not found or if the provided name is ambiguous. */ - public MatchingRule getMatchingRule(final String name) { - return impl.getMatchingRule(name); + public MatchingRule getMatchingRule(final String nameOrOid) { + return impl.getMatchingRule(nameOrOid); } /** @@ -1297,7 +1324,7 @@ public Collection getMatchingRules() { * having the specified name or numeric OID. * * @param name - * The name or OID of the matching rules to retrieve. + * The name of the matching rules to retrieve. * @return An unmodifiable collection containing all of the matching rules * having the specified name or numeric OID. */ @@ -1321,15 +1348,15 @@ public MatchingRuleUse getMatchingRuleUse(final MatchingRule matchingRule) { /** * Returns the matching rule use with the specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the matching rule use to retrieve. * @return The requested matching rule use. * @throws UnknownSchemaElementException * If this is a strict schema and the requested matching rule * use was not found or if the provided name is ambiguous. */ - public MatchingRuleUse getMatchingRuleUse(final String name) { - return impl.getMatchingRuleUse(name); + public MatchingRuleUse getMatchingRuleUse(final String nameOrOid) { + return impl.getMatchingRuleUse(nameOrOid); } /** @@ -1348,7 +1375,7 @@ public Collection getMatchingRuleUses() { * uses having the specified name or numeric OID. * * @param name - * The name or OID of the matching rule uses to retrieve. + * The name of the matching rule uses to retrieve. * @return An unmodifiable collection containing all of the matching rule * uses having the specified name or numeric OID. */ @@ -1359,15 +1386,15 @@ public Collection getMatchingRuleUsesWithName(final String name /** * Returns the name form with the specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the name form to retrieve. * @return The requested name form. * @throws UnknownSchemaElementException * If this is a strict schema and the requested name form was * not found or if the provided name is ambiguous. */ - public NameForm getNameForm(final String name) { - return impl.getNameForm(name); + public NameForm getNameForm(final String nameOrOid) { + return impl.getNameForm(nameOrOid); } /** @@ -1400,7 +1427,7 @@ public Collection getNameForms(final ObjectClass structuralClass) { * having the specified name or numeric OID. * * @param name - * The name or OID of the name forms to retrieve. + * The name of the name forms to retrieve. * @return An unmodifiable collection containing all of the name forms * having the specified name or numeric OID. */ @@ -1411,15 +1438,15 @@ public Collection getNameFormsWithName(final String name) { /** * Returns the object class with the specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the object class to retrieve. * @return The requested object class. * @throws UnknownSchemaElementException * If this is a strict schema and the requested object class was * not found or if the provided name is ambiguous. */ - public ObjectClass getObjectClass(final String name) { - return impl.getObjectClass(name); + public ObjectClass getObjectClass(final String nameOrOid) { + return impl.getObjectClass(nameOrOid); } /** @@ -1438,7 +1465,7 @@ public Collection getObjectClasses() { * having the specified name or numeric OID. * * @param name - * The name or OID of the object classes to retrieve. + * The name of the object classes to retrieve. * @return An unmodifiable collection containing all of the object classes * having the specified name or numeric OID. */ @@ -1518,26 +1545,26 @@ public Collection getWarnings() { * Indicates whether or not this schema contains an attribute type with the * specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the attribute type. * @return {@code true} if this schema contains an attribute type with the * specified name or numeric OID, otherwise {@code false}. */ - public boolean hasAttributeType(final String name) { - return impl.hasAttributeType(name); + public boolean hasAttributeType(final String nameOrOid) { + return impl.hasAttributeType(nameOrOid); } /** * Indicates whether or not this schema contains a DIT content rule with the * specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the DIT content rule. * @return {@code true} if this schema contains a DIT content rule with the * specified name or numeric OID, otherwise {@code false}. */ - public boolean hasDITContentRule(final String name) { - return impl.hasDITContentRule(name); + public boolean hasDITContentRule(final String nameOrOid) { + return impl.hasDITContentRule(nameOrOid); } /** @@ -1557,52 +1584,52 @@ public boolean hasDITStructureRule(final int ruleID) { * Indicates whether or not this schema contains a matching rule with the * specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the matching rule. * @return {@code true} if this schema contains a matching rule with the * specified name or numeric OID, otherwise {@code false}. */ - public boolean hasMatchingRule(final String name) { - return impl.hasMatchingRule(name); + public boolean hasMatchingRule(final String nameOrOid) { + return impl.hasMatchingRule(nameOrOid); } /** * Indicates whether or not this schema contains a matching rule use with * the specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the matching rule use. * @return {@code true} if this schema contains a matching rule use with the * specified name or numeric OID, otherwise {@code false}. */ - public boolean hasMatchingRuleUse(final String name) { - return impl.hasMatchingRuleUse(name); + public boolean hasMatchingRuleUse(final String nameOrOid) { + return impl.hasMatchingRuleUse(nameOrOid); } /** * Indicates whether or not this schema contains a name form with the * specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the name form. * @return {@code true} if this schema contains a name form with the * specified name or numeric OID, otherwise {@code false}. */ - public boolean hasNameForm(final String name) { - return impl.hasNameForm(name); + public boolean hasNameForm(final String nameOrOid) { + return impl.hasNameForm(nameOrOid); } /** * Indicates whether or not this schema contains an object class with the * specified name or numeric OID. * - * @param name + * @param nameOrOid * The name or OID of the object class. * @return {@code true} if this schema contains an object class with the * specified name or numeric OID, otherwise {@code false}. */ - public boolean hasObjectClass(final String name) { - return impl.hasObjectClass(name); + public boolean hasObjectClass(final String nameOrOid) { + return impl.hasObjectClass(nameOrOid); } /** @@ -1835,7 +1862,7 @@ public boolean validateEntry(final Entry entry, final SchemaValidationPolicy pol // should be valid. foundMatchingNameForms = true; - if (checkNameForm(entry, policy, nameFormWarnings, nf)) { + if (checkNameForm(entry, nameFormWarnings, nf)) { nameForm = nf; break; } @@ -2117,8 +2144,8 @@ private boolean checkDITStructureRule(final Entry entry, return true; } - private boolean checkNameForm(final Entry entry, final SchemaValidationPolicy policy, - final List nameFormWarnings, final NameForm nameForm) { + private boolean checkNameForm(final Entry entry, final List nameFormWarnings, + final NameForm nameForm) { final RDN rdn = entry.getName().rdn(); if (rdn != null) { // Make sure that all the required AVAs are present. @@ -2173,4 +2200,12 @@ private ObjectClass getParentStructuralObjectClass(final Entry entry, } return parentStructuralObjectClass; } + + @Override + public String toString() { + return "Schema " + getSchemaName() + + " mr=" + getMatchingRules().size() + + " syntaxes=" + getSyntaxes().size() + + " at=" + getAttributeTypes().size(); + } } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java index e9593a29d..f5d7301d3 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaBuilder.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2014 Manuel Gaupp - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2014 Manuel Gaupp + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -41,7 +31,6 @@ import static com.forgerock.opendj.util.StaticUtils.*; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; @@ -71,19 +60,17 @@ import org.forgerock.opendj.ldap.requests.SearchRequest; import org.forgerock.opendj.ldap.responses.SearchResultEntry; import org.forgerock.opendj.ldap.schema.DITContentRule.Builder; -import org.forgerock.util.Options; -import org.forgerock.util.Reject; import org.forgerock.util.AsyncFunction; import org.forgerock.util.Function; import org.forgerock.util.Option; +import org.forgerock.util.Options; +import org.forgerock.util.Reject; import org.forgerock.util.promise.Promise; import com.forgerock.opendj.util.StaticUtils; import com.forgerock.opendj.util.SubstringReader; -/** - * Schema builders should be used for incremental construction of new schemas. - */ +/** Schema builders should be used for incremental construction of new schemas. */ public final class SchemaBuilder { /** Constant used for name to oid mapping when one name actually maps to multiple numerical OID. */ @@ -108,10 +95,7 @@ private static SearchRequest getReadSchemaForEntrySearchRequest(final DN dn) { SUBSCHEMA_SUBENTRY_ATTRS); } - /** - * Constructs a search request for retrieving the named subschema - * sub-entry. - */ + /** Constructs a search request for retrieving the named subschema sub-entry. */ private static SearchRequest getReadSchemaSearchRequest(final DN dn) { return Requests.newSearchRequest(dn, SearchScope.BASE_OBJECT, SUBSCHEMA_FILTER, SUBSCHEMA_ATTRS); @@ -160,20 +144,13 @@ private static DN getSubschemaSubentryDN(final DN name, final Entry entry) throw private List warnings; private Options options; - /** A schema which should be copied into this builder on any mutation. */ private Schema copyOnWriteSchema; - /** - * A unique ID which can be used to uniquely identify schemas - * constructed without a name. - */ + /** A unique ID which can be used to uniquely identify schemas constructed without a name. */ private static final AtomicInteger NEXT_SCHEMA_ID = new AtomicInteger(); - /** - * Creates a new schema builder with no schema elements and default - * compatibility options. - */ + /** Creates a new schema builder with no schema elements and default compatibility options. */ public SchemaBuilder() { preLazyInitBuilder(null, null); } @@ -387,7 +364,7 @@ public SchemaBuilder addAttributeType(final String definition, final boolean ove atBuilder.approximateMatchingRule(approxRules.get(0)); } - if (superiorType == null && syntax == null) { + if (superiorType == null && syntax == null && !options.get(ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX)) { throw new LocalizedIllegalArgumentException( WARN_ATTR_SYNTAX_ATTRTYPE_MISSING_SYNTAX_AND_SUPERIOR.get(definition)); } @@ -395,7 +372,7 @@ public SchemaBuilder addAttributeType(final String definition, final boolean ove atBuilder.superiorType(superiorType) .syntax(syntax); - return overwrite ? atBuilder.addToSchemaOverwrite() : atBuilder.addToSchema(); + return atBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = ERR_ATTR_SYNTAX_ATTRTYPE_INVALID1.get(definition, e.getMessageObject()); throw new LocalizedIllegalArgumentException(msg, e.getCause()); @@ -502,7 +479,7 @@ public SchemaBuilder addDITContentRule(final String definition, final boolean ov } } - return overwrite ? contentRuleBuilder.addToSchemaOverwrite() : contentRuleBuilder.addToSchema(); + return contentRuleBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = ERR_ATTR_SYNTAX_DCR_INVALID1.get(definition, e.getMessageObject()); throw new LocalizedIllegalArgumentException(msg, e.getCause()); @@ -609,7 +586,7 @@ public SchemaBuilder addDITStructureRule(final String definition, final boolean } ruleBuilder.nameForm(nameForm); - return overwrite ? ruleBuilder.addToSchemaOverwrite() : ruleBuilder.addToSchema(); + return ruleBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = ERR_ATTR_SYNTAX_DSR_INVALID1.get(definition, e.getMessageObject()); throw new LocalizedIllegalArgumentException(msg, e.getCause()); @@ -637,28 +614,10 @@ public SchemaBuilder addDITStructureRule(final String definition, final boolean public SchemaBuilder addEnumerationSyntax(final String oid, final String description, final boolean overwrite, final String... enumerations) { Reject.ifNull((Object) enumerations); - - lazyInitBuilder(); - - final EnumSyntaxImpl enumImpl = new EnumSyntaxImpl(oid, Arrays.asList(enumerations)); - - final Syntax.Builder syntaxBuilder = buildSyntax(oid).description(description) - .extraProperties(Collections.singletonMap("X-ENUM", Arrays.asList(enumerations))) - .implementation(enumImpl); - - syntaxBuilder.addToSchema(overwrite); - - try { - buildMatchingRule(enumImpl.getOrderingMatchingRule()) - .names(OMR_GENERIC_ENUM_NAME + oid) - .syntaxOID(oid) - .extraProperties(CoreSchemaImpl.OPENDS_ORIGIN) - .implementation(new EnumOrderingMatchingRule(enumImpl)) - .addToSchemaOverwrite(); - } catch (final ConflictingSchemaElementException e) { - removeSyntax(oid); - } - return this; + return buildSyntax(oid) + .description(description) + .extraProperties("X-ENUM", enumerations) + .addToSchema(overwrite); } /** @@ -762,11 +721,7 @@ public SchemaBuilder addMatchingRule(final String definition, final boolean over if (syntax == null) { throw new LocalizedIllegalArgumentException(ERR_ATTR_SYNTAX_MR_NO_SYNTAX.get(definition)); } - if (overwrite) { - matchingRuleBuilder.addToSchemaOverwrite(); - } else { - matchingRuleBuilder.addToSchema(); - } + matchingRuleBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = ERR_ATTR_SYNTAX_MR_INVALID1.get(definition, e.getMessageObject()); @@ -870,12 +825,12 @@ public SchemaBuilder addMatchingRuleUse(final String definition, final boolean o } // Make sure that the set of attributes was defined. - if (attributes == null || attributes.size() == 0) { + if (attributes == null || attributes.isEmpty()) { throw new LocalizedIllegalArgumentException(ERR_ATTR_SYNTAX_MRUSE_NO_ATTR.get(definition)); } useBuilder.attributes(attributes); - return overwrite ? useBuilder.addToSchemaOverwrite() : useBuilder.addToSchema(); + return useBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = ERR_ATTR_SYNTAX_MRUSE_INVALID1.get(definition, e.getMessageObject()); throw new LocalizedIllegalArgumentException(msg, e.getCause()); @@ -1073,11 +1028,7 @@ public SchemaBuilder addNameForm(final String definition, final boolean overwrit throw new LocalizedIllegalArgumentException(ERR_ATTR_SYNTAX_NAME_FORM_NO_REQUIRED_ATTR.get(definition)); } - if (overwrite) { - nameFormBuilder.addToSchemaOverwrite(); - } else { - nameFormBuilder.addToSchema(); - } + nameFormBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = ERR_ATTR_SYNTAX_NAME_FORM_INVALID1.get(definition, e.getMessageObject()); @@ -1214,13 +1165,7 @@ public DITStructureRule.Builder buildDITStructureRule(final DITStructureRule str * @return A builder to continue building the MatchingRule. */ public MatchingRule.Builder buildMatchingRule(final MatchingRule matchingRule) { - return buildMatchingRule(matchingRule, true); - } - - private MatchingRule.Builder buildMatchingRule(final MatchingRule matchingRule, final boolean initialize) { - if (initialize) { - lazyInitBuilder(); - } + lazyInitBuilder(); return new MatchingRule.Builder(matchingRule, this); } @@ -1280,13 +1225,7 @@ public ObjectClass.Builder buildObjectClass(final ObjectClass objectClass) { * @return A builder to continue building the Syntax. */ public Syntax.Builder buildSyntax(final Syntax syntax) { - return buildSyntax(syntax, true); - } - - private Syntax.Builder buildSyntax(final Syntax syntax, final boolean initialize) { - if (initialize) { - lazyInitBuilder(); - } + lazyInitBuilder(); return new Syntax.Builder(syntax, this); } @@ -1408,7 +1347,7 @@ public SchemaBuilder addObjectClass(final String definition, final boolean overw } ocBuilder.superiorObjectClasses(superiorClasses) .type(ocType); - return overwrite ? ocBuilder.addToSchemaOverwrite() : ocBuilder.addToSchema(); + return ocBuilder.addToSchema(overwrite); } } catch (final DecodeException e) { throw new LocalizedIllegalArgumentException( @@ -1437,15 +1376,10 @@ public SchemaBuilder addObjectClass(final String definition, final boolean overw public SchemaBuilder addPatternSyntax(final String oid, final String description, final Pattern pattern, final boolean overwrite) { Reject.ifNull(pattern); - - lazyInitBuilder(); - - final Syntax.Builder syntaxBuilder = buildSyntax(oid).description(description).extraProperties( - Collections.singletonMap("X-PATTERN", Collections.singletonList(pattern.toString()))); - - syntaxBuilder.addToSchema(overwrite); - - return this; + return buildSyntax(oid) + .description(description) + .extraProperties("X-PATTERN", pattern.toString()) + .addToSchema(overwrite); } /** @@ -1763,15 +1697,10 @@ public Promise apply(SearchResultEntry result) thr public SchemaBuilder addSubstitutionSyntax(final String oid, final String description, final String substituteSyntax, final boolean overwrite) { Reject.ifNull(substituteSyntax); - - lazyInitBuilder(); - - final Syntax.Builder syntaxBuilder = buildSyntax(oid).description(description).extraProperties( - Collections.singletonMap("X-SUBST", Collections.singletonList(substituteSyntax))); - - syntaxBuilder.addToSchema(overwrite); - - return this; + return buildSyntax(oid) + .description(description) + .extraProperties("X-SUBST", substituteSyntax) + .addToSchema(overwrite); } /** @@ -1858,23 +1787,6 @@ public SchemaBuilder addSyntax(final String definition, final boolean overwrite) } } - // See if it is a enum syntax - for (final Map.Entry> property : syntaxBuilder.getExtraProperties().entrySet()) { - if ("x-enum".equalsIgnoreCase(property.getKey())) { - final EnumSyntaxImpl enumImpl = new EnumSyntaxImpl(oid, property.getValue()); - syntaxBuilder.implementation(enumImpl); - syntaxBuilder.addToSchema(overwrite); - - buildMatchingRule(enumImpl.getOrderingMatchingRule()) - .names(OMR_GENERIC_ENUM_NAME + oid) - .syntaxOID(oid) - .extraProperties(CoreSchemaImpl.OPENDS_ORIGIN) - .implementation(new EnumOrderingMatchingRule(enumImpl)) - .addToSchemaOverwrite(); - return this; - } - } - syntaxBuilder.addToSchema(overwrite); } catch (final DecodeException e) { final LocalizableMessage msg = @@ -1893,19 +1805,19 @@ Options getOptions() { /** * Removes the named attribute type from this schema builder. * - * @param name + * @param nameOrOid * The name or OID of the attribute type to be removed. * @return {@code true} if the attribute type was found. */ - public boolean removeAttributeType(final String name) { + public boolean removeAttributeType(final String nameOrOid) { lazyInitBuilder(); - final AttributeType element = numericOID2AttributeTypes.get(name); + final AttributeType element = numericOID2AttributeTypes.get(nameOrOid); if (element != null) { removeAttributeType(element); return true; } - final List elements = name2AttributeTypes.get(toLowerCase(name)); + final List elements = name2AttributeTypes.get(toLowerCase(nameOrOid)); if (elements != null) { for (final AttributeType e : elements) { removeAttributeType(e); @@ -1918,19 +1830,19 @@ public boolean removeAttributeType(final String name) { /** * Removes the named DIT content rule from this schema builder. * - * @param name + * @param nameOrOid * The name or OID of the DIT content rule to be removed. * @return {@code true} if the DIT content rule was found. */ - public boolean removeDITContentRule(final String name) { + public boolean removeDITContentRule(final String nameOrOid) { lazyInitBuilder(); - final DITContentRule element = numericOID2ContentRules.get(name); + final DITContentRule element = numericOID2ContentRules.get(nameOrOid); if (element != null) { removeDITContentRule(element); return true; } - final List elements = name2ContentRules.get(toLowerCase(name)); + final List elements = name2ContentRules.get(toLowerCase(nameOrOid)); if (elements != null) { for (final DITContentRule e : elements) { removeDITContentRule(e); @@ -1961,19 +1873,19 @@ public boolean removeDITStructureRule(final int ruleID) { /** * Removes the named matching rule from this schema builder. * - * @param name + * @param nameOrOid * The name or OID of the matching rule to be removed. * @return {@code true} if the matching rule was found. */ - public boolean removeMatchingRule(final String name) { + public boolean removeMatchingRule(final String nameOrOid) { lazyInitBuilder(); - final MatchingRule element = numericOID2MatchingRules.get(name); + final MatchingRule element = numericOID2MatchingRules.get(nameOrOid); if (element != null) { removeMatchingRule(element); return true; } - final List elements = name2MatchingRules.get(toLowerCase(name)); + final List elements = name2MatchingRules.get(toLowerCase(nameOrOid)); if (elements != null) { for (final MatchingRule e : elements) { removeMatchingRule(e); @@ -1986,19 +1898,19 @@ public boolean removeMatchingRule(final String name) { /** * Removes the named matching rule use from this schema builder. * - * @param name + * @param nameOrOid * The name or OID of the matching rule use to be removed. * @return {@code true} if the matching rule use was found. */ - public boolean removeMatchingRuleUse(final String name) { + public boolean removeMatchingRuleUse(final String nameOrOid) { lazyInitBuilder(); - final MatchingRuleUse element = numericOID2MatchingRuleUses.get(name); + final MatchingRuleUse element = numericOID2MatchingRuleUses.get(nameOrOid); if (element != null) { removeMatchingRuleUse(element); return true; } - final List elements = name2MatchingRuleUses.get(toLowerCase(name)); + final List elements = name2MatchingRuleUses.get(toLowerCase(nameOrOid)); if (elements != null) { for (final MatchingRuleUse e : elements) { removeMatchingRuleUse(e); @@ -2011,19 +1923,19 @@ public boolean removeMatchingRuleUse(final String name) { /** * Removes the named name form from this schema builder. * - * @param name + * @param nameOrOid * The name or OID of the name form to be removed. * @return {@code true} if the name form was found. */ - public boolean removeNameForm(final String name) { + public boolean removeNameForm(final String nameOrOid) { lazyInitBuilder(); - final NameForm element = numericOID2NameForms.get(name); + final NameForm element = numericOID2NameForms.get(nameOrOid); if (element != null) { removeNameForm(element); return true; } - final List elements = name2NameForms.get(toLowerCase(name)); + final List elements = name2NameForms.get(toLowerCase(nameOrOid)); if (elements != null) { for (final NameForm e : elements) { removeNameForm(e); @@ -2036,19 +1948,19 @@ public boolean removeNameForm(final String name) { /** * Removes the named object class from this schema builder. * - * @param name + * @param nameOrOid * The name or OID of the object class to be removed. * @return {@code true} if the object class was found. */ - public boolean removeObjectClass(final String name) { + public boolean removeObjectClass(final String nameOrOid) { lazyInitBuilder(); - final ObjectClass element = numericOID2ObjectClasses.get(name); + final ObjectClass element = numericOID2ObjectClasses.get(nameOrOid); if (element != null) { removeObjectClass(element); return true; } - final List elements = name2ObjectClasses.get(toLowerCase(name)); + final List elements = name2ObjectClasses.get(toLowerCase(nameOrOid)); if (elements != null) { for (final ObjectClass e : elements) { removeObjectClass(e); @@ -2119,9 +2031,9 @@ public Schema toSchema() { final String localSchemaName; if (schemaName != null) { - localSchemaName = schemaName; + localSchemaName = schemaName + "-" + NEXT_SCHEMA_ID.getAndIncrement(); } else { - localSchemaName = String.format("Schema#%d", NEXT_SCHEMA_ID.getAndIncrement()); + localSchemaName = "Schema#" + NEXT_SCHEMA_ID.getAndIncrement(); } Syntax defaultSyntax = numericOID2Syntaxes.get(options.get(DEFAULT_SYNTAX_OID)); @@ -2380,43 +2292,35 @@ private void addSchema0(final Schema schema, final boolean overwrite) { // unlikely, may be different in the new schema. for (final Syntax syntax : schema.getSyntaxes()) { - if (overwrite) { - buildSyntax(syntax, false).addToSchemaOverwrite(); - } else { - buildSyntax(syntax, false).addToSchema(); - } + buildSyntax(syntax).addToSchema(overwrite); } for (final MatchingRule matchingRule : schema.getMatchingRules()) { - if (overwrite) { - buildMatchingRule(matchingRule, false).addToSchemaOverwrite(); - } else { - buildMatchingRule(matchingRule, false).addToSchema(); - } + buildMatchingRule(matchingRule).addToSchema(overwrite); } for (final MatchingRuleUse matchingRuleUse : schema.getMatchingRuleUses()) { - addMatchingRuleUse(matchingRuleUse, overwrite); + buildMatchingRuleUse(matchingRuleUse).addToSchema(overwrite); } for (final AttributeType attributeType : schema.getAttributeTypes()) { - addAttributeType(attributeType, overwrite); + buildAttributeType(attributeType).addToSchema(overwrite); } for (final ObjectClass objectClass : schema.getObjectClasses()) { - addObjectClass(objectClass, overwrite); + buildObjectClass(objectClass).addToSchema(overwrite); } for (final NameForm nameForm : schema.getNameForms()) { - addNameForm(nameForm, overwrite); + buildNameForm(nameForm).addToSchema(overwrite); } for (final DITContentRule contentRule : schema.getDITContentRules()) { - addDITContentRule(contentRule, overwrite); + buildDITContentRule(contentRule).addToSchema(overwrite); } for (final DITStructureRule structureRule : schema.getDITStuctureRules()) { - addDITStructureRule(structureRule, overwrite); + buildDITStructureRule(structureRule).addToSchema(overwrite); } } @@ -2463,13 +2367,13 @@ private void lazyInitBuilder() { nameForm2StructureRules = new HashMap<>(); name2OIDs = new HashMap<>(); warnings = new LinkedList<>(); - } - if (copyOnWriteSchema != null) { - // Copy the schema. - addSchema0(copyOnWriteSchema, true); - options = Options.copyOf(copyOnWriteSchema.getOptions()); - copyOnWriteSchema = null; + if (copyOnWriteSchema != null) { + // Copy the schema. + addSchema0(copyOnWriteSchema, true); + options = Options.copyOf(copyOnWriteSchema.getOptions()); + copyOnWriteSchema = null; + } } } @@ -2609,6 +2513,12 @@ private void removeObjectClass(final ObjectClass oc) { } private void removeSyntax(final Syntax syntax) { + for (Map.Entry> property : syntax.getExtraProperties().entrySet()) { + if ("x-enum".equalsIgnoreCase(property.getKey())) { + removeMatchingRule(OMR_OID_GENERIC_ENUM + "." + syntax.getOID()); + break; + } + } numericOID2Syntaxes.remove(syntax.getOID()); } @@ -2675,7 +2585,7 @@ private void validate(final Schema schema) { for (final MatchingRuleUse use : numericOID2MatchingRuleUses.values().toArray( new MatchingRuleUse[numericOID2MatchingRuleUses.values().size()])) { try { - use.validate(schema, warnings); + use.validate(schema); for (final String name : use.getNames()) { registerNameToOIDMapping(StaticUtils.toLowerCase(name), use.getMatchingRuleOID()); } @@ -2688,7 +2598,7 @@ private void validate(final Schema schema) { for (final NameForm form : numericOID2NameForms.values().toArray( new NameForm[numericOID2NameForms.values().size()])) { try { - form.validate(schema, warnings); + form.validate(schema); // build the objectClass2NameForms map final String ocOID = form.getStructuralClass().getOID(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java similarity index 51% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java index 09c25965a..c8c94113c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaConstants.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions Copyright 2014 Manuel Gaupp - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions Copyright 2014 Manuel Gaupp + * Portions Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -35,53 +25,32 @@ */ final class SchemaConstants { /** - * The IANA-assigned base OID for all things under the OpenDS umbrella. + * RFC 2251, Section 4.5.1: 'If the client does not want any attributes returned, + * it can specify a list containing only the attribute with OID "1.1". + * This OID was chosen arbitrarily and does not correspond to any attribute in use.' + * + * @see RFC 2251 for LDAP v3 */ + public static final String NO_ATTRIBUTES = "1.1"; + + /** The IANA-assigned base OID for all things under the OpenDS umbrella. */ public static final String OID_OPENDS_BASE = "1.3.6.1.4.1.26027"; - /** - * The base OID that will be used for the OpenDS Directory Server project. - */ + /** The base OID that will be used for the OpenDS Directory Server project. */ public static final String OID_OPENDS_SERVER_BASE = OID_OPENDS_BASE + ".1"; - /** - * The base OID that will be used for OpenDS Directory Server attribute type - * definitions. - */ - public static final String OID_OPENDS_SERVER_ATTRIBUTE_TYPE_BASE = OID_OPENDS_SERVER_BASE - + ".1"; - - /** - * The base OID that will be used for OpenDS Directory Server object class - * definitions. - */ + /** The base OID that will be used for OpenDS Directory Server attribute type definitions. */ + public static final String OID_OPENDS_SERVER_ATTRIBUTE_TYPE_BASE = OID_OPENDS_SERVER_BASE + ".1"; + /** The base OID that will be used for OpenDS Directory Server object class definitions. */ public static final String OID_OPENDS_SERVER_OBJECT_CLASS_BASE = OID_OPENDS_SERVER_BASE + ".2"; - - /** - * The base OID that will be used for OpenDS Directory Server attribute - * syntax definitions. - */ - public static final String OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE = OID_OPENDS_SERVER_BASE - + ".3"; - - /** - * The base OID that will be used for OpenDS Directory Server matching rule - * definitions. - */ + /** The base OID that will be used for OpenDS Directory Server attribute syntax definitions. */ + public static final String OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE = OID_OPENDS_SERVER_BASE + ".3"; + /** The base OID that will be used for OpenDS Directory Server matching rule definitions. */ public static final String OID_OPENDS_SERVER_MATCHING_RULE_BASE = OID_OPENDS_SERVER_BASE + ".4"; - - /** - * The base OID that will be used for OpenDS Directory Server control - * definitions. - */ + /** The base OID that will be used for OpenDS Directory Server control definitions. */ public static final String OID_OPENDS_SERVER_CONTROL_BASE = OID_OPENDS_SERVER_BASE + ".5"; - - /** - * The base OID that will be used for OpenDS Directory Server extended - * operation definitions. - */ - public static final String OID_OPENDS_SERVER_EXTENDED_OPERATION_BASE = OID_OPENDS_SERVER_BASE - + ".6"; + /** The base OID that will be used for OpenDS Directory Server extended operation definitions. */ + public static final String OID_OPENDS_SERVER_EXTENDED_OPERATION_BASE = OID_OPENDS_SERVER_BASE + ".6"; /** * The base OID that will be used for general-purpose (i.e., "other") types @@ -93,1365 +62,664 @@ final class SchemaConstants { * The base OID that will be used for temporary or experimental OIDs within * the OpenDS Directory Server. */ - public static final String OID_OPENDS_SERVER_EXPERIMENTAL_BASE = OID_OPENDS_SERVER_BASE - + ".999"; + public static final String OID_OPENDS_SERVER_EXPERIMENTAL_BASE = OID_OPENDS_SERVER_BASE + ".999"; - /** - * The description for the doubleMetaphoneApproximateMatch approximate - * matching rule. - */ + /** The description for the doubleMetaphoneApproximateMatch approximate matching rule. */ public static final String AMR_DOUBLE_METAPHONE_DESCRIPTION = "Double Metaphone Approximate Match"; - - /** - * The name for the doubleMetaphoneApproximateMatch approximate matching - * rule. - */ + /** The name for the doubleMetaphoneApproximateMatch approximate matching rule. */ public static final String AMR_DOUBLE_METAPHONE_NAME = "ds-mr-double-metaphone-approx"; + /** The OID for the doubleMetaphoneApproximateMatch approximate matching rule. */ + public static final String AMR_DOUBLE_METAPHONE_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".1"; - /** - * The OID for the doubleMetaphoneApproximateMatch approximate matching - * rule. - */ - public static final String AMR_DOUBLE_METAPHONE_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE - + ".1"; - - /** - * The description for the authPasswordExactMatch matching rule. - */ + /** The description for the authPasswordExactMatch matching rule. */ public static final String EMR_AUTH_PASSWORD_EXACT_DESCRIPTION = "authentication password exact matching rule"; - - /** - * The name for the authPasswordExactMatch equality matching rule. - */ + /** The name for the authPasswordExactMatch equality matching rule. */ public static final String EMR_AUTH_PASSWORD_EXACT_NAME = "authPasswordExactMatch"; - - /** - * The OID for the authPasswordExactMatch equality matching rule. - */ + /** The OID for the authPasswordExactMatch equality matching rule. */ public static final String EMR_AUTH_PASSWORD_EXACT_OID = "1.3.6.1.4.1.4203.1.2.2"; - - /** - * The description for the authPasswordMatch matching rule. - */ + /** The description for the authPasswordMatch matching rule. */ public static final String EMR_AUTH_PASSWORD_DESCRIPTION = "authentication password matching rule"; - /** - * The name for the authPasswordMatch equality matching rule. - */ + /** The name for the authPasswordMatch equality matching rule. */ public static final String EMR_AUTH_PASSWORD_NAME = "authPasswordMatch"; - - /** - * The OID for the authPasswordMatch equality matching rule. - */ + /** The OID for the authPasswordMatch equality matching rule. */ public static final String EMR_AUTH_PASSWORD_OID = "1.3.6.1.4.1.4203.1.2.3"; - /** - * The name for the bitStringMatch equality matching rule. - */ + /** The name for the bitStringMatch equality matching rule. */ public static final String EMR_BIT_STRING_NAME = "bitStringMatch"; - - /** - * The OID for the bitStringMatch equality matching rule. - */ + /** The OID for the bitStringMatch equality matching rule. */ public static final String EMR_BIT_STRING_OID = "2.5.13.16"; - /** - * The name for the booleanMatch equality matching rule. - */ + /** The name for the booleanMatch equality matching rule. */ public static final String EMR_BOOLEAN_NAME = "booleanMatch"; - - /** - * The OID for the booleanMatch equality matching rule. - */ + /** The OID for the booleanMatch equality matching rule. */ public static final String EMR_BOOLEAN_OID = "2.5.13.13"; - /** - * The name for the caseExactMatch equality matching rule. - */ + /** The name for the caseExactMatch equality matching rule. */ public static final String EMR_CASE_EXACT_NAME = "caseExactMatch"; - - /** - * The OID for the caseExactMatch equality matching rule. - */ + /** The OID for the caseExactMatch equality matching rule. */ public static final String EMR_CASE_EXACT_OID = "2.5.13.5"; - /** - * The name for the caseExactIA5Match equality matching rule. - */ + /** The name for the caseExactIA5Match equality matching rule. */ public static final String EMR_CASE_EXACT_IA5_NAME = "caseExactIA5Match"; - - /** - * The OID for the caseExactIA5Match equality matching rule. - */ + /** The OID for the caseExactIA5Match equality matching rule. */ public static final String EMR_CASE_EXACT_IA5_OID = "1.3.6.1.4.1.1466.109.114.1"; - /** - * The name for the caseIgnoreMatch equality matching rule. - */ + /** The name for the caseIgnoreMatch equality matching rule. */ public static final String EMR_CASE_IGNORE_NAME = "caseIgnoreMatch"; - - /** - * The OID for the caseIgnoreMatch equality matching rule. - */ + /** The OID for the caseIgnoreMatch equality matching rule. */ public static final String EMR_CASE_IGNORE_OID = "2.5.13.2"; - /** - * The name for the caseIgnoreIA5Match equality matching rule. - */ + /** The name for the caseIgnoreIA5Match equality matching rule. */ public static final String EMR_CASE_IGNORE_IA5_NAME = "caseIgnoreIA5Match"; - - /** - * The OID for the caseIgnoreIA5Match equality matching rule. - */ + /** The OID for the caseIgnoreIA5Match equality matching rule. */ public static final String EMR_CASE_IGNORE_IA5_OID = "1.3.6.1.4.1.1466.109.114.2"; - /** - * The name for the caseIgnoreListMatch equality matching rule. - */ + /** The name for the caseIgnoreListMatch equality matching rule. */ public static final String EMR_CASE_IGNORE_LIST_NAME = "caseIgnoreListMatch"; - - /** - * The OID for the caseIgnoreListMatch equality matching rule. - */ + /** The OID for the caseIgnoreListMatch equality matching rule. */ public static final String EMR_CASE_IGNORE_LIST_OID = "2.5.13.11"; - /** - * The name for the certificateExactMatch equality matching rule. - */ + /** The name for the certificateExactMatch equality matching rule. */ public static final String EMR_CERTIFICATE_EXACT_NAME = "certificateExactMatch"; - - /** - * The OID for the certificateExactMatch equality matching rule. - */ + /** The OID for the certificateExactMatch equality matching rule. */ public static final String EMR_CERTIFICATE_EXACT_OID = "2.5.13.34"; - /** - * The name for the directoryStringFirstComponentMatch equality matching - * rule. - */ + /** The name for the directoryStringFirstComponentMatch equality matching rule. */ public static final String EMR_DIRECTORY_STRING_FIRST_COMPONENT_NAME = "directoryStringFirstComponentMatch"; - - /** - * The OID for the directoryStringFirstComponentMatch equality matching - * rule. - */ + /** The OID for the directoryStringFirstComponentMatch equality matching rule. */ public static final String EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID = "2.5.13.31"; - /** - * The name for the distinguishedNameMatch equality matching rule. - */ + /** The name for the distinguishedNameMatch equality matching rule. */ public static final String EMR_DN_NAME = "distinguishedNameMatch"; - - /** - * The OID for the distinguishedNameMatch equality matching rule. - */ + /** The OID for the distinguishedNameMatch equality matching rule. */ public static final String EMR_DN_OID = "2.5.13.1"; - /** - * The name for the generalizedTimeMatch equality matching rule. - */ + /** The name for the generalizedTimeMatch equality matching rule. */ public static final String EMR_GENERALIZED_TIME_NAME = "generalizedTimeMatch"; - - /** - * The OID for the generalizedTimeMatch equality matching rule. - */ + /** The OID for the generalizedTimeMatch equality matching rule. */ public static final String EMR_GENERALIZED_TIME_OID = "2.5.13.27"; - /** - * The name for the integerMatch equality matching rule. - */ + /** The name for the integerMatch equality matching rule. */ public static final String EMR_INTEGER_NAME = "integerMatch"; - - /** - * The OID for the integerMatch equality matching rule. - */ + /** The OID for the integerMatch equality matching rule. */ public static final String EMR_INTEGER_OID = "2.5.13.14"; - /** - * The name for the integerFirstComponentMatch equality matching rule. - */ + /** The name for the integerFirstComponentMatch equality matching rule. */ public static final String EMR_INTEGER_FIRST_COMPONENT_NAME = "integerFirstComponentMatch"; - - /** - * The OID for the integerFirstComponentMatch equality matching rule. - */ + /** The OID for the integerFirstComponentMatch equality matching rule. */ public static final String EMR_INTEGER_FIRST_COMPONENT_OID = "2.5.13.29"; - /** - * The name for the keywordMatch equality matching rule. - */ + /** The name for the keywordMatch equality matching rule. */ public static final String EMR_KEYWORD_NAME = "keywordMatch"; - - /** - * The OID for the keywordMatch equality matching rule. - */ + /** The OID for the keywordMatch equality matching rule. */ public static final String EMR_KEYWORD_OID = "2.5.13.33"; - /** - * The name for the numericStringMatch equality matching rule. - */ + /** The name for the numericStringMatch equality matching rule. */ public static final String EMR_NUMERIC_STRING_NAME = "numericStringMatch"; - - /** - * The OID for the numericStringMatch equality matching rule. - */ + /** The OID for the numericStringMatch equality matching rule. */ public static final String EMR_NUMERIC_STRING_OID = "2.5.13.8"; - /** - * The name for the octetStringMatch equality matching rule. - */ + /** The name for the octetStringMatch equality matching rule. */ public static final String EMR_OCTET_STRING_NAME = "octetStringMatch"; - - /** - * The OID for the octetStringMatch equality matching rule. - */ + /** The OID for the octetStringMatch equality matching rule. */ public static final String EMR_OCTET_STRING_OID = "2.5.13.17"; - /** - * The name for the objectIdentifierMatch equality matching rule. - */ + /** The name for the objectIdentifierMatch equality matching rule. */ public static final String EMR_OID_NAME = "objectIdentifierMatch"; - - /** - * The OID for the objectIdentifierMatch equality matching rule. - */ + /** The OID for the objectIdentifierMatch equality matching rule. */ public static final String EMR_OID_OID = "2.5.13.0"; - /** - * The name for the objectIdentifierFirstComponentMatch equality matching - * rule. - */ + /** The name for the objectIdentifierFirstComponentMatch equality matching rule. */ public static final String EMR_OID_FIRST_COMPONENT_NAME = "objectIdentifierFirstComponentMatch"; - - /** - * The OID for the objectIdentifierFirstComponentMatch equality matching - * rule. - */ + /** The OID for the objectIdentifierFirstComponentMatch equality matching rule. */ public static final String EMR_OID_FIRST_COMPONENT_OID = "2.5.13.30"; - /** - * The name for the presentationAddressMatch equality matching rule. - */ + /** The name for the presentationAddressMatch equality matching rule. */ public static final String EMR_PRESENTATION_ADDRESS_NAME = "presentationAddressMatch"; - - /** - * The OID for the presentationAddressMatch equality matching rule. - */ + /** The OID for the presentationAddressMatch equality matching rule. */ public static final String EMR_PRESENTATION_ADDRESS_OID = "2.5.13.22"; - /** - * The name for the protocolInformationMatch equality matching rule. - */ + /** The name for the protocolInformationMatch equality matching rule. */ public static final String EMR_PROTOCOL_INFORMATION_NAME = "protocolInformationMatch"; - - /** - * The OID for the protocolInformationMatch equality matching rule. - */ + /** The OID for the protocolInformationMatch equality matching rule. */ public static final String EMR_PROTOCOL_INFORMATION_OID = "2.5.13.24"; - /** - * The name for the telephoneNumberMatch equality matching rule. - */ + /** The name for the telephoneNumberMatch equality matching rule. */ public static final String EMR_TELEPHONE_NAME = "telephoneNumberMatch"; - - /** - * The OID for the telephoneNumberMatch equality matching rule. - */ + /** The OID for the telephoneNumberMatch equality matching rule. */ public static final String EMR_TELEPHONE_OID = "2.5.13.20"; - /** - * The name for the uniqueMemberMatch equality matching rule. - */ + /** The name for the uniqueMemberMatch equality matching rule. */ public static final String EMR_UNIQUE_MEMBER_NAME = "uniqueMemberMatch"; - - /** - * The OID for the uniqueMemberMatch equality matching rule. - */ + /** The OID for the uniqueMemberMatch equality matching rule. */ public static final String EMR_UNIQUE_MEMBER_OID = "2.5.13.23"; - /** - * The description for the userPasswordExactMatch matching rule. - */ + /** The description for the userPasswordExactMatch matching rule. */ public static final String EMR_USER_PASSWORD_EXACT_DESCRIPTION = "user password exact matching rule"; - - /** - * The name for the userPasswordExactMatch equality matching rule. - */ + /** The name for the userPasswordExactMatch equality matching rule. */ public static final String EMR_USER_PASSWORD_EXACT_NAME = "ds-mr-user-password-exact"; + /** The OID for the userPasswordExactMatch equality matching rule. */ + public static final String EMR_USER_PASSWORD_EXACT_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".2"; - /** - * The OID for the userPasswordExactMatch equality matching rule. - */ - public static final String EMR_USER_PASSWORD_EXACT_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE - + ".2"; - - /** - * The description for the userPasswordMatch matching rule. - */ + /** The description for the userPasswordMatch matching rule. */ public static final String EMR_USER_PASSWORD_DESCRIPTION = "user password matching rule"; - - /** - * The name for the userPasswordMatch equality matching rule. - */ + /** The name for the userPasswordMatch equality matching rule. */ public static final String EMR_USER_PASSWORD_NAME = "ds-mr-user-password-equality"; - - /** - * The OID for the userPasswordMatch equality matching rule. - */ + /** The OID for the userPasswordMatch equality matching rule. */ public static final String EMR_USER_PASSWORD_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".3"; - /** - * The name for the uuidMatch equality matching rule. - */ + /** The name for the uuidMatch equality matching rule. */ public static final String EMR_UUID_NAME = "uuidMatch"; - - /** - * The OID for the uuidMatch equality matching rule. - */ + /** The OID for the uuidMatch equality matching rule. */ public static final String EMR_UUID_OID = "1.3.6.1.1.16.2"; - /** - * The name for the wordMatch equality matching rule. - */ + /** The name for the wordMatch equality matching rule. */ public static final String EMR_WORD_NAME = "wordMatch"; - - /** - * The OID for the wordMatch equality matching rule. - */ + /** The OID for the wordMatch equality matching rule. */ public static final String EMR_WORD_OID = "2.5.13.32"; - /** - * The Description for the partialDateAndTimeMatchingRule ordering matching rule. - */ + /** The Description for the partialDateAndTimeMatchingRule ordering matching rule. */ public static final String MR_PARTIAL_DATE_AND_TIME_DESCRIPTION = "partial date and time matching"; - - /** - * The Name for the partialDateAndTimeMatchingRule ordering matching rule. - */ + /** The Name for the partialDateAndTimeMatchingRule ordering matching rule. */ public static final String MR_PARTIAL_DATE_AND_TIME_NAME = "partialDateAndTimeMatchingRule"; - - /** - * The OID for the partialDateAndTimeMatchingRule ordering matching rule. - */ + /** The OID for the partialDateAndTimeMatchingRule ordering matching rule. */ public static final String MR_PARTIAL_DATE_AND_TIME_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".7"; - /** - * The name for the caseExactOrderingMatch ordering matching rule. - */ + /** The name for the caseExactOrderingMatch ordering matching rule. */ public static final String OMR_CASE_EXACT_NAME = "caseExactOrderingMatch"; - - /** - * The OID for the caseExactOrderingMatch ordering matching rule. - */ + /** The OID for the caseExactOrderingMatch ordering matching rule. */ public static final String OMR_CASE_EXACT_OID = "2.5.13.6"; - /** - * The name for the caseIgnoreOrderingMatch ordering matching rule. - */ + /** The name for the caseIgnoreOrderingMatch ordering matching rule. */ public static final String OMR_CASE_IGNORE_NAME = "caseIgnoreOrderingMatch"; - - /** - * The OID for the caseIgnoreOrderingMatch ordering matching rule. - */ + /** The OID for the caseIgnoreOrderingMatch ordering matching rule. */ public static final String OMR_CASE_IGNORE_OID = "2.5.13.3"; - /** - * The name for the generalizedTimeOrderingMatch ordering matching rule. - */ + /** The name for the generalizedTimeOrderingMatch ordering matching rule. */ public static final String OMR_GENERALIZED_TIME_NAME = "generalizedTimeOrderingMatch"; - - /** - * The OID for the generalizedTimeOrderingMatch ordering matching rule. - */ + /** The OID for the generalizedTimeOrderingMatch ordering matching rule. */ public static final String OMR_GENERALIZED_TIME_OID = "2.5.13.28"; - /** - * The name for the integerOrderingMatch ordering matching rule. - */ + /** The name for the integerOrderingMatch ordering matching rule. */ public static final String OMR_INTEGER_NAME = "integerOrderingMatch"; - - /** - * The OID for the integerOrderingMatch ordering matching rule. - */ + /** The OID for the integerOrderingMatch ordering matching rule. */ public static final String OMR_INTEGER_OID = "2.5.13.15"; - /** - * The name for the numericStringOrderingMatch ordering matching rule. - */ + /** The name for the numericStringOrderingMatch ordering matching rule. */ public static final String OMR_NUMERIC_STRING_NAME = "numericStringOrderingMatch"; - - /** - * The OID for the numericStringOrderingMatch ordering matching rule. - */ + /** The OID for the numericStringOrderingMatch ordering matching rule. */ public static final String OMR_NUMERIC_STRING_OID = "2.5.13.9"; - /** - * The name for the octetStringOrderingMatch ordering matching rule. - */ + /** The name for the octetStringOrderingMatch ordering matching rule. */ public static final String OMR_OCTET_STRING_NAME = "octetStringOrderingMatch"; - - /** - * The OID for the octetStringOrderingMatch ordering matching rule. - */ + /** The OID for the octetStringOrderingMatch ordering matching rule. */ public static final String OMR_OCTET_STRING_OID = "2.5.13.18"; - /** - * The Description for the relativeTimeGreaterThan ordering matching rule. - */ + /** The Description for the relativeTimeGreaterThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_GREATER_THAN_DESCRIPTION = "greater-than relative time for time-based searches"; - - /** - * The Name for the relativeTimeGreaterThan ordering matching rule. - */ + /** The Name for the relativeTimeGreaterThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_GREATER_THAN_NAME = "relativeTimeGTOrderingMatch"; - - /** - * The alternative name for the relativeTimeGreaterThan ordering matching rule. - */ + /** The alternative name for the relativeTimeGreaterThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_GREATER_THAN_ALT_NAME = "relativeTimeOrderingMatch.gt"; - - /** - * The OID for the relativeTimeGreaterThan ordering matching rule. - */ + /** The OID for the relativeTimeGreaterThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_GREATER_THAN_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".5"; - /** - * The Description for the relativeTimeLessThan ordering matching rule. - */ + /** The Description for the relativeTimeLessThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_LESS_THAN_DESCRIPTION = "less-than relative time for time-based searches"; - - /** - * The Name for the relativeTimeLessThan ordering matching rule. - */ + /** The Name for the relativeTimeLessThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_LESS_THAN_NAME = "relativeTimeLTOrderingMatch"; - - /** - * The alternative name for the relativeTimeLessThan ordering matching rule. - */ + /** The alternative name for the relativeTimeLessThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_LESS_THAN_ALT_NAME = "relativeTimeOrderingMatch.lt"; - - /** - * The OID for the relativeTimeLessThan ordering matching rule. - */ + /** The OID for the relativeTimeLessThan ordering matching rule. */ public static final String OMR_RELATIVE_TIME_LESS_THAN_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".6"; - /** - * The name for the uuidOrderingMatch ordering matching rule. - */ + /** The name for the uuidOrderingMatch ordering matching rule. */ public static final String OMR_UUID_NAME = "uuidOrderingMatch"; - - /** - * The OID for the uuidOrderingMatch ordering matching rule. - */ + /** The OID for the uuidOrderingMatch ordering matching rule. */ public static final String OMR_UUID_OID = "1.3.6.1.1.16.3"; - /** - * The name for the enumOrderingMatch ordering matching rule. - */ + /** The name for the enumOrderingMatch ordering matching rule. */ public static final String OMR_GENERIC_ENUM_NAME = "enumOrderingMatch"; - - /** - * The oid for the generic enum syntax ordering matching rule. - */ + /** The oid for the generic enum syntax ordering matching rule. */ public static final String OMR_OID_GENERIC_ENUM = "1.3.6.1.4.1.26027.1.4.8"; - /** - * The name for the caseExactSubstringsMatch substring matching rule. - */ + /** The name for the caseExactSubstringsMatch substring matching rule. */ public static final String SMR_CASE_EXACT_NAME = "caseExactSubstringsMatch"; + /** The OID for the caseExactSubstringsMatch substring matching rule. */ + public static final String SMR_CASE_EXACT_OID = "2.5.13.7"; - /** - * The OID for the caseExactSubstringsMatch substring matching rule. - */ - public static final String SMR_CASE_EXACT_OID = "2.5.13.7"; - - /** - * The name for the caseExactIA5SubstringsMatch substring matching rule. - */ + /** The name for the caseExactIA5SubstringsMatch substring matching rule. */ public static final String SMR_CASE_EXACT_IA5_NAME = "caseExactIA5SubstringsMatch"; - /** * The OID for the caseExactIA5SubstringsMatch substring matching rule. // * FIXME -- This needs to be updated once a real OID is assigned. */ - public static final String SMR_CASE_EXACT_IA5_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE - + ".902"; + public static final String SMR_CASE_EXACT_IA5_OID = OID_OPENDS_SERVER_MATCHING_RULE_BASE + ".902"; - /** - * The name for the caseIgnoreSubstringsMatch substring matching rule. - */ + /** The name for the caseIgnoreSubstringsMatch substring matching rule. */ public static final String SMR_CASE_IGNORE_NAME = "caseIgnoreSubstringsMatch"; - - /** - * The OID for the caseIgnoreSubstringsMatch substring matching rule. - */ + /** The OID for the caseIgnoreSubstringsMatch substring matching rule. */ public static final String SMR_CASE_IGNORE_OID = "2.5.13.4"; - /** - * The name for the caseIgnoreIA5SubstringsMatch substring matching rule. - */ + /** The name for the caseIgnoreIA5SubstringsMatch substring matching rule. */ public static final String SMR_CASE_IGNORE_IA5_NAME = "caseIgnoreIA5SubstringsMatch"; - - /** - * The OID for the caseIgnoreIA5SubstringsMatch substring matching rule. - */ + /** The OID for the caseIgnoreIA5SubstringsMatch substring matching rule. */ public static final String SMR_CASE_IGNORE_IA5_OID = "1.3.6.1.4.1.1466.109.114.3"; - /** - * The name for the caseIgnoreListSubstringsMatch substring matching rule. - */ + /** The name for the caseIgnoreListSubstringsMatch substring matching rule. */ public static final String SMR_CASE_IGNORE_LIST_NAME = "caseIgnoreListSubstringsMatch"; - - /** - * The OID for the caseIgnoreListSubstringsMatch substring matching rule. - */ + /** The OID for the caseIgnoreListSubstringsMatch substring matching rule. */ public static final String SMR_CASE_IGNORE_LIST_OID = "2.5.13.12"; - /** - * The name for the numericStringSubstringsMatch substring matching rule. - */ + /** The name for the numericStringSubstringsMatch substring matching rule. */ public static final String SMR_NUMERIC_STRING_NAME = "numericStringSubstringsMatch"; - - /** - * The OID for the numericStringSubstringsMatch substring matching rule. - */ + /** The OID for the numericStringSubstringsMatch substring matching rule. */ public static final String SMR_NUMERIC_STRING_OID = "2.5.13.10"; - /** - * The name for the octetStringSubstringsMatch substring matching rule. - */ + /** The name for the octetStringSubstringsMatch substring matching rule. */ public static final String SMR_OCTET_STRING_NAME = "octetStringSubstringsMatch"; - - /** - * The OID for the octetStringSubstringsMatch substring matching rule. - */ + /** The OID for the octetStringSubstringsMatch substring matching rule. */ public static final String SMR_OCTET_STRING_OID = "2.5.13.19"; - /** - * The name for the telephoneNumberSubstringsMatch substring matching rule. - */ + /** The name for the telephoneNumberSubstringsMatch substring matching rule. */ public static final String SMR_TELEPHONE_NAME = "telephoneNumberSubstringsMatch"; - - /** - * The OID for the telephoneNumberSubstringsMatch substring matching rule. - */ + /** The OID for the telephoneNumberSubstringsMatch substring matching rule. */ public static final String SMR_TELEPHONE_OID = "2.5.13.21"; - /** - * The OID for the absolute subtree specification attribute syntax. - */ + /** The OID for the absolute subtree specification attribute syntax. */ public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".3"; - - /** - * The description for the absolute subtree specification attribute syntax. - */ + /** The description for the absolute subtree specification attribute syntax. */ public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_DESCRIPTION = "Absolute Subtree Specification"; - - /** - * The name for the absolute subtree specification attribute syntax. - */ + /** The name for the absolute subtree specification attribute syntax. */ public static final String SYNTAX_ABSOLUTE_SUBTREE_SPECIFICATION_NAME = "ds-absolute-subtree-specification"; - /** - * The OID for the aci attribute syntax. - */ + /** The OID for the aci attribute syntax. */ public static final String SYNTAX_ACI_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".4"; - - /** - * The description for aci attribute syntax. - */ + /** The description for aci attribute syntax. */ public static final String SYNTAX_ACI_DESCRIPTION = "Sun-defined Access Control Information"; - - /** - * The name for the aci attribute syntax. - */ + /** The name for the aci attribute syntax. */ public static final String SYNTAX_ACI_NAME = "ds-syntax-dseecompat-aci"; - /** - * The description for the attribute type description attribute syntax. - */ + /** The description for the attribute type description attribute syntax. */ public static final String SYNTAX_ATTRIBUTE_TYPE_DESCRIPTION = "Attribute Type Description"; - - /** - * The name for the attribute type description attribute syntax. - */ + /** The name for the attribute type description attribute syntax. */ public static final String SYNTAX_ATTRIBUTE_TYPE_NAME = "AttributeTypeDescription"; - - /** - * The OID for the attribute type description attribute syntax. - */ + /** The OID for the attribute type description attribute syntax. */ public static final String SYNTAX_ATTRIBUTE_TYPE_OID = "1.3.6.1.4.1.1466.115.121.1.3"; - /** - * The description for the auth password attribute syntax. - */ + /** The description for the auth password attribute syntax. */ public static final String SYNTAX_AUTH_PASSWORD_DESCRIPTION = "Authentication Password Syntax"; - - /** - * The name for the auth password attribute syntax. - */ + /** The name for the auth password attribute syntax. */ public static final String SYNTAX_AUTH_PASSWORD_NAME = "AuthenticationPasswordSyntax"; - - /** - * The OID for the auth password attribute syntax. - */ + /** The OID for the auth password attribute syntax. */ public static final String SYNTAX_AUTH_PASSWORD_OID = "1.3.6.1.4.1.4203.1.1.2"; - /** - * The description for the binary attribute syntax. - */ + /** The description for the binary attribute syntax. */ public static final String SYNTAX_BINARY_DESCRIPTION = "Binary"; - - /** - * The name for the binary attribute syntax. - */ + /** The name for the binary attribute syntax. */ public static final String SYNTAX_BINARY_NAME = "Binary"; - - /** - * The OID for the binary attribute syntax. - */ + /** The OID for the binary attribute syntax. */ public static final String SYNTAX_BINARY_OID = "1.3.6.1.4.1.1466.115.121.1.5"; - /** - * The description for the bit string attribute syntax. - */ + /** The description for the bit string attribute syntax. */ public static final String SYNTAX_BIT_STRING_DESCRIPTION = "Bit String"; - - /** - * The name for the bit string attribute syntax. - */ + /** The name for the bit string attribute syntax. */ public static final String SYNTAX_BIT_STRING_NAME = "BitString"; - - /** - * The OID for the bit string attribute syntax. - */ + /** The OID for the bit string attribute syntax. */ public static final String SYNTAX_BIT_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.6"; - /** - * The description for the Boolean attribute syntax. - */ + /** The description for the Boolean attribute syntax. */ public static final String SYNTAX_BOOLEAN_DESCRIPTION = "Boolean"; - - /** - * The name for the Boolean attribute syntax. - */ + /** The name for the Boolean attribute syntax. */ public static final String SYNTAX_BOOLEAN_NAME = "Boolean"; - - /** - * The OID for the Boolean attribute syntax. - */ + /** The OID for the Boolean attribute syntax. */ public static final String SYNTAX_BOOLEAN_OID = "1.3.6.1.4.1.1466.115.121.1.7"; - /** - * The description for the certificate attribute syntax. - */ + /** The description for the certificate attribute syntax. */ public static final String SYNTAX_CERTIFICATE_DESCRIPTION = "Certificate"; - - /** - * The name for the certificate attribute syntax. - */ + /** The name for the certificate attribute syntax. */ public static final String SYNTAX_CERTIFICATE_NAME = "Certificate"; - - /** - * The OID for the certificate attribute syntax. - */ + /** The OID for the certificate attribute syntax. */ public static final String SYNTAX_CERTIFICATE_OID = "1.3.6.1.4.1.1466.115.121.1.8"; - /** - * The description for the certificate exact assertion attribute syntax. - */ + /** The description for the certificate exact assertion attribute syntax. */ public static final String SYNTAX_CERTIFICATE_EXACT_ASSERTION_DESCRIPTION = "X.509 Certificate Exact Assertion"; - - /** - * The name for the certificate exact assertion attribute syntax. - */ + /** The name for the certificate exact assertion attribute syntax. */ public static final String SYNTAX_CERTIFICATE_EXACT_ASSERTION_NAME = "CertificateExactAssertion"; - /** * The OID for the Certificate Exact Assertion syntax used for assertion * values in extensible match filters. */ public static final String SYNTAX_CERTIFICATE_EXACT_ASSERTION_OID = "1.3.6.1.1.15.1"; - /** - * The description for the certificate list attribute syntax. - */ + /** The description for the certificate list attribute syntax. */ public static final String SYNTAX_CERTLIST_DESCRIPTION = "Certificate List"; - - /** - * The name for the certificate list attribute syntax. - */ + /** The name for the certificate list attribute syntax. */ public static final String SYNTAX_CERTLIST_NAME = "CertificateList"; - - /** - * The OID for the certificate list attribute syntax. - */ + /** The OID for the certificate list attribute syntax. */ public static final String SYNTAX_CERTLIST_OID = "1.3.6.1.4.1.1466.115.121.1.9"; - /** - * The description for the certificate pair attribute syntax. - */ + /** The description for the certificate pair attribute syntax. */ public static final String SYNTAX_CERTPAIR_DESCRIPTION = "Certificate Pair"; - - /** - * The name for the certificate pair attribute syntax. - */ + /** The name for the certificate pair attribute syntax. */ public static final String SYNTAX_CERTPAIR_NAME = "CertificatePair"; - - /** - * The OID for the certificate pair attribute syntax. - */ + /** The OID for the certificate pair attribute syntax. */ public static final String SYNTAX_CERTPAIR_OID = "1.3.6.1.4.1.1466.115.121.1.10"; - /** - * The description for the country string attribute syntax. - */ + /** The description for the country string attribute syntax. */ public static final String SYNTAX_COUNTRY_STRING_DESCRIPTION = "Country String"; - - /** - * The name for the country string attribute syntax. - */ + /** The name for the country string attribute syntax. */ public static final String SYNTAX_COUNTRY_STRING_NAME = "CountryString"; - - /** - * The OID for the country string attribute syntax. - */ + /** The OID for the country string attribute syntax. */ public static final String SYNTAX_COUNTRY_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.11"; - /** - * The description for the delivery method attribute syntax. - */ + /** The description for the delivery method attribute syntax. */ public static final String SYNTAX_DELIVERY_METHOD_DESCRIPTION = "Delivery Method"; - - /** - * The name for the delivery method attribute syntax. - */ + /** The name for the delivery method attribute syntax. */ public static final String SYNTAX_DELIVERY_METHOD_NAME = "DeliveryMethod"; - - /** - * The OID for the delivery method attribute syntax. - */ + /** The OID for the delivery method attribute syntax. */ public static final String SYNTAX_DELIVERY_METHOD_OID = "1.3.6.1.4.1.1466.115.121.1.14"; - /** - * The description for the Directory String attribute syntax. - */ + /** The description for the Directory String attribute syntax. */ public static final String SYNTAX_DIRECTORY_STRING_DESCRIPTION = "Directory String"; - - /** - * The name for the Directory String attribute syntax. - */ + /** The name for the Directory String attribute syntax. */ public static final String SYNTAX_DIRECTORY_STRING_NAME = "DirectoryString"; - - /** - * The OID for the Directory String attribute syntax. - */ + /** The OID for the Directory String attribute syntax. */ public static final String SYNTAX_DIRECTORY_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.15"; - /** - * The description for the DIT content rule description attribute syntax. - */ + /** The description for the DIT content rule description attribute syntax. */ public static final String SYNTAX_DIT_CONTENT_RULE_DESCRIPTION = "DIT Content Rule Description"; - - /** - * The name for the DIT content rule description attribute syntax. - */ + /** The name for the DIT content rule description attribute syntax. */ public static final String SYNTAX_DIT_CONTENT_RULE_NAME = "DITContentRuleDescription"; - - /** - * The OID for the DIT content rule description attribute syntax. - */ + /** The OID for the DIT content rule description attribute syntax. */ public static final String SYNTAX_DIT_CONTENT_RULE_OID = "1.3.6.1.4.1.1466.115.121.1.16"; - /** - * The description for the DIT structure rule description attribute syntax. - */ + /** The description for the DIT structure rule description attribute syntax. */ public static final String SYNTAX_DIT_STRUCTURE_RULE_DESCRIPTION = "DIT Structure Rule Description"; - - /** - * The name for the DIT structure rule description attribute syntax. - */ + /** The name for the DIT structure rule description attribute syntax. */ public static final String SYNTAX_DIT_STRUCTURE_RULE_NAME = "DITStructureRuleDescription"; - - /** - * The OID for the DIT structure rule description attribute syntax. - */ + /** The OID for the DIT structure rule description attribute syntax. */ public static final String SYNTAX_DIT_STRUCTURE_RULE_OID = "1.3.6.1.4.1.1466.115.121.1.17"; - /** - * The description for the distinguished name attribute syntax. - */ + /** The description for the distinguished name attribute syntax. */ public static final String SYNTAX_DN_DESCRIPTION = "DN"; - - /** - * The name for the distinguished name attribute syntax. - */ + /** The name for the distinguished name attribute syntax. */ public static final String SYNTAX_DN_NAME = "DN"; - - /** - * The OID for the distinguished name attribute syntax. - */ + /** The OID for the distinguished name attribute syntax. */ public static final String SYNTAX_DN_OID = "1.3.6.1.4.1.1466.115.121.1.12"; - /** - * The description for the enhanced guide attribute syntax. - */ + /** The description for the enhanced guide attribute syntax. */ public static final String SYNTAX_ENHANCED_GUIDE_DESCRIPTION = "Enhanced Guide"; - - /** - * The name for the enhanced guide attribute syntax. - */ + /** The name for the enhanced guide attribute syntax. */ public static final String SYNTAX_ENHANCED_GUIDE_NAME = "EnhancedGuide"; - - /** - * The OID for the enhanced guide attribute syntax. - */ + /** The OID for the enhanced guide attribute syntax. */ public static final String SYNTAX_ENHANCED_GUIDE_OID = "1.3.6.1.4.1.1466.115.121.1.21"; - /** - * The description for the facsimile telephone number attribute syntax. - */ + /** The description for the facsimile telephone number attribute syntax. */ public static final String SYNTAX_FAXNUMBER_DESCRIPTION = "Facsimile Telephone Number"; - - /** - * The name for the facsimile telephone number attribute syntax. - */ + /** The name for the facsimile telephone number attribute syntax. */ public static final String SYNTAX_FAXNUMBER_NAME = "FacsimileTelephoneNumber"; - - /** - * The OID for the facsimile telephone number attribute syntax. - */ + /** The OID for the facsimile telephone number attribute syntax. */ public static final String SYNTAX_FAXNUMBER_OID = "1.3.6.1.4.1.1466.115.121.1.22"; - /** - * The description for the fax attribute syntax. - */ + /** The description for the fax attribute syntax. */ public static final String SYNTAX_FAX_DESCRIPTION = "Fax"; - - /** - * The name for the fax attribute syntax. - */ + /** The name for the fax attribute syntax. */ public static final String SYNTAX_FAX_NAME = "Fax"; - - /** - * The OID for the fax attribute syntax. - */ + /** The OID for the fax attribute syntax. */ public static final String SYNTAX_FAX_OID = "1.3.6.1.4.1.1466.115.121.1.23"; - /** - * The description for the generalized time attribute syntax. - */ + /** The description for the generalized time attribute syntax. */ public static final String SYNTAX_GENERALIZED_TIME_DESCRIPTION = "Generalized Time"; - - /** - * The name for the generalized time attribute syntax. - */ + /** The name for the generalized time attribute syntax. */ public static final String SYNTAX_GENERALIZED_TIME_NAME = "GeneralizedTime"; - - /** - * The OID for the generalized time attribute syntax. - */ + /** The OID for the generalized time attribute syntax. */ public static final String SYNTAX_GENERALIZED_TIME_OID = "1.3.6.1.4.1.1466.115.121.1.24"; - /** - * The description for the guide attribute syntax. - */ + /** The description for the guide attribute syntax. */ public static final String SYNTAX_GUIDE_DESCRIPTION = "Guide"; - - /** - * The name for the guide attribute syntax. - */ + /** The name for the guide attribute syntax. */ public static final String SYNTAX_GUIDE_NAME = "Guide"; - - /** - * The OID for the guide attribute syntax. - */ + /** The OID for the guide attribute syntax. */ public static final String SYNTAX_GUIDE_OID = "1.3.6.1.4.1.1466.115.121.1.25"; - /** - * The description for the IA5 string attribute syntax. - */ + /** The description for the IA5 string attribute syntax. */ public static final String SYNTAX_IA5_STRING_DESCRIPTION = "IA5 String"; - - /** - * The name for the IA5 string attribute syntax. - */ + /** The name for the IA5 string attribute syntax. */ public static final String SYNTAX_IA5_STRING_NAME = "IA5String"; - - /** - * The OID for the IA5 string attribute syntax. - */ + /** The OID for the IA5 string attribute syntax. */ public static final String SYNTAX_IA5_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.26"; - /** - * The description for the integer attribute syntax. - */ + /** The description for the integer attribute syntax. */ public static final String SYNTAX_INTEGER_DESCRIPTION = "Integer"; - - /** - * The name for the integer attribute syntax. - */ + /** The name for the integer attribute syntax. */ public static final String SYNTAX_INTEGER_NAME = "Integer"; - - /** - * The OID for the integer attribute syntax. - */ + /** The OID for the integer attribute syntax. */ public static final String SYNTAX_INTEGER_OID = "1.3.6.1.4.1.1466.115.121.1.27"; - /** - * The description for the JPEG attribute syntax. - */ + /** The description for the JPEG attribute syntax. */ public static final String SYNTAX_JPEG_DESCRIPTION = "JPEG"; - - /** - * The name for the JPEG attribute syntax. - */ + /** The name for the JPEG attribute syntax. */ public static final String SYNTAX_JPEG_NAME = "JPEG"; - - /** - * The OID for the JPEG attribute syntax. - */ + /** The OID for the JPEG attribute syntax. */ public static final String SYNTAX_JPEG_OID = "1.3.6.1.4.1.1466.115.121.1.28"; - /** - * The description for the LDAP syntax description attribute syntax. - */ + /** The description for the LDAP syntax description attribute syntax. */ public static final String SYNTAX_LDAP_SYNTAX_DESCRIPTION = "LDAP Syntax Description"; - - /** - * The name for the LDAP syntax description attribute syntax. - */ + /** The name for the LDAP syntax description attribute syntax. */ public static final String SYNTAX_LDAP_SYNTAX_NAME = "LDAPSyntaxDescription"; - - /** - * The OID for the LDAP syntax description attribute syntax. - */ + /** The OID for the LDAP syntax description attribute syntax. */ public static final String SYNTAX_LDAP_SYNTAX_OID = "1.3.6.1.4.1.1466.115.121.1.54"; - /** - * The description for the matching rule description attribute syntax. - */ + /** The description for the matching rule description attribute syntax. */ public static final String SYNTAX_MATCHING_RULE_DESCRIPTION = "Matching Rule Description"; - - /** - * The name for the matching rule description attribute syntax. - */ + /** The name for the matching rule description attribute syntax. */ public static final String SYNTAX_MATCHING_RULE_NAME = "MatchingRuleDescription"; - - /** - * The OID for the matching rule description attribute syntax. - */ + /** The OID for the matching rule description attribute syntax. */ public static final String SYNTAX_MATCHING_RULE_OID = "1.3.6.1.4.1.1466.115.121.1.30"; - /** - * The description for the matching rule use description attribute syntax. - */ + /** The description for the matching rule use description attribute syntax. */ public static final String SYNTAX_MATCHING_RULE_USE_DESCRIPTION = "Matching Rule Use Description"; - - /** - * The name for the matching rule use description attribute syntax. - */ + /** The name for the matching rule use description attribute syntax. */ public static final String SYNTAX_MATCHING_RULE_USE_NAME = "MatchingRuleUseDescription"; - - /** - * The OID for the matching rule use description attribute syntax. - */ + /** The OID for the matching rule use description attribute syntax. */ public static final String SYNTAX_MATCHING_RULE_USE_OID = "1.3.6.1.4.1.1466.115.121.1.31"; - /** - * The description for the name and optional uid attribute syntax. - */ + /** The description for the name and optional uid attribute syntax. */ public static final String SYNTAX_NAME_AND_OPTIONAL_UID_DESCRIPTION = "Name and Optional UID"; - - /** - * The name for the name and optional uid attribute syntax. - */ + /** The name for the name and optional uid attribute syntax. */ public static final String SYNTAX_NAME_AND_OPTIONAL_UID_NAME = "NameAndOptionalUID"; - - /** - * The OID for the name and optional uid attribute syntax. - */ + /** The OID for the name and optional uid attribute syntax. */ public static final String SYNTAX_NAME_AND_OPTIONAL_UID_OID = "1.3.6.1.4.1.1466.115.121.1.34"; - /** - * The description for the name form description attribute syntax. - */ + /** The description for the name form description attribute syntax. */ public static final String SYNTAX_NAME_FORM_DESCRIPTION = "Name Form Description"; - - /** - * The name for the name form description attribute syntax. - */ + /** The name for the name form description attribute syntax. */ public static final String SYNTAX_NAME_FORM_NAME = "NameFormDescription"; - - /** - * The OID for the name form description attribute syntax. - */ + /** The OID for the name form description attribute syntax. */ public static final String SYNTAX_NAME_FORM_OID = "1.3.6.1.4.1.1466.115.121.1.35"; - /** - * The description for the numeric string attribute syntax. - */ + /** The description for the numeric string attribute syntax. */ public static final String SYNTAX_NUMERIC_STRING_DESCRIPTION = "Numeric String"; - - /** - * The name for the numeric string attribute syntax. - */ + /** The name for the numeric string attribute syntax. */ public static final String SYNTAX_NUMERIC_STRING_NAME = "NumericString"; - - /** - * The OID for the numeric string attribute syntax. - */ + /** The OID for the numeric string attribute syntax. */ public static final String SYNTAX_NUMERIC_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.36"; - /** - * The description for the object class description attribute syntax. - */ + /** The description for the object class description attribute syntax. */ public static final String SYNTAX_OBJECTCLASS_DESCRIPTION = "Object Class Description"; - - /** - * The name for the object class description attribute syntax. - */ + /** The name for the object class description attribute syntax. */ public static final String SYNTAX_OBJECTCLASS_NAME = "ObjectClassDescription"; - - /** - * The OID for the object class description attribute syntax. - */ + /** The OID for the object class description attribute syntax. */ public static final String SYNTAX_OBJECTCLASS_OID = "1.3.6.1.4.1.1466.115.121.1.37"; - /** - * The description for the octet string attribute syntax. - */ + /** The description for the octet string attribute syntax. */ public static final String SYNTAX_OCTET_STRING_DESCRIPTION = "Octet String"; - - /** - * The name for the octet string attribute syntax. - */ + /** The name for the octet string attribute syntax. */ public static final String SYNTAX_OCTET_STRING_NAME = "OctetString"; - - /** - * The OID for the octet string attribute syntax. - */ + /** The OID for the octet string attribute syntax. */ public static final String SYNTAX_OCTET_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.40"; - /** - * The description for the object identifier attribute syntax. - */ + /** The description for the object identifier attribute syntax. */ public static final String SYNTAX_OID_DESCRIPTION = "OID"; - - /** - * The name for the object identifier attribute syntax. - */ + /** The name for the object identifier attribute syntax. */ public static final String SYNTAX_OID_NAME = "OID"; - - /** - * The OID for the object identifier attribute syntax. - */ + /** The OID for the object identifier attribute syntax. */ public static final String SYNTAX_OID_OID = "1.3.6.1.4.1.1466.115.121.1.38"; - /** - * The description for the other mailbox attribute syntax. - */ + /** The description for the other mailbox attribute syntax. */ public static final String SYNTAX_OTHER_MAILBOX_DESCRIPTION = "Other Mailbox"; - - /** - * The name for the other mailbox attribute syntax. - */ + /** The name for the other mailbox attribute syntax. */ public static final String SYNTAX_OTHER_MAILBOX_NAME = "OtherMailbox"; - - /** - * The OID for the other mailbox attribute syntax. - */ + /** The OID for the other mailbox attribute syntax. */ public static final String SYNTAX_OTHER_MAILBOX_OID = "1.3.6.1.4.1.1466.115.121.1.39"; - /** - * The description for the postal address attribute syntax. - */ + /** The description for the postal address attribute syntax. */ public static final String SYNTAX_POSTAL_ADDRESS_DESCRIPTION = "Postal Address"; - - /** - * The name for the postal address attribute syntax. - */ + /** The name for the postal address attribute syntax. */ public static final String SYNTAX_POSTAL_ADDRESS_NAME = "PostalAddress"; - - /** - * The OID for the postal address attribute syntax. - */ + /** The OID for the postal address attribute syntax. */ public static final String SYNTAX_POSTAL_ADDRESS_OID = "1.3.6.1.4.1.1466.115.121.1.41"; - /** - * The description for the presentation address attribute syntax. - */ + /** The description for the presentation address attribute syntax. */ public static final String SYNTAX_PRESENTATION_ADDRESS_DESCRIPTION = "Presentation Address"; - - /** - * The name for the presentation address attribute syntax. - */ + /** The name for the presentation address attribute syntax. */ public static final String SYNTAX_PRESENTATION_ADDRESS_NAME = "PresentationAddress"; - - /** - * The OID for the presentation address attribute syntax. - */ + /** The OID for the presentation address attribute syntax. */ public static final String SYNTAX_PRESENTATION_ADDRESS_OID = "1.3.6.1.4.1.1466.115.121.1.43"; - /** - * The description for the printable string attribute syntax. - */ + /** The description for the printable string attribute syntax. */ public static final String SYNTAX_PRINTABLE_STRING_DESCRIPTION = "Printable String"; - - /** - * The name for the printable string attribute syntax. - */ + /** The name for the printable string attribute syntax. */ public static final String SYNTAX_PRINTABLE_STRING_NAME = "PrintableString"; - - /** - * The OID for the printable string attribute syntax. - */ + /** The OID for the printable string attribute syntax. */ public static final String SYNTAX_PRINTABLE_STRING_OID = "1.3.6.1.4.1.1466.115.121.1.44"; - /** - * The description for the protocol information attribute syntax. - */ + /** The description for the protocol information attribute syntax. */ public static final String SYNTAX_PROTOCOL_INFORMATION_DESCRIPTION = "Protocol Information"; - - /** - * The name for the protocol information attribute syntax. - */ + /** The name for the protocol information attribute syntax. */ public static final String SYNTAX_PROTOCOL_INFORMATION_NAME = "ProtocolInformation"; - - /** - * The OID for the protocol information attribute syntax. - */ + /** The OID for the protocol information attribute syntax. */ public static final String SYNTAX_PROTOCOL_INFORMATION_OID = "1.3.6.1.4.1.1466.115.121.1.42"; - /** - * The OID for the relative subtree specification attribute syntax. - */ + /** The OID for the relative subtree specification attribute syntax. */ public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".2"; - - /** - * The description for the relative subtree specification attribute syntax. - */ + /** The description for the relative subtree specification attribute syntax. */ public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_DESCRIPTION = "Relative Subtree Specification"; - - /** - * The name for the relative subtree specification attribute syntax. - */ + /** The name for the relative subtree specification attribute syntax. */ public static final String SYNTAX_RELATIVE_SUBTREE_SPECIFICATION_NAME = "ds-relative-subtree-specification"; - /** - * The OID for the RFC3672 subtree specification attribute syntax. - */ + /** The OID for the RFC3672 subtree specification attribute syntax. */ public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_OID = "1.3.6.1.4.1.1466.115.121.1.45"; - - /** - * The description for the RFC3672 subtree specification attribute syntax. - */ + /** The description for the RFC3672 subtree specification attribute syntax. */ public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_DESCRIPTION = "RFC3672 Subtree Specification"; - - /** - * The name for the RFC3672 subtree specification attribute syntax. - */ + /** The name for the RFC3672 subtree specification attribute syntax. */ public static final String SYNTAX_RFC3672_SUBTREE_SPECIFICATION_NAME = "SubtreeSpecification"; - /** - * The description for the substring assertion attribute syntax. - */ + /** The description for the substring assertion attribute syntax. */ public static final String SYNTAX_SUBSTRING_ASSERTION_DESCRIPTION = "Substring Assertion"; - - /** - * The name for the substring assertion attribute syntax. - */ + /** The name for the substring assertion attribute syntax. */ public static final String SYNTAX_SUBSTRING_ASSERTION_NAME = "SubstringAssertion"; - /** * The OID for the Substring Assertion syntax used for assertion values in * extensible match filters. */ public static final String SYNTAX_SUBSTRING_ASSERTION_OID = "1.3.6.1.4.1.1466.115.121.1.58"; - /** - * The description for the supported algorithm attribute syntax. - */ + /** The description for the supported algorithm attribute syntax. */ public static final String SYNTAX_SUPPORTED_ALGORITHM_DESCRIPTION = "Supported Algorithm"; - - /** - * The name for the supported algorithm attribute syntax. - */ + /** The name for the supported algorithm attribute syntax. */ public static final String SYNTAX_SUPPORTED_ALGORITHM_NAME = "SupportedAlgorithm"; - /** * The OID for the Substring Assertion syntax used for assertion values in * extensible match filters. */ public static final String SYNTAX_SUPPORTED_ALGORITHM_OID = "1.3.6.1.4.1.1466.115.121.1.49"; - /** - * The description for the telephone number attribute syntax. - */ + /** The description for the telephone number attribute syntax. */ public static final String SYNTAX_TELEPHONE_DESCRIPTION = "Telephone Number"; - - /** - * The name for the telephone number attribute syntax. - */ + /** The name for the telephone number attribute syntax. */ public static final String SYNTAX_TELEPHONE_NAME = "TelephoneNumber"; - - /** - * The OID for the telephone number attribute syntax. - */ + /** The OID for the telephone number attribute syntax. */ public static final String SYNTAX_TELEPHONE_OID = "1.3.6.1.4.1.1466.115.121.1.50"; - /** - * The description for the teletex terminal identifier attribute syntax. - */ + /** The description for the teletex terminal identifier attribute syntax. */ public static final String SYNTAX_TELETEX_TERM_ID_DESCRIPTION = "Teletex Terminal Identifier"; - - /** - * The name for the teletex terminal identifier attribute syntax. - */ + /** The name for the teletex terminal identifier attribute syntax. */ public static final String SYNTAX_TELETEX_TERM_ID_NAME = "TeletexTerminalIdentifier"; - - /** - * The OID for the teletex terminal identifier attribute syntax. - */ + /** The OID for the teletex terminal identifier attribute syntax. */ public static final String SYNTAX_TELETEX_TERM_ID_OID = "1.3.6.1.4.1.1466.115.121.1.51"; - /** - * The description for the telex number attribute syntax. - */ + /** The description for the telex number attribute syntax. */ public static final String SYNTAX_TELEX_DESCRIPTION = "Telex Number"; - - /** - * The name for the telex number attribute syntax. - */ + /** The name for the telex number attribute syntax. */ public static final String SYNTAX_TELEX_NAME = "TelexNumber"; - - /** - * The OID for the telex number attribute syntax. - */ + /** The OID for the telex number attribute syntax. */ public static final String SYNTAX_TELEX_OID = "1.3.6.1.4.1.1466.115.121.1.52"; - /** - * The description for the user password attribute syntax. - */ + /** The description for the user password attribute syntax. */ public static final String SYNTAX_USER_PASSWORD_DESCRIPTION = "User Password"; - - /** - * The name for the user password attribute syntax. - */ + /** The name for the user password attribute syntax. */ public static final String SYNTAX_USER_PASSWORD_NAME = "ds-syntax-user-password"; + /** The OID for the user password attribute syntax. */ + public static final String SYNTAX_USER_PASSWORD_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE + ".1"; - /** - * The OID for the user password attribute syntax. - */ - public static final String SYNTAX_USER_PASSWORD_OID = OID_OPENDS_SERVER_ATTRIBUTE_SYNTAX_BASE - + ".1"; - - /** - * The description for the UTC time attribute syntax. - */ + /** The description for the UTC time attribute syntax. */ public static final String SYNTAX_UTC_TIME_DESCRIPTION = "UTC Time"; - - /** - * The name for the UTC time attribute syntax. - */ + /** The name for the UTC time attribute syntax. */ public static final String SYNTAX_UTC_TIME_NAME = "UTCTime"; - - /** - * The OID for the UTC time attribute syntax. - */ + /** The OID for the UTC time attribute syntax. */ public static final String SYNTAX_UTC_TIME_OID = "1.3.6.1.4.1.1466.115.121.1.53"; - /** - * The description for the UUID attribute syntax. - */ + /** The description for the UUID attribute syntax. */ public static final String SYNTAX_UUID_DESCRIPTION = "UUID"; - - /** - * The name for the UUID attribute syntax. - */ + /** The name for the UUID attribute syntax. */ public static final String SYNTAX_UUID_NAME = "UUID"; - - /** - * The OID for the UUID attribute syntax. - */ + /** The OID for the UUID attribute syntax. */ public static final String SYNTAX_UUID_OID = "1.3.6.1.1.16.1"; - /** - * The description for the "top" objectclass. - */ + /** The description for the "top" objectclass. */ public static final String TOP_OBJECTCLASS_DESCRIPTION = "Topmost ObjectClass"; - - /** - * The name of the "top" objectclass. - */ + /** The name of the "top" objectclass. */ public static final String TOP_OBJECTCLASS_NAME = "top"; - - /** - * The OID for the "top" objectclass. - */ + /** The OID for the "top" objectclass. */ public static final String TOP_OBJECTCLASS_OID = "2.5.6.0"; - /** - * The name for the relative time greater-than extensible ordering matching - * rule. - */ + /** The name for the relative time greater-than extensible ordering matching rule. */ public static final String EXT_OMR_RELATIVE_TIME_GT_NAME = "relativeTimeGTOrderingMatch"; - - /** - * The alternative name for the relative time greater-than extensible - * ordering matching rule. - */ + /** The alternative name for the relative time greater-than extensible ordering matching rule. */ public static final String EXT_OMR_RELATIVE_TIME_GT_ALT_NAME = "relativeTimeOrderingMatch.gt"; - - /** - * The OID for the relative time greater-than extensible ordering matching - * rule. - */ + /** The OID for the relative time greater-than extensible ordering matching rule. */ public static final String EXT_OMR_RELATIVE_TIME_GT_OID = "1.3.6.1.4.1.26027.1.4.5"; - /** - * The name for the relative time less-than extensible ordering matching - * rule. - */ + /** The name for the relative time less-than extensible ordering matching rule. */ public static final String EXT_OMR_RELATIVE_TIME_LT_NAME = "relativeTimeLTOrderingMatch"; - - /** - * The alternative name for the relative time less-than extensible ordering - * matching rule. - */ + /** The alternative name for the relative time less-than extensible ordering matching rule. */ public static final String EXT_OMR_RELATIVE_TIME_LT_ALT_NAME = "relativeTimeOrderingMatch.lt"; - - /** - * The OID for the relative time less-than extensible ordering matching - * rule. - */ + /** The OID for the relative time less-than extensible ordering matching rule. */ public static final String EXT_OMR_RELATIVE_TIME_LT_OID = "1.3.6.1.4.1.26027.1.4.6"; - /** - * The OID for the partial date and time extensible matching rule. - */ + /** The OID for the partial date and time extensible matching rule. */ public static final String EXT_PARTIAL_DATE_TIME_OID = "1.3.6.1.4.1.26027.1.4.7"; - - /** - * The name for the partial date and time extensible rule. - */ + /** The name for the partial date and time extensible rule. */ public static final String EXT_PARTIAL_DATE_TIME_NAME = "partialDateAndTimeMatchingRule"; /** @@ -1460,40 +728,23 @@ final class SchemaConstants { */ public static final String SCHEMA_PROPERTY_APPROX_RULE = "X-APPROX"; - /** - * The name of the schema property that will be used to specify the origin - * of a schema element. - */ + /** The name of the schema property that will be used to specify the origin of a schema element. */ public static final String SCHEMA_PROPERTY_ORIGIN = "X-ORIGIN"; - /** - * The OID for the extensibleObject objectclass. - */ + /** The OID for the extensibleObject objectclass. */ public static final String EXTENSIBLE_OBJECT_OBJECTCLASS_OID = "1.3.6.1.4.1.1466.101.120.111"; - - /** - * The name for the extensibleObject objectclass. - */ + /** The name for the extensibleObject objectclass. */ public static final String EXTENSIBLE_OBJECT_OBJECTCLASS_NAME = "extensibleObject"; - /** - * The value representing just one space character. - */ + /** The value representing just one space character. */ public static final ByteString SINGLE_SPACE_VALUE = ByteString.valueOfUtf8(" "); - /** - * The normalized true value. - */ + /** The normalized true value. */ public static final ByteString TRUE_VALUE = ByteString.valueOfUtf8("TRUE"); - - /** - * The normalized false value. - */ + /** The normalized false value. */ public static final ByteString FALSE_VALUE = ByteString.valueOfUtf8("FALSE"); - /** - * The name of the time zone for universal coordinated time (UTC). - */ + /** The name of the time zone for universal coordinated time (UTC). */ public static final String TIME_ZONE_UTC = "UTC"; /** @@ -1507,5 +758,4 @@ final class SchemaConstants { private SchemaConstants() { // Nothing to do. } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java index 89fe8f7d5..c1f2eb73f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaElement.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import static org.forgerock.opendj.ldap.schema.SchemaUtils.unmodifiableCopyOfExtraProperties; @@ -197,9 +186,7 @@ T removeExtraProperty0(final String extensionName, final String... extensionValu } } - /** - * Lazily created string representation. - */ + /** Lazily created string representation. */ private String definition; /** The description for this definition. */ @@ -228,7 +215,6 @@ T removeExtraProperty0(final String extensionName, final String... extensionValu this.definition = definition; } - /** {@inheritDoc} */ @Override public abstract boolean equals(Object obj); @@ -254,7 +240,6 @@ public final Map> getExtraProperties() { return extraProperties; } - /** {@inheritDoc} */ @Override public abstract int hashCode(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java index 44de6ea7d..4e3f7d348 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaException.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import org.forgerock.i18n.LocalizableException; @@ -63,7 +53,7 @@ public SchemaException(final LocalizableMessage message, final Throwable cause) this.message = message; } - /** {@inheritDoc} */ + @Override public LocalizableMessage getMessageObject() { return this.message; } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaOptions.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaOptions.java similarity index 77% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaOptions.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaOptions.java index 4a7532784..4df915f1f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaOptions.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaOptions.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -60,6 +50,16 @@ public final class SchemaOptions { */ public static final Option ALLOW_MALFORMED_NAMES_AND_OPTIONS = Option.withDefault(true); + /** + * Specifies whether the schema should allow attribute type definitions that do not declare a superior attribute + * type or syntax. When this compatibility option is set to {@code true} invalid attribute type definitions will + * use the default syntax specifed by the {@link #DEFAULT_SYNTAX_OID} option. + *

    + * By default this compatibility option is set to {@code true} in order to remain compatible with previous + * versions of OpenDJ. + */ + public static final Option ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX = Option.withDefault(true); + /** * Specifies whether the JPEG Photo syntax should allow values which * do not conform to the JFIF or Exif specifications. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java index 566b88c9f..30fa0ba8f 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaUtils.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java index a7ea1f31a..5782888e4 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SchemaValidationPolicy.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2014 ForgeRock AS + * Copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java similarity index 64% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java index 8c1fc1b74..bb6277fb8 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SubstringAssertionSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -48,6 +39,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_SUBSTRING_ASSERTION_NAME; } @@ -62,24 +54,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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. diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java new file mode 100644 index 000000000..ab80a20b7 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SupportedAlgorithmSyntaxImpl.java @@ -0,0 +1,66 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * 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; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_OCTET_STRING_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_SUPPORTED_ALGORITHM_NAME; + +import org.forgerock.i18n.LocalizableMessageBuilder; +import org.forgerock.opendj.ldap.ByteSequence; + +/** + * This class implements the supported algorithm attribute syntax. This should + * be restricted to holding only X.509 supported algorithms, but we will accept + * any set of bytes. It will be treated much like the octet string attribute + * syntax. + */ +final class SupportedAlgorithmSyntaxImpl extends AbstractSyntaxImpl { + + @Override + public String getEqualityMatchingRule() { + return EMR_OCTET_STRING_OID; + } + + @Override + public String getName() { + return SYNTAX_SUPPORTED_ALGORITHM_NAME; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_OCTET_STRING_OID; + } + + @Override + public boolean isBEREncodingRequired() { + return true; + } + + @Override + public boolean isHumanReadable() { + return false; + } + + @Override + public boolean valueIsAcceptable(final Schema schema, final ByteSequence value, + final LocalizableMessageBuilder invalidReason) { + // All values will be acceptable for the supported algorithm syntax. + return true; + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java index c651cc46f..473efde17 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/Syntax.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2013-2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -82,7 +72,7 @@ public static final class Builder extends SchemaElementBuilder { * If there is an existing syntax with the same numeric OID. */ public SchemaBuilder addToSchema() { - return getSchemaBuilder().addSyntax(new Syntax(this), false); + return addToSchema(false); } /** @@ -91,22 +81,25 @@ public SchemaBuilder addToSchema() { * @return The parent schema builder. */ public SchemaBuilder addToSchemaOverwrite() { - return getSchemaBuilder().addSyntax(new Syntax(this), true); + return addToSchema(true); } - /** - * Adds this syntax to the schema - overwriting any existing syntax with the same numeric OID - * if the overwrite parameter is set to {@code true}. - * - * @param overwrite - * {@code true} if any syntax with the same OID should be overwritten. - * @return The parent schema builder. - */ SchemaBuilder addToSchema(final boolean overwrite) { - if (overwrite) { - return addToSchemaOverwrite(); + // Enumeration syntaxes will need their associated matching rule registered now as well. + for (final Map.Entry> property : getExtraProperties().entrySet()) { + if ("x-enum".equalsIgnoreCase(property.getKey())) { + final EnumSyntaxImpl enumSyntaxImpl = new EnumSyntaxImpl(oid, property.getValue()); + implementation(enumSyntaxImpl); + return getSchemaBuilder().addSyntax(new Syntax(this), overwrite) + .buildMatchingRule(enumSyntaxImpl.getOrderingMatchingRule()) + .description(getDescription() + " enumeration ordering matching rule") + .syntaxOID(oid) + .extraProperties(CoreSchemaImpl.OPENDS_ORIGIN) + .implementation(new EnumOrderingMatchingRule(enumSyntaxImpl)) + .addToSchemaOverwrite(); + } } - return addToSchema(); + return getSchemaBuilder().addSyntax(new Syntax(this), overwrite); } @Override diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java similarity index 80% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java index 7f822e8ad..78fb39475 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/SyntaxImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java similarity index 61% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java index b34015975..d66795095 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -45,6 +35,7 @@ final class TelephoneNumberEqualityMatchingRuleImpl extends AbstractEqualityMatc super(EMR_TELEPHONE_NAME); } + @Override public ByteString normalizeAttributeValue(final Schema schema, final ByteSequence value) { final String valueString = value.toString(); final int valueLength = valueString.length(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java similarity index 60% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java index bad987a62..c5bcd0def 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSubstringMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -45,6 +35,7 @@ final class TelephoneNumberSubstringMatchingRuleImpl extends AbstractSubstringMa 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(); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java index ca2424d9a..3678b822b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -56,6 +46,7 @@ public String getEqualityMatchingRule() { return EMR_TELEPHONE_OID; } + @Override public String getName() { return SYNTAX_TELEPHONE_NAME; } @@ -65,24 +56,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java similarity index 79% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java index 69547ae16..c66d91b37 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TeletexTerminalIdentifierSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -74,6 +64,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_TELETEX_TERM_ID_NAME; } @@ -88,24 +79,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java index b3e435e8d..1a87ae29b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TelexNumberSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -50,6 +41,7 @@ public String getEqualityMatchingRule() { return EMR_CASE_IGNORE_OID; } + @Override public String getName() { return SYNTAX_TELEX_NAME; } @@ -64,24 +56,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java index c40fc9007..e3bc58cdb 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/TimeBasedMatchingRulesImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java index 85f25852a..321e4cb72 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -158,6 +148,7 @@ public String getEqualityMatchingRule() { return EMR_GENERALIZED_TIME_OID; } + @Override public String getName() { return SYNTAX_UTC_TIME_NAME; } @@ -172,24 +163,12 @@ public String getSubstringMatchingRule() { 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 true if the provided value is acceptable for use - * with this syntax, or false 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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java index 233a01189..f1b2b5c45 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java similarity index 51% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java index 5aaefe66e..3374dd799 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java index 2263712f0..29911ad74 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxImpl.java @@ -1,34 +1,27 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.schema; import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_DASH; import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_EXPECTED_HEX; import static com.forgerock.opendj.ldap.CoreMessages.WARN_ATTR_SYNTAX_UUID_INVALID_LENGTH; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_UUID_OID; +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_UUID_OID; import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_UUID_NAME; import org.forgerock.i18n.LocalizableMessageBuilder; @@ -39,28 +32,27 @@ * 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 true if the provided value is acceptable for use - * with this syntax, or false if not. - */ + @Override + public String getEqualityMatchingRule() { + return EMR_UUID_OID; + } + + @Override + public String getOrderingMatchingRule() { + return OMR_UUID_OID; + } + + @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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java index 2de189895..66fbe1600 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -47,6 +37,7 @@ final class UniqueMemberEqualityMatchingRuleImpl extends AbstractEqualityMatchin 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(); diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java new file mode 100644 index 000000000..0be2e73b6 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UnknownSchemaElementException.java @@ -0,0 +1,37 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.schema; + +import org.forgerock.i18n.LocalizableMessage; +import org.forgerock.i18n.LocalizedIllegalArgumentException; + +/** + * Thrown when a schema query fails because the requested schema element could + * not be found or is ambiguous. + */ +@SuppressWarnings("serial") +public class UnknownSchemaElementException extends LocalizedIllegalArgumentException { + /** + * Creates a new unknown schema element exception with the provided message. + * + * @param message + * The message that explains the problem that occurred. + */ + public UnknownSchemaElementException(final LocalizableMessage message) { + super(message); + } +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java index 6a10d03ba..b4738887b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -45,6 +35,7 @@ final class UserPasswordExactEqualityMatchingRuleImpl extends AbstractEqualityMa 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 diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java similarity index 85% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java index 1d259ce68..155c4b60e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/UserPasswordSyntaxImpl.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -141,14 +132,17 @@ public String getEqualityMatchingRule() { 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 diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java new file mode 100644 index 000000000..4214c6944 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/schema/package-info.java @@ -0,0 +1,21 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ + +/** + * Classes and interfaces for constructing and querying LDAP schemas. + */ +package org.forgerock.opendj.ldap.schema; + diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/BindResultLdapPromiseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/BindResultLdapPromiseImpl.java similarity index 62% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/BindResultLdapPromiseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/BindResultLdapPromiseImpl.java index ffdf50d40..9d7416dd5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/BindResultLdapPromiseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/BindResultLdapPromiseImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java similarity index 93% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java index 3a416d037..cec68d92c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ConnectionState.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ExtendedResultLdapPromiseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ExtendedResultLdapPromiseImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ExtendedResultLdapPromiseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ExtendedResultLdapPromiseImpl.java index f05d7f988..e8a956d01 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ExtendedResultLdapPromiseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ExtendedResultLdapPromiseImpl.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexQueryFactory.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexQueryFactory.java similarity index 78% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexQueryFactory.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexQueryFactory.java index 346c1156d..1dc85e4c9 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexQueryFactory.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexQueryFactory.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/Indexer.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/Indexer.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/Indexer.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/Indexer.java index 6707d2df6..2fdbd4f79 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/Indexer.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/Indexer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexingOptions.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexingOptions.java new file mode 100644 index 000000000..7f7a0439a --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/IndexingOptions.java @@ -0,0 +1,33 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2014 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.spi; + +/** + * Contains options indicating how indexing must be performed. + */ +public interface IndexingOptions { + + /** + * Returns the maximum size to use when building the keys for the + * "substring" index. + * + * @return the maximum size to use when building the keys for the + * "substring" index. + */ + int substringKeySize(); + + +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionFactoryImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionFactoryImpl.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionFactoryImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionFactoryImpl.java index 922250408..a01300e50 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionFactoryImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionFactoryImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionImpl.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionImpl.java index 63a641a38..43ddff637 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPConnectionImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPListenerImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPListenerImpl.java similarity index 54% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPListenerImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPListenerImpl.java index d95991e5e..673ec697d 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPListenerImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LDAPListenerImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2014 ForgeRock AS. + * Copyright 2013-2014 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseImpl.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseImpl.java index d515bb10f..06643bd58 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java similarity index 76% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java index 49166230e..575b567cf 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromiseWrapper.java @@ -1,31 +1,22 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.spi; +import static org.forgerock.opendj.ldap.spi.LdapPromises.*; + import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; @@ -33,14 +24,12 @@ import org.forgerock.opendj.ldap.LdapException; import org.forgerock.opendj.ldap.LdapPromise; import org.forgerock.util.AsyncFunction; -import org.forgerock.util.promise.ExceptionHandler; import org.forgerock.util.Function; +import org.forgerock.util.promise.ExceptionHandler; import org.forgerock.util.promise.Promise; import org.forgerock.util.promise.ResultHandler; import org.forgerock.util.promise.RuntimeExceptionHandler; -import static org.forgerock.opendj.ldap.spi.LdapPromises.*; - /** * Provides a {@link Promise} wrapper and a {@link LdapPromise} implementation. * @@ -63,7 +52,6 @@ public LdapPromiseWrapper(P wrappedPromise, int requestID) { this.requestID = requestID; } - @SuppressWarnings("unchecked") @Override public int getRequestID() { return wrappedPromise instanceof LdapPromise ? ((LdapPromise) wrappedPromise).getRequestID() @@ -179,6 +167,13 @@ public Promise thenAsync( return wrappedPromise.thenAsync(onResult, onException); } + @Override + public Promise thenAsync(AsyncFunction onResult, + AsyncFunction onException, + AsyncFunction onRuntimeException) { + return wrappedPromise.thenAsync(onResult, onException); + } + @Override // @Checkstyle:ignore public Promise thenCatch(Function onException) { @@ -202,4 +197,27 @@ public P getWrappedPromise() { return wrappedPromise; } + @Override + public Promise thenCatchRuntimeException( + Function onRuntimeException) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Promise thenCatchRuntimeExceptionAsync( + AsyncFunction onRuntimeException) { + // TODO Auto-generated method stub + return null; + } + + @Override + public Promise then(Function onResult, + Function onException, + Function onRuntimeException) { + // TODO Auto-generated method stub + return null; + } + + } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromises.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromises.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromises.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromises.java index ccc456160..dd55d10c5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromises.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/LdapPromises.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; @@ -51,9 +41,7 @@ import org.forgerock.util.promise.PromiseImpl; import org.forgerock.util.promise.Promises; -/** - * Utility methods for creating and composing {@link LdapPromise}s. - */ +/** Utility methods for creating and composing {@link LdapPromise}s. */ public final class LdapPromises { private LdapPromises() { } @@ -83,44 +71,13 @@ public static LdapPromise asPromise(Promise wrappedProm * Client that binds to the server. * @param intermediateResponseHandler * Handler that consumes intermediate responses from extended operations. - * @param connection - * The connection to directory server. * @return The new {@link BindResultLdapPromiseImpl}. */ public static BindResultLdapPromiseImpl newBindLdapPromise( final int requestID, final BindRequest request, final BindClient bindClient, - final IntermediateResponseHandler intermediateResponseHandler, - final Connection connection) { - return new BindResultLdapPromiseImpl(LdapPromises.newInnerBindOrStartTLSPromise(), - requestID, - request, - bindClient, - intermediateResponseHandler); - } - - /** - * Creates a new bind {@link BindResultLdapPromiseImpl}. - * - * @param requestID - * Identifier of the request. - * @param request - * The bind request sent to server. - * @param bindClient - * Client that binds to the server. - * @param intermediateResponseHandler - * Handler that consumes intermediate responses from extended operations. - * @param connection - * The connection to directory server. - * @return The new {@link BindResultLdapPromiseImpl}. - */ - public static BindResultLdapPromiseImpl newBindLdapPromise( - final int requestID, - final BindRequest request, - final BindClient bindClient, - final IntermediateResponseHandler intermediateResponseHandler, - final LDAPConnectionImpl connection) { + final IntermediateResponseHandler intermediateResponseHandler) { return new BindResultLdapPromiseImpl(LdapPromises.newInnerBindOrStartTLSPromise(), requestID, request, diff --git a/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/Provider.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/Provider.java new file mode 100644 index 000000000..cd4e01a20 --- /dev/null +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/Provider.java @@ -0,0 +1,35 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2013 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.spi; + +/** + * Interface for providers, which provide an implementation of one or more interfaces. + *

    + * A provider must be declared in the provider-configuration file + * {@code META-INF/services/org.forgerock.opendj.ldap.spi.} + * in order to allow automatic loading of the implementation classes using the + * {@code java.util.ServiceLoader} facility. + */ +public interface Provider { + + /** + * Returns the name of this provider. + * + * @return name of provider + */ + String getName(); + +} diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ResultLdapPromiseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ResultLdapPromiseImpl.java similarity index 84% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ResultLdapPromiseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ResultLdapPromiseImpl.java index 8883b97bb..504f045ef 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/ResultLdapPromiseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/ResultLdapPromiseImpl.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; @@ -64,7 +54,6 @@ public abstract class ResultLdapPromiseImpl this.timestamp = System.currentTimeMillis(); } - /** {@inheritDoc} */ @Override public final boolean handleIntermediateResponse(final IntermediateResponse response) { // FIXME: there's a potential race condition here - the promise could @@ -97,6 +86,7 @@ public boolean isBindOrStartTLS() { * * @return String representation of this promise's state. */ + @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append("( requestID = "); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/SearchResultLdapPromiseImpl.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/SearchResultLdapPromiseImpl.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/SearchResultLdapPromiseImpl.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/SearchResultLdapPromiseImpl.java index e6ae3e623..d8a9c8130 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldap/spi/SearchResultLdapPromiseImpl.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldap/spi/SearchResultLdapPromiseImpl.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap.spi; import org.forgerock.opendj.ldap.IntermediateResponseHandler; @@ -40,9 +29,7 @@ import org.forgerock.opendj.ldap.responses.SearchResultReference; import org.forgerock.util.promise.PromiseImpl; -/** - * Search result promise implementation. - */ +/** Search result promise implementation. */ public final class SearchResultLdapPromiseImpl extends ResultLdapPromiseImpl implements SearchResultHandler { private SearchResultHandler searchResultHandler; @@ -60,7 +47,6 @@ public final class SearchResultLdapPromiseImpl extends ResultLdapPromiseImpl C getControl(ControlDecoder decoder, DecodeOptions options) - throws DecodeException; - - /** {@inheritDoc} */ - List getControls(); } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java similarity index 67% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java index 908fb7d9f..628b7c415 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldif; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java similarity index 72% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java index 4d957b23d..1f046f296 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitor.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldif; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java similarity index 68% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java index 46b7af4f6..793cb2a6c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordVisitorWriter.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -54,6 +45,7 @@ private ChangeRecordVisitorWriter() { // Nothing to do. } + @Override public IOException visitChangeRecord(final ChangeRecordWriter p, final AddRequest change) { try { p.writeChangeRecord(change); @@ -63,6 +55,7 @@ public IOException visitChangeRecord(final ChangeRecordWriter p, final AddReques } } + @Override public IOException visitChangeRecord(final ChangeRecordWriter p, final DeleteRequest change) { try { p.writeChangeRecord(change); @@ -72,6 +65,7 @@ public IOException visitChangeRecord(final ChangeRecordWriter p, final DeleteReq } } + @Override public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyDNRequest change) { try { p.writeChangeRecord(change); @@ -81,6 +75,7 @@ public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyDNR } } + @Override public IOException visitChangeRecord(final ChangeRecordWriter p, final ModifyRequest change) { try { p.writeChangeRecord(change); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java similarity index 83% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java index ca8efb8d5..2e1639a92 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ChangeRecordWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -48,6 +38,7 @@ public interface ChangeRecordWriter extends Closeable, Flushable { * @throws IOException * If an unexpected IO error occurred while closing. */ + @Override void close() throws IOException; /** @@ -64,6 +55,7 @@ public interface ChangeRecordWriter extends Closeable, Flushable { * @throws IOException * If an unexpected IO error occurred while flushing. */ + @Override void flush() throws IOException; /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java similarity index 87% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java index d41705cb2..71078a534 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -74,6 +64,7 @@ public ConnectionChangeRecordWriter(final Connection connection) { * connection. Closing a previously closed change record writer has no * effect. */ + @Override public void close() { connection.close(); } @@ -82,6 +73,7 @@ public void close() { * Connection change record writers do not require flushing, so this method * has no effect. */ + @Override public void flush() { // Do nothing. } @@ -99,6 +91,7 @@ public void flush() { * @throws NullPointerException * If {@code change} was {@code null}. */ + @Override public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change) throws LdapException { Reject.ifNull(change); connection.add(change); @@ -118,6 +111,7 @@ public ConnectionChangeRecordWriter writeChangeRecord(final AddRequest change) t * @throws NullPointerException * If {@code change} was {@code null}. */ + @Override public ConnectionChangeRecordWriter writeChangeRecord(final ChangeRecord change) throws LdapException { Reject.ifNull(change); @@ -148,6 +142,7 @@ public ConnectionChangeRecordWriter writeChangeRecord(final ChangeRecord change) * @throws NullPointerException * If {@code change} was {@code null}. */ + @Override public ConnectionChangeRecordWriter writeChangeRecord(final DeleteRequest change) throws LdapException { Reject.ifNull(change); connection.delete(change); @@ -167,6 +162,7 @@ public ConnectionChangeRecordWriter writeChangeRecord(final DeleteRequest change * @throws NullPointerException * If {@code change} was {@code null}. */ + @Override public ConnectionChangeRecordWriter writeChangeRecord(final ModifyDNRequest change) throws LdapException { Reject.ifNull(change); connection.modifyDN(change); @@ -186,6 +182,7 @@ public ConnectionChangeRecordWriter writeChangeRecord(final ModifyDNRequest chan * @throws NullPointerException * If {@code change} was {@code null}. */ + @Override public ConnectionChangeRecordWriter writeChangeRecord(final ModifyRequest change) throws LdapException { Reject.ifNull(change); connection.modify(change); @@ -202,6 +199,7 @@ public ConnectionChangeRecordWriter writeChangeRecord(final ModifyRequest change * @throws NullPointerException * If {@code comment} was {@code null}. */ + @Override public ConnectionChangeRecordWriter writeComment(final CharSequence comment) { Reject.ifNull(comment); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java similarity index 92% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java index 742f248e9..fcb567299 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryReader.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2014 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import java.util.NoSuchElementException; @@ -106,13 +95,9 @@ * interface which is not mockable. */ public class ConnectionEntryReader implements EntryReader { - /* - * See OPENDJ-1124 for more discussion about why this class is non-final. - */ + /* See OPENDJ-1124 for more discussion about why this class is non-final. */ - /** - * Result handler that places all responses in a queue. - */ + /** Result handler that places all responses in a queue. */ private static final class BufferHandler implements SearchResultHandler, LdapResultHandler { private final BlockingQueue responses; private volatile boolean isInterrupted; @@ -214,17 +199,13 @@ public ConnectionEntryReader(final Connection connection, final SearchRequest se promise = connection.searchAsync(searchRequest, buffer).thenOnResult(buffer).thenOnException(buffer); } - /** - * Closes this connection entry reader, canceling the search request if it - * is still active. - */ + /** Closes this connection entry reader, canceling the search request if it is still active. */ @Override public void close() { // Cancel the search if it is still running. promise.cancel(true); } - /** {@inheritDoc} */ @Override public boolean hasNext() throws LdapException { // Poll for the next response if needed. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java similarity index 75% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java index 35126bc25..38ec1c304 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/ConnectionEntryWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -67,6 +57,7 @@ public ConnectionEntryWriter(final Connection connection) { * Closes this connection entry writer, including the underlying connection. * Closing a previously closed entry writer has no effect. */ + @Override public void close() { connection.close(); } @@ -75,6 +66,7 @@ public void close() { * Connection entry writers do not require flushing, so this method has no * effect. */ + @Override public void flush() { // Do nothing. } @@ -89,6 +81,7 @@ public void flush() { * @throws NullPointerException * If {@code comment} was {@code null}. */ + @Override public ConnectionEntryWriter writeComment(final CharSequence comment) { Reject.ifNull(comment); @@ -109,6 +102,7 @@ public ConnectionEntryWriter writeComment(final CharSequence comment) { * @throws NullPointerException * If {@code entry} was {@code null}. */ + @Override public ConnectionEntryWriter writeEntry(final Entry entry) throws LdapException { Reject.ifNull(entry); connection.add(entry); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryGenerator.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryGenerator.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryGenerator.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryGenerator.java index 4be8f2239..a78eff2dd 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryGenerator.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryGenerator.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2010 Sun Microsystems, Inc. - * Portions Copyright 2013-2015 ForgeRock AS + * Copyright 2006-2010 Sun Microsystems, Inc. + * Portions Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -64,8 +54,6 @@ */ public final class EntryGenerator implements EntryReader { - private static final int DEFAULT_RANDOM_SEED = 1; - /** Template file that contains directives for generation of entries. */ private TemplateFile templateFile; @@ -79,7 +67,7 @@ public final class EntryGenerator implements EntryReader { private boolean isInitialized; /** Random seed is used to generate random data. */ - private int randomSeed = DEFAULT_RANDOM_SEED; + private Random random = new Random(); /** * Path to the directory that may contain additional resource files needed @@ -181,7 +169,7 @@ public EntryGenerator(final InputStream templateStream) { * @return A reference to this {@code EntryGenerator}. */ public EntryGenerator setRandomSeed(final int seed) { - randomSeed = seed; + random = new Random(seed); return this; } @@ -306,7 +294,7 @@ private void initialize() throws IOException { if (schema == null) { schema = Schema.getDefaultSchema(); } - templateFile = new TemplateFile(schema, constants, resourcePath, new Random(randomSeed), generateBranches); + templateFile = new TemplateFile(schema, constants, resourcePath, random, generateBranches); try { if (templatePath != null) { templateFile.parse(templatePath, warnings); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryReader.java similarity index 64% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryReader.java index 2d4cd47da..e4ed1c14c 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. */ package org.forgerock.opendj.ldif; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java similarity index 70% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java index e2c345d36..dad41fa3b 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/EntryWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -44,6 +34,7 @@ public interface EntryWriter extends Closeable, Flushable { * @throws IOException * If an unexpected IO error occurred while closing. */ + @Override void close() throws IOException; /** @@ -60,6 +51,7 @@ public interface EntryWriter extends Closeable, Flushable { * @throws IOException * If an unexpected IO error occurred while flushing. */ + @Override void flush() throws IOException; /** diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java similarity index 97% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java index 851c18ce2..6b6fba052 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIF.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2011-2015 ForgeRock AS + * Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import static com.forgerock.opendj.ldap.CoreMessages.*; @@ -67,7 +57,6 @@ import org.forgerock.opendj.ldap.requests.SearchRequest; import org.forgerock.opendj.ldap.schema.AttributeUsage; import org.forgerock.opendj.ldap.schema.Schema; -import org.forgerock.util.Utils; /** * This class contains common utility methods for creating and manipulating @@ -78,8 +67,11 @@ public final class LDIF { private static final class EntryIteratorReader implements EntryReader { private final Iterator iterator; private EntryIteratorReader(final Iterator iterator) { this.iterator = iterator; } + @Override public void close() { } + @Override public boolean hasNext() { return iterator.hasNext(); } + @Override public Entry readEntry() { return iterator.next(); } } // @formatter:on @@ -88,6 +80,7 @@ public void close() { } * Comparator ordering the DN ASC. */ private static final Comparator DN_ORDER2 = new Comparator() { + @Override public int compare(byte[][] b1, byte[][] b2) { return DN_ORDER.compare(b1[0], b2[0]); } @@ -97,6 +90,7 @@ public int compare(byte[][] b1, byte[][] b2) { * Comparator ordering the DN ASC. */ private static final Comparator DN_ORDER = new Comparator() { + @Override public int compare(byte[] b1, byte[] b2) { final ByteString bs = ByteString.valueOfBytes(b1); final ByteString bs2 = ByteString.valueOfBytes(b2); @@ -321,8 +315,7 @@ public static Entry makeEntry(List ldifLines) { */ public static List makeEntries(String... ldifLines) { List entries = new ArrayList<>(); - LDIFEntryReader reader = new LDIFEntryReader(ldifLines); - try { + try (LDIFEntryReader reader = new LDIFEntryReader(ldifLines)) { while (reader.hasNext()) { entries.add(reader.readEntry()); } @@ -332,8 +325,6 @@ public static List makeEntries(String... ldifLines) { } catch (final IOException e) { // This should never happen for a String based reader. throw new LocalizedIllegalArgumentException(WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage())); - } finally { - Utils.closeSilently(reader); } if (entries.isEmpty()) { throw new LocalizedIllegalArgumentException(WARN_READ_LDIF_ENTRY_NO_ENTRY_FOUND.get()); @@ -698,10 +689,12 @@ public static EntryReader search(final EntryReader input, final SearchRequest se 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(); @@ -721,6 +714,7 @@ public boolean hasNext() throws IOException { return nextEntry != null; } + @Override public Entry readEntry() throws IOException { if (hasNext()) { final Entry entry = nextEntry; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java similarity index 94% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java index 5218abbc4..0ba1cb1f6 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordReader.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import java.io.IOException; @@ -61,7 +50,6 @@ import org.forgerock.opendj.ldap.schema.Syntax; import org.forgerock.opendj.ldap.schema.UnknownSchemaElementException; import org.forgerock.util.Reject; -import org.forgerock.util.Utils; import static com.forgerock.opendj.ldap.CoreMessages.*; import static com.forgerock.opendj.util.StaticUtils.*; @@ -114,8 +102,7 @@ public final class LDIFChangeRecordReader extends AbstractLDIFReader implements */ public static ChangeRecord valueOfLDIFChangeRecord(final String... ldifLines) { // LDIF change record reader is tolerant to missing change types. - final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(ldifLines); - try { + try (final LDIFChangeRecordReader reader = new LDIFChangeRecordReader(ldifLines)) { if (!reader.hasNext()) { // No change record found. final LocalizableMessage message = @@ -141,8 +128,6 @@ public static ChangeRecord valueOfLDIFChangeRecord(final String... ldifLines) { final LocalizableMessage message = WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage()); throw new LocalizedIllegalArgumentException(message); - } finally { - Utils.closeSilently(reader); } } @@ -200,7 +185,6 @@ public LDIFChangeRecordReader(final String... ldifLines) { super(Arrays.asList(ldifLines)); } - /** {@inheritDoc} */ @Override public void close() throws IOException { close0(); @@ -388,10 +372,7 @@ private ChangeRecord getNextChangeRecord() throws DecodeException, IOException { } try { - /* - * Read the DN of the entry and see if it is one that should be - * included in the import. - */ + /* Read the DN of the entry and see if it is one that should be included in the import. */ final DN entryDN = readLDIFRecordDN(record); if (entryDN == null) { // Skip version record. @@ -574,10 +555,7 @@ private ChangeRecord parseModifyChangeRecordEntry(final DN entryDN, final LDIFRe schemaErrors.add(message); continue; default: // Ignore - /* - * This should not happen: we should be using a non-strict - * schema for this policy. - */ + /* This should not happen: we should be using a non-strict schema for this policy. */ throw new IllegalStateException("Schema is not consistent with policy", e); } } catch (final LocalizedIllegalArgumentException e) { @@ -612,10 +590,7 @@ private ChangeRecord parseModifyChangeRecordEntry(final DN entryDN, final LDIFRe attributeDescription = attributeDescription.withOption("binary"); } - /* - * Now go through the rest of the attributes until the "-" line is - * reached. - */ + /* Now go through the rest of the attributes until the "-" line is reached. */ attributeValues.clear(); while (record.iterator.hasNext()) { ldifLine = record.iterator.next(); @@ -762,5 +737,4 @@ private ChangeRecord parseModifyDNChangeRecordEntry(final DN entryDN, final LDIF return modifyDNRequest; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java similarity index 90% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java index 84e1639ac..33d04319e 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriter.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import java.io.IOException; @@ -72,7 +61,6 @@ * Interchange Format (LDIF) - Technical Specification */ public final class LDIFChangeRecordWriter extends AbstractLDIFWriter implements ChangeRecordWriter { - /** * Returns the LDIF string representation of the provided change record. * @@ -82,9 +70,8 @@ public final class LDIFChangeRecordWriter extends AbstractLDIFWriter implements */ public static String toString(final ChangeRecord change) { final StringWriter writer = new StringWriter(128); - try { - new LDIFChangeRecordWriter(writer).setAddUserFriendlyComments(true).writeChangeRecord( - change).close(); + try (LDIFChangeRecordWriter ldifWriter = new LDIFChangeRecordWriter(writer)) { + ldifWriter.setAddUserFriendlyComments(true).writeChangeRecord(change); } catch (final IOException e) { // Should never happen. throw new IllegalStateException(e); @@ -125,13 +112,11 @@ public LDIFChangeRecordWriter(final Writer writer) { super(writer); } - /** {@inheritDoc} */ @Override public void close() throws IOException { close0(); } - /** {@inheritDoc} */ @Override public void flush() throws IOException { flush0(); @@ -257,7 +242,6 @@ public LDIFChangeRecordWriter setWrapColumn(final int wrapColumn) { return this; } - /** {@inheritDoc} */ @Override public LDIFChangeRecordWriter writeChangeRecord(final AddRequest change) throws IOException { Reject.ifNull(change); @@ -288,7 +272,6 @@ public LDIFChangeRecordWriter writeChangeRecord(final AddRequest change) throws return this; } - /** {@inheritDoc} */ @Override public LDIFChangeRecordWriter writeChangeRecord(final ChangeRecord change) throws IOException { Reject.ifNull(change); @@ -305,7 +288,6 @@ public LDIFChangeRecordWriter writeChangeRecord(final ChangeRecord change) throw return this; } - /** {@inheritDoc} */ @Override public LDIFChangeRecordWriter writeChangeRecord(final DeleteRequest change) throws IOException { Reject.ifNull(change); @@ -325,7 +307,6 @@ public LDIFChangeRecordWriter writeChangeRecord(final DeleteRequest change) thro return this; } - /** {@inheritDoc} */ @Override public LDIFChangeRecordWriter writeChangeRecord(final ModifyDNRequest change) throws IOException { @@ -362,7 +343,6 @@ public LDIFChangeRecordWriter writeChangeRecord(final ModifyDNRequest change) return this; } - /** {@inheritDoc} */ @Override public LDIFChangeRecordWriter writeChangeRecord(final ModifyRequest change) throws IOException { Reject.ifNull(change); @@ -404,11 +384,9 @@ public LDIFChangeRecordWriter writeChangeRecord(final ModifyRequest change) thro return this; } - /** {@inheritDoc} */ @Override public LDIFChangeRecordWriter writeComment(final CharSequence comment) throws IOException { writeComment0(comment); return this; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java similarity index 91% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java index fade05eda..5834c27bf 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryReader.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import static com.forgerock.opendj.ldap.CoreMessages.*; @@ -48,7 +37,6 @@ import org.forgerock.opendj.ldap.schema.Schema; import org.forgerock.opendj.ldap.schema.SchemaValidationPolicy; import org.forgerock.util.Reject; -import org.forgerock.util.Utils; /** * An LDIF entry reader reads attribute value records (entries) using the LDAP @@ -75,8 +63,7 @@ public final class LDIFEntryReader extends AbstractLDIFReader implements EntryRe * If {@code ldifLines} was {@code null}. */ public static Entry valueOfLDIFEntry(final String... ldifLines) { - final LDIFEntryReader reader = new LDIFEntryReader(ldifLines); - try { + try (final LDIFEntryReader reader = new LDIFEntryReader(ldifLines)) { if (!reader.hasNext()) { // No change record found. final LocalizableMessage message = @@ -102,8 +89,6 @@ public static Entry valueOfLDIFEntry(final String... ldifLines) { final LocalizableMessage message = WARN_READ_LDIF_RECORD_UNEXPECTED_IO_ERROR.get(e.getMessage()); throw new LocalizedIllegalArgumentException(message); - } finally { - Utils.closeSilently(reader); } } @@ -161,7 +146,6 @@ public LDIFEntryReader(final String... ldifLines) { super(Arrays.asList(ldifLines)); } - /** {@inheritDoc} */ @Override public void close() throws IOException { close0(); @@ -375,10 +359,7 @@ private Entry getNextEntry() throws DecodeException, IOException { } try { - /* - * Read the DN of the entry and see if it is one that should be - * included in the import. - */ + /* Read the DN of the entry and see if it is one that should be included in the import. */ final DN entryDN = readLDIFRecordDN(record); if (entryDN == null) { // Skip version record. @@ -436,5 +417,4 @@ private Entry getNextEntry() throws DecodeException, IOException { return nextEntry; } - } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java similarity index 89% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java index f64c8a426..87cac56f7 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/LDIFEntryWriter.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import java.io.IOException; @@ -60,8 +49,8 @@ public final class LDIFEntryWriter extends AbstractLDIFWriter implements EntryWr */ public static String toString(final Entry entry) { final StringWriter writer = new StringWriter(128); - try { - new LDIFEntryWriter(writer).setAddUserFriendlyComments(true).writeEntry(entry).close(); + try (LDIFEntryWriter ldifWriter = new LDIFEntryWriter(writer)) { + ldifWriter.setAddUserFriendlyComments(true).writeEntry(entry); } catch (final IOException e) { // Should never happen. throw new IllegalStateException(e); @@ -102,13 +91,11 @@ public LDIFEntryWriter(final Writer writer) { super(writer); } - /** {@inheritDoc} */ @Override public void close() throws IOException { close0(); } - /** {@inheritDoc} */ @Override public void flush() throws IOException { flush0(); @@ -261,14 +248,12 @@ public LDIFEntryWriter setWrapColumn(final int wrapColumn) { 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); diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java similarity index 88% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java index facc073ae..f804c3bc5 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/RejectedChangeRecordListener.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2011 ForgeRock AS + * Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -50,30 +41,36 @@ public interface RejectedChangeRecordListener { */ 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); @@ -88,31 +85,37 @@ public void handleRejectedChangeRecord(final ModifyDNRequest change, final Local */ 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. diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java similarity index 86% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java index cf9b52f77..262a2edef 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/RejectedLDIFListener.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2011 ForgeRock AS + * Copyright 2011 ForgeRock AS. */ package org.forgerock.opendj.ldif; diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/TemplateFile.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/TemplateFile.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/TemplateFile.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/TemplateFile.java index a56bcff62..6dd3d11cf 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/TemplateFile.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/TemplateFile.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions Copyright 2013-2015 ForgeRock AS + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -81,7 +71,6 @@ import org.forgerock.opendj.ldif.TemplateTag.UnderscoreParentDNTag; import org.forgerock.util.Pair; import org.forgerock.util.Reject; -import org.forgerock.util.Utils; /** * A template file allow to generate entries from a collection of constant @@ -250,28 +239,20 @@ Random getRandom() { } private void retrieveFirstAndLastNames() throws IOException { - BufferedReader first = null; - try { - first = getReader(FIRST_NAME_FILE); + try (BufferedReader first = getReader(FIRST_NAME_FILE)) { if (first == null) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_COULD_NOT_FIND_NAME_FILE.get(FIRST_NAME_FILE)); } final List names = readLines(first); firstNames = names.toArray(new String[names.size()]); - } finally { - Utils.closeSilently(first); } - BufferedReader last = null; - try { - last = getReader(LAST_NAME_FILE); + try (BufferedReader last = getReader(LAST_NAME_FILE)) { if (last == null) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_COULD_NOT_FIND_NAME_FILE.get(LAST_NAME_FILE)); } final List names = readLines(last); lastNames = names.toArray(new String[names.size()]); - } finally { - Utils.closeSilently(first); } } @@ -362,9 +343,7 @@ void parse(List warnings) throws IOException, DecodeExceptio * If any other problem occurs while parsing the template file. */ void parse(String templateFilename, List warnings) throws IOException, DecodeException { - BufferedReader templateReader = null; - try { - templateReader = getReader(templateFilename); + try (BufferedReader templateReader = getReader(templateFilename)) { if (templateReader == null) { throw DecodeException.fatalError( ERR_ENTRY_GENERATOR_COULD_NOT_FIND_TEMPLATE_FILE.get(templateFilename)); @@ -379,8 +358,6 @@ void parse(String templateFilename, List warnings) throws IO final List fileLines = readLines(templateReader); final String[] lines = fileLines.toArray(new String[fileLines.size()]); parse(lines, warnings); - } finally { - Utils.closeSilently(templateReader); } } @@ -399,14 +376,10 @@ void parse(String templateFilename, List warnings) throws IO * If any other problem occurs while parsing the template. */ void parse(InputStream inputStream, List warnings) throws IOException, DecodeException { - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(inputStream)); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) { final List fileLines = readLines(reader); final String[] lines = fileLines.toArray(new String[fileLines.size()]); parse(lines, warnings); - } finally { - Utils.closeSilently(reader); } } @@ -452,8 +425,13 @@ void parse(final String[] lines, final List warnings) throws TemplateData templateData = new TemplateData(); for (int lineNumber = 0; lineNumber < lines.length; lineNumber++) { - final String line = replaceConstants(lines[lineNumber], lineNumber, constants, warnings); + final String currentRawLine = lines[lineNumber]; + if (currentRawLine.isEmpty() || currentRawLine.startsWith("#")) { + // This is a comment or a blank line, so we'll ignore it. + continue; + } + final String line = replaceConstants(currentRawLine, lineNumber, constants, warnings); final String lowerLine = line.toLowerCase(); if (line.length() == 0 || line.startsWith("#")) { // This is a comment or a blank line, so we'll ignore it. @@ -468,7 +446,7 @@ void parse(final String[] lines, final List warnings) throws lineNumber = parseTemplate(lineNumber, line, lines, templateData, warnings); } else { throw DecodeException.fatalError( - ERR_ENTRY_GENERATOR_UNEXPECTED_TEMPLATE_FILE_LINE.get(line, lineNumber)); + ERR_ENTRY_GENERATOR_UNEXPECTED_TEMPLATE_FILE_LINE.get(line, lineNumber + 1)); } } @@ -533,17 +511,17 @@ private void parseDefine(final int lineNumber, final String line, final Map= 0) { @@ -703,8 +681,8 @@ private Branch parseBranchDefinition(final String[] branchLines, final int start try { branchDN = DN.valueOf(dnString, schema); } catch (Exception e) { - throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_CANNOT_DECODE_BRANCH_DN.get( - dnString, startLineNumber)); + throw DecodeException.fatalError( + ERR_ENTRY_GENERATOR_CANNOT_DECODE_BRANCH_DN.get(dnString, startLineNumber + 1)); } final Branch branch = new Branch(this, branchDN, schema); @@ -778,7 +756,7 @@ private Template parseTemplateDefinition(final int startLineNumber, final String parentTemplate = definedTemplates.get(parentTemplateName.toLowerCase()); if (parentTemplate == null) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_TEMPLATE_INVALID_PARENT_TEMPLATE.get( - parentTemplateName, lineNumber, templateName)); + parentTemplateName, lineNumber + 1, templateName)); } } else if (lowerLine.startsWith(RDNATTR_LABEL)) { // This is the set of RDN attributes. If there are multiple, @@ -860,11 +838,11 @@ private Pair parseSubordinateTemplate(final int lineNumber, fin numEntries = Integer.parseInt(line.substring(colonPos + 1).trim()); if (numEntries == 0) { warnings.add(WARN_ENTRY_GENERATOR_SUBORDINATE_ZERO_ENTRIES.get( - lineNumber, element.getLabel(), elementName, templateName)); + lineNumber + 1, element.getLabel(), elementName, templateName)); } } catch (NumberFormatException nfe) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_SUBORDINATE_CANT_PARSE_NUMENTRIES.get( - templateName, lineNumber, element.getLabel(), elementName)); + templateName, lineNumber + 1, element.getLabel(), elementName)); } } @@ -909,10 +887,10 @@ private TemplateLine parseTemplateLine(final String line, final int lineNumber, final int colonPos = lowerLine.indexOf(':'); if (colonPos < 0) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_NO_COLON_IN_TEMPLATE_LINE.get( - lineNumber, element.getLabel(), elementName)); + lineNumber + 1, element.getLabel(), elementName)); } else if (colonPos == 0) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_NO_ATTR_IN_TEMPLATE_LINE.get( - lineNumber, element.getLabel(), elementName)); + lineNumber + 1, element.getLabel(), elementName)); } final AttributeType attributeType = schema.getAttributeType(lowerLine.substring(0, colonPos)); @@ -940,7 +918,7 @@ private TemplateLine parseTemplateLine(final String line, final int lineNumber, // We've hit the end of the line with no value. // We'll allow it, but add a warning. warnings.add(WARN_ENTRY_GENERATOR_NO_VALUE_IN_TEMPLATE_LINE.get( - lineNumber, element.getLabel(), elementName)); + lineNumber + 1, element.getLabel(), elementName)); } int phase = PARSING_STATIC_TEXT; @@ -1038,7 +1016,7 @@ private TemplateLine parseTemplateLine(final String line, final int lineNumber, tagList.add(t); } } else { - throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_INCOMPLETE_TAG.get(lineNumber)); + throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_INCOMPLETE_TAG.get(lineNumber + 1)); } return new TemplateLine(attributeType, lineNumber, tagList, valueIsURL, valueIsBase64); @@ -1080,7 +1058,7 @@ private TemplateTag parseReplacementTag(final String tagString, final Branch bra if (tag == null) { tag = tags.get(lowerTagName); if (tag == null) { - throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_NO_SUCH_TAG.get(tagName, lineNumber)); + throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_NO_SUCH_TAG.get(tagName, lineNumber + 1)); } } @@ -1095,7 +1073,7 @@ private TemplateTag parseReplacementTag(final String tagString, final Branch bra newTag = tag.getClass().newInstance(); } catch (Exception e) { throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_CANNOT_INSTANTIATE_NEW_TAG.get( - tagName, lineNumber, String.valueOf(e)), e); + tagName, lineNumber + 1, String.valueOf(e)), e); } if (branch == null) { @@ -1103,8 +1081,8 @@ private TemplateTag parseReplacementTag(final String tagString, final Branch bra } else if (newTag.allowedInBranch()) { newTag.initializeForBranch(schema, this, branch, arguments, lineNumber, warnings); } else { - throw DecodeException.fatalError(ERR_ENTRY_GENERATOR_TAG_NOT_ALLOWED_IN_BRANCH.get(newTag.getName(), - lineNumber)); + throw DecodeException.fatalError( + ERR_ENTRY_GENERATOR_TAG_NOT_ALLOWED_IN_BRANCH.get(newTag.getName(), lineNumber + 1)); } return newTag; } @@ -1267,12 +1245,18 @@ String[] getLines(String identifier, final BufferedReader reader) throws IOExcep */ private List readLines(final BufferedReader reader) throws IOException { final List lines = new ArrayList<>(); - while (true) { - final String line = reader.readLine(); - if (line == null) { - break; + String line; + for (int lineNumber = 1; (line = reader.readLine()) != null; lineNumber++) { + if (line.startsWith(" ")) { + final int lastLineIndex = lines.size() - 1; + final String previousLine = lines.get(lastLineIndex); + if (lines.isEmpty() || previousLine.isEmpty()) { + throw DecodeException.fatalError(ERR_TEMPLATE_FILE_INVALID_LEADING_SPACE.get(lineNumber, line)); + } + lines.set(lastLineIndex, previousLine + line.substring(1)); + } else { + lines.add(line); } - lines.add(line); } return lines; } diff --git a/opendj-core/src/main/java/org/forgerock/opendj/ldif/TemplateTag.java b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/TemplateTag.java similarity index 96% rename from opendj-core/src/main/java/org/forgerock/opendj/ldif/TemplateTag.java rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/TemplateTag.java index 4f3a61cf7..dfcabc926 100644 --- a/opendj-core/src/main/java/org/forgerock/opendj/ldif/TemplateTag.java +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/TemplateTag.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2009 Sun Microsystems, Inc. - * Portions Copyright 2013 ForgeRock AS + * Copyright 2006-2009 Sun Microsystems, Inc. + * Portions Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -44,7 +34,6 @@ import org.forgerock.opendj.ldif.TemplateFile.Template; import org.forgerock.opendj.ldif.TemplateFile.TemplateEntry; import org.forgerock.opendj.ldif.TemplateFile.TemplateValue; -import org.forgerock.util.Utils; /** * Represents a tag that may be used in a template line when generating entries. @@ -395,31 +384,21 @@ private void initialize(TemplateFile templateFile, String[] arguments, int lineN // The first argument should be the path to the file. final String filePath = arguments[0]; - BufferedReader dataReader = null; - try { - dataReader = templateFile.getReader(filePath); + try (BufferedReader dataReader = templateFile.getReader(filePath)) { if (dataReader == null) { - LocalizableMessage message = ERR_ENTRY_GENERATOR_TAG_CANNOT_FIND_FILE.get(filePath, getName(), - lineNumber); - throw DecodeException.fatalError(message); + throw DecodeException.fatalError( + ERR_ENTRY_GENERATOR_TAG_CANNOT_FIND_FILE.get(filePath, getName(), lineNumber)); } - // See if the file has already been read into memory. If not, then - // read it. - try { - fileLines = templateFile.getLines(filePath, dataReader); - } catch (IOException ioe) { - LocalizableMessage message = ERR_ENTRY_GENERATOR_TAG_CANNOT_READ_FILE.get(filePath, getName(), - lineNumber, String.valueOf(ioe)); - throw DecodeException.fatalError(message, ioe); - } - } finally { - Utils.closeSilently(dataReader); + // See if the file has already been read into memory. If not, then read it. + fileLines = templateFile.getLines(filePath, dataReader); + } catch (IOException e) { + throw DecodeException.fatalError( + ERR_ENTRY_GENERATOR_TAG_CANNOT_READ_FILE.get(filePath, getName(), lineNumber, e), e); } - // If there is a second argument, then it should be either - // "sequential" or "random". If there isn't one, then we should - // assume "random". + // If there is a second argument, then it should be either "sequential" or "random". + // If there isn't one, then we should assume "random". if (arguments.length == 2) { if ("sequential".equalsIgnoreCase(arguments[1])) { isSequential = true; @@ -854,11 +833,7 @@ private void initialize(TemplateFile templateFile, String[] arguments, int lineN @Override TagResult generateValue(TemplateEntry templateEntry, TemplateValue templateValue) { int intValue = random.nextInt(100); - if (intValue < percentage) { - return TagResult.SUCCESS; - } else { - return TagResult.FAILURE; - } + return intValue < percentage ? TagResult.SUCCESS : TagResult.FAILURE; } } diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/package-info.java similarity index 75% rename from opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt rename to opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/package-info.java index 090cf595d..8c5b38bc4 100644 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-1.txt +++ b/opendj-sdk-core/src/main/java/org/forgerock/opendj/ldif/package-info.java @@ -9,10 +9,13 @@ * When distributing Covered Software, include this CDDL Header Notice in each file and include * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL * Header, with the fields enclosed by brackets [] replaced by your own identifying - * information: "Portions copyright [year] [name of copyright owner]". + * information: "Portions Copyright [year] [name of copyright owner]". * - * Copyright 2012-2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. */ - - MUST BE REMOVED: Copyright 2012-2014 ForgeRock AS. - EXPECTED OUTPUT: Copyright 2012-YEAR ForgeRock AS. + +/** + * Classes and interfaces for reading and writing LDIF. + */ +package org.forgerock.opendj.ldif; + diff --git a/opendj-core/src/main/javadoc/overview.html b/opendj-sdk-core/src/main/javadoc/overview.html similarity index 79% rename from opendj-core/src/main/javadoc/overview.html rename to opendj-sdk-core/src/main/javadoc/overview.html index 4ecc26355..3ff78100a 100644 --- a/opendj-core/src/main/javadoc/overview.html +++ b/opendj-sdk-core/src/main/javadoc/overview.html @@ -1,28 +1,18 @@ diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core.properties old mode 100755 new mode 100644 similarity index 97% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core.properties index e054fd518..f2cf12d50 --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core.properties @@ -1,30 +1,20 @@ # -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2010 Sun Microsystems, Inc. -# Portions copyright 2011-2015 ForgeRock AS -# Portions Copyright 2014 Manuel Gaupp +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2010 Sun Microsystems, Inc. +# Portions copyright 2011-2016 ForgeRock AS. +# Portions Copyright 2014 Manuel Gaupp + ERR_ATTR_SYNTAX_UNKNOWN_APPROXIMATE_MATCHING_RULE=Unable to retrieve \ approximate matching rule %s used as the default for the %s attribute syntax. \ Approximate matching will not be allowed by default for attributes with this \ @@ -479,6 +469,11 @@ ERR_NO_SUBSCHEMA_SUBENTRY_ATTR=The entry %s does not include \ a subschemaSubentry attribute ERR_RDN_TYPE_NOT_FOUND=The RDN "%s" could not be parsed due to the \ following reason: %s +ERR_RDN_TRAILING_GARBAGE=The RDN "%s" could not be parsed because it \ + contained trailing content after the RDN: "%s" +ERR_RDN_DUPLICATE_AVA_TYPES=An RDN contained multiple components \ + having the same attribute type "%s" +ERR_RDN_NO_AVAS=An RDN must contain at least one attribute type and value ERR_DN_TYPE_NOT_FOUND=The DN "%s" could not be parsed due to the \ following reason: %s ERR_ATTRIBUTE_DESCRIPTION_EMPTY=The attribute description \ @@ -1296,10 +1291,9 @@ WARN_ATTR_SYNTAX_ATTRTYPE_UNKNOWN_SUBSTRING_MR1=The definition for \ the attribute type "%s" declared that substring matching should be \ performed using the matching rule "%s" which is not defined \ in the schema -WARN_ATTR_TYPE_NOT_DEFINED1=The definition for the \ - attribute type "%s" declared that it should use the syntax \ - "%s" which is is not defined in the schema. The default syntax "%s" \ - will be used instead +WARN_ATTR_TYPE_NOT_DEFINED1=The definition for the attribute type "%s" \ + declared that it should use the syntax "%s" which is not defined in the schema. \ + The default syntax "%s" will be used instead ERR_ATTR_SYNTAX_DCR_UNKNOWN_REQUIRED_ATTR1=The DIT content rule "%s" \ is associated with a required attribute type "%s" which is not defined in the \ schema @@ -1486,14 +1480,14 @@ ERR_ENTRY_GENERATOR_CONFLICTING_TAG_NAME=Cannot register the tag defined in \ class %s because the tag name %s conflicts with the name of another tag that \ has already been registered WARN_ENTRY_GENERATOR_WARNING_UNDEFINED_CONSTANT=Possible reference to an \ - undefined constant %s on line %d + undefined constant '%s' on line %d ERR_ENTRY_GENERATOR_DEFINE_MISSING_EQUALS=The constant definition on line \ %d is missing an equal sign to delimit the constant name from the value ERR_ENTRY_GENERATOR_DEFINE_NAME_EMPTY=The constant definition on line %d \ does not include a name for the constant -ERR_ENTRY_GENERATOR_WARNING_DEFINE_VALUE_EMPTY=Constant %s defined on line \ +ERR_ENTRY_GENERATOR_WARNING_DEFINE_VALUE_EMPTY=Constant '%s' defined on line \ %d has not been assigned a value -ERR_ENTRY_GENERATOR_CONFLICTING_BRANCH_DN=The branch definition %s starting \ +ERR_ENTRY_GENERATOR_CONFLICTING_BRANCH_DN=The branch definition '%s' starting \ on line %d conflicts with an earlier branch definition contained in the \ template file ERR_ENTRY_GENERATOR_CONFLICTING_TEMPLATE_NAME=The template definition %s \ @@ -1509,30 +1503,12 @@ ERR_ENTRY_GENERATOR_CANNOT_DECODE_BRANCH_DN=Unable to decode branch DN "%s" \ ERR_ENTRY_GENERATOR_UNDEFINED_BRANCH_SUBORDINATE=The branch with entry DN \ '%s' references a subordinate template named '%s' which is not defined in the \ template file -ERR_ENTRY_GENERATOR_SUBORDINATE_TEMPLATE_NO_COLON=Subordinate \ - template definition on line %d for %s %s is missing a colon to separate \ - the template name from the number of entries -ERR_ENTRY_GENERATOR_SUBORDINATE_INVALID_NUM_ENTRIES=Subordinate \ - template definition on line %d for %s %s specified invalid number of \ - entries %d for template %s WARN_ENTRY_GENERATOR_SUBORDINATE_ZERO_ENTRIES=Subordinate template \ definition on line %d for %s %s specifies that zero entries of type %s \ should be generated ERR_ENTRY_GENERATOR_SUBORDINATE_CANT_PARSE_NUMENTRIES=Unable to \ parse the number of entries for template %s as an integer for the subordinate \ template definition on line %d for %s %s -ERR_ENTRY_GENERATOR_TEMPLATE_SUBORDINATE_TEMPLATE_NO_COLON=Subordinate \ - template definition on line %d for template %s is missing a colon to separate \ - the template name from the number of entries -ERR_ENTRY_GENERATOR_TEMPLATE_SUBORDINATE_INVALID_NUM_ENTRIES=Subordinate \ - template definition on line %d for template %s specified invalid number of \ - entries %d for subordinate template %s -WARN_ENTRY_GENERATOR_TEMPLATE_SUBORDINATE_ZERO_ENTRIES=Subordinate template \ - definition on line %d for template %s specifies that zero entries of type %s \ - should be generated -ERR_ENTRY_GENERATOR_TEMPLATE_SUBORDINATE_CANT_PARSE_NUMENTRIES=Unable to \ - parse the number of entries for template %s as an integer for the subordinate \ - template definition on line %d for template %s ERR_ENTRY_GENERATOR_TEMPLATE_MISSING_RDN_ATTR=The template named %s \ includes RDN attribute %s that is not assigned a value in that template ERR_ENTRY_GENERATOR_NO_COLON_IN_TEMPLATE_LINE=There is no colon to separate \ @@ -1583,11 +1559,8 @@ WARN_ENTRY_GENERATOR_TAG_LIST_INVALID_WEIGHT=The list tag on line %d of \ semicolon is not followed by an integer. The semicolon will be assumed to be \ part of the value and not a delimiter to separate the value from its relative \ weight -ERR_ENTRY_GENERATOR_IOEXCEPTION_DURING_PARSE=An error occurred while \ - attempting to read the template file: %s ERR_ENTRY_GENERATOR_EXCEPTION_DURING_PARSE=An error occurred while \ attempting to parse the template file: %s -ERR_ENTRY_GENERATOR_MISSING_TEMPLATE_FILE=Unexpected error when initializing config : no template file provided as input ERR_ADDRESSMASK_PREFIX_DECODE_ERROR=Cannot decode the provided \ address mask prefix because an invalid value was specified. The permitted \ values for IPv4are 0 to32 and for IPv6 0 to128 @@ -1643,7 +1616,7 @@ WARN_ATTR_INVALID_PARTIAL_TIME_ASSERTION_FORMAT=The provided \ value "%s" could not be parsed as a valid assertion value because the \ character '%c' is not allowed. The acceptable values are s (second), \ m (minute), h (hour), D (date), M (month) and Y (year) -ERR_INVALID_COMPACTED_UNSIGNED_INT="Expected a compacted unsigned int (value less than %d), \ +ERR_INVALID_COMPACTED_UNSIGNED_INT=Expected a compacted unsigned int (value less than %d), \ but got a compacted unsigned long: %d ERR_TRANSACTION_ID_CONTROL_BAD_OID=Cannot decode the provided \ control as a transaction id control because it contained the OID '%s', \ @@ -1651,7 +1624,10 @@ ERR_TRANSACTION_ID_CONTROL_BAD_OID=Cannot decode the provided \ ERR_TRANSACTION_ID_CONTROL_DECODE_NULL=Cannot decode the provided ASN.1 \ element as a transaction id control because it did not have a value, when \ a value must always be provided - +ERR_TEMPLATE_FILE_INVALID_LEADING_SPACE=Unable to parse line %d ("%s") from the \ + template file because the line started with a space but there were no previous \ + lines in the entry to which this line could be appended + # Labels for generated documentation DOC_LOCALE_TAG=Code tag: %s DOC_LOCALE_OID=Collation order object identifier: %s diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_de.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_de.properties old mode 100755 new mode 100644 similarity index 94% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_de.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_de.properties index b4fd9c7b9..6d0ae76fb --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_de.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_de.properties @@ -1,26 +1,16 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=Der angegebene Wert "%s" ist keine g\u00fcltige L\u00e4nderzeichenkette, da die L\u00e4nge nicht exakt zwei Zeichen betr\u00e4gt ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=Der angegebene Wert "%s" ist keine g\u00fcltige Liefermethode, da er keine Elemente enth\u00e4lt diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_es.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_es.properties old mode 100755 new mode 100644 similarity index 94% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_es.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_es.properties index a3d1d3145..ca7fa207a --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_es.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_es.properties @@ -1,26 +1,16 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=El valor proporcionado "%s" no es una cadena de pa\u00edses v\u00e1lida porque no tiene una longitud de dos caracteres. ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=El valor proporcionado "%s" no es un valor de m\u00e9todo de entrega v\u00e1lido porque no contiene elementos ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT_12=El valor proporcionado "%s" no es un valor de m\u00e9todo de entrega v\u00e1lido porque "%s" no es un m\u00e9todo v\u00e1lido diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties old mode 100755 new mode 100644 similarity index 94% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties index 2c6f2cec7..2b044c554 --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_fr.properties @@ -1,27 +1,17 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. -# Portions copyright 2013 ForgeRock AS +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. +# Portions copyright 2013 ForgeRock AS. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=La valeur indiqu\u00e9e "%s" n'est pas une cha\u00eene de pays valide car elle n'a pas une longueur de deux caract\u00e8res exactement ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=La valeur indiqu\u00e9e "%s" n'est pas une m\u00e9thode de distribution valide car elle ne contient aucun \u00e9l\u00e9ment ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT_12=La valeur indiqu\u00e9e "%s" n'est pas une m\u00e9thode de distribution valide car "%s" n'est pas une m\u00e9thode valide @@ -97,4 +87,4 @@ ERR_ATTR_SYNTAX_DCR_PROHIBITED_REQUIRED_BY_AUXILIARY_272=La r\u00e8gle de conten ERR_ATTR_SYNTAX_DN_INVALID_REQUIRES_ESCAPE_CHAR_282=Impossible d'analyser la valeur fournie "%s" en tant que nom valide distinctif car la valeur de l'attribut commence avec un caract\u00e8re en position %d qui doit \u00eatre \u00e9vit\u00e9 ERR_NO_SEARCH_RESULT_ENTRIES=La recherche a \u00e9t\u00e9 effectu\u00e9e avec succ\u00e8s mais n'a retourn\u00e9 aucune entr\u00e9e alors qu'une entr\u00e9e \u00e9tait attendue ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES=La recherche a \u00e9t\u00e9 effectu\u00e9e avec succ\u00e8s mais a retourn\u00e9 %s entr\u00e9es alors qu'une seule entr\u00e9e \u00e9tait attendue -ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES_NO_COUNT=La recherche a \u00e9t\u00e9 effectu\u00e9e avec succ\u00e8s mais a retourn\u00e9 plusieurs entr\u00e9es alors qu'une seule entr\u00e9e \u00e9tait attendue \ No newline at end of file +ERR_UNEXPECTED_SEARCH_RESULT_ENTRIES_NO_COUNT=La recherche a \u00e9t\u00e9 effectu\u00e9e avec succ\u00e8s mais a retourn\u00e9 plusieurs entr\u00e9es alors qu'une seule entr\u00e9e \u00e9tait attendue diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_ja.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_ja.properties old mode 100755 new mode 100644 similarity index 96% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_ja.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_ja.properties index b394a957f..a6c1faab8 --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_ja.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_ja.properties @@ -1,26 +1,16 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=\u6307\u5b9a\u3055\u308c\u305f\u5024 "%s" \u306f\u3001\u9577\u3055\u304c\u6b63\u78ba\u306b 2 \u6587\u5b57\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u6709\u52b9\u306a\u56fd\u6587\u5b57\u5217\u3067\u306f\u3042\u308a\u307e\u305b\u3093 ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=\u6307\u5b9a\u3055\u308c\u305f\u5024 "%s" \u306f\u3001\u8981\u7d20\u304c\u4e00\u5207\u542b\u307e\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001\u6709\u52b9\u306a\u5b9f\u65bd\u30e1\u30bd\u30c3\u30c9\u5024\u3067\u306f\u3042\u308a\u307e\u305b\u3093 ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT_12="%2$s" \u306f\u6709\u52b9\u306a\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u306a\u3044\u305f\u3081\u3001\u6307\u5b9a\u3055\u308c\u305f\u5024 "%1$s" \u306f\u6709\u52b9\u306a\u5b9f\u65bd\u30e1\u30bd\u30c3\u30c9\u5024\u3067\u306f\u3042\u308a\u307e\u305b\u3093 diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_ko.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_ko.properties old mode 100755 new mode 100644 similarity index 96% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_ko.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_ko.properties index 101975eed..f83ca9e1c --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_ko.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_ko.properties @@ -1,26 +1,16 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=\uae38\uc774\uac00 \uc815\ud655\ud788 \ub450 \ubb38\uc790\uac00 \uc544\ub2c8\uae30 \ub54c\ubb38\uc5d0 \uc81c\uacf5\ub41c \uac12 \"%s\"\uc740(\ub294) \uc720\ud6a8\ud55c \uad6d\uac00 \ubb38\uc790\uc5f4\uc774 \uc544\ub2d9\ub2c8\ub2e4. ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=\uc694\uc18c\uac00 \ud3ec\ud568\ub418\uc5b4 \uc788\uc9c0 \uc54a\uae30 \ub54c\ubb38\uc5d0 \uc81c\uacf5\ub41c \uac12 \"%s\"\uc740(\ub294) \uc720\ud6a8\ud55c \uc804\ub2ec \ubc29\ubc95\uc774 \uc544\ub2d9\ub2c8\ub2e4. ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT_12=\"%2$s\"\uc774(\uac00) \uc720\ud6a8\ud55c \ubc29\ubc95\uc774 \uc544\ub2c8\uae30 \ub54c\ubb38\uc5d0 \uc81c\uacf5\ub41c \uac12 \"%1$s\"\uc740(\ub294) \uc720\ud6a8\ud55c \uc804\ub2ec \ubc29\ubc95\uc774 \uc544\ub2d9\ub2c8\ub2e4. diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_CN.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_CN.properties old mode 100755 new mode 100644 similarity index 95% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_CN.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_CN.properties index 7e854acd5..3b6273c3d --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_CN.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_CN.properties @@ -1,26 +1,16 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=\u63d0\u4f9b\u7684\u503c "%s" \u4e0d\u662f\u6709\u6548\u7684\u56fd\u5bb6/\u5730\u533a\u5b57\u7b26\u4e32\uff0c\u56e0\u4e3a\u957f\u5ea6\u5e76\u975e\u6070\u597d\u4e3a\u4e24\u4e2a\u5b57\u7b26 ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=\u63d0\u4f9b\u7684\u503c "%s" \u4e0d\u662f\u6709\u6548\u7684\u4f20\u9001\u65b9\u6cd5\u503c\uff0c\u56e0\u4e3a\u5b83\u4e0d\u5305\u542b\u4efb\u4f55\u5143\u7d20 ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT_12=\u63d0\u4f9b\u7684\u503c "%s" \u4e0d\u662f\u6709\u6548\u7684\u4f20\u9001\u65b9\u6cd5\u503c\uff0c\u56e0\u4e3a "%s" \u4e0d\u662f\u6709\u6548\u7684\u65b9\u6cd5 diff --git a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_TW.properties b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_TW.properties old mode 100755 new mode 100644 similarity index 95% rename from opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_TW.properties rename to opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_TW.properties index e56b5e4c0..0f214c172 --- a/opendj-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_TW.properties +++ b/opendj-sdk-core/src/main/resources/com/forgerock/opendj/ldap/core_zh_TW.properties @@ -1,26 +1,16 @@ -# CDDL HEADER START +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. # -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. # -# You can obtain a copy of the license at legal-notices/CDDLv1_0.txt -# or http://forgerock.org/license/CDDLv1.0.html. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at legal-notices/CDDLv1_0.txt. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: -# Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# Copyright 2009 Sun Microsystems, Inc. +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". # +# Copyright 2009 Sun Microsystems, Inc. ERR_ATTR_SYNTAX_COUNTRY_STRING_INVALID_LENGTH_9=\u63d0\u4f9b\u7684\u503c\u300c%s\u300d\u4e0d\u662f\u6709\u6548\u7684\u570b\u5bb6/\u5730\u5340\u5b57\u4e32\uff0c\u56e0\u70ba\u5176\u9577\u5ea6\u4e0d\u662f\u6b63\u597d\u5169\u500b\u5b57\u5143 ERR_ATTR_SYNTAX_DELIVERY_METHOD_NO_ELEMENTS_11=\u63d0\u4f9b\u7684\u503c\u300c%s\u300d\u4e0d\u662f\u6709\u6548\u7684\u50b3\u9001\u65b9\u6cd5\u503c\uff0c\u56e0\u70ba\u5176\u4e2d\u4e0d\u5305\u542b\u4efb\u4f55\u5143\u7d20 ERR_ATTR_SYNTAX_DELIVERY_METHOD_INVALID_ELEMENT_12=\u63d0\u4f9b\u7684\u503c\u300c%s\u300d\u4e0d\u662f\u6709\u6548\u7684\u50b3\u9001\u65b9\u6cd5\u503c\uff0c\u56e0\u70ba\u300c%s\u300d\u4e0d\u662f\u6709\u6548\u7684\u65b9\u6cd5 diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/addrate.template b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/addrate.template similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/addrate.template rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/addrate.template diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/cities b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/cities similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/cities rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/cities diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/example.template b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/example.template similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/example.template rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/example.template diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/first.names b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/first.names similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/first.names rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/first.names diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/last.names b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/last.names similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/last.names rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/last.names diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/people_and_groups.template b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/people_and_groups.template similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/people_and_groups.template rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/people_and_groups.template diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/states b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/states similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/states rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/states diff --git a/opendj-core/src/main/resources/org/forgerock/opendj/ldif/streets b/opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/streets similarity index 100% rename from opendj-core/src/main/resources/org/forgerock/opendj/ldif/streets rename to opendj-sdk-core/src/main/resources/org/forgerock/opendj/ldif/streets diff --git a/opendj-core/src/site/xdoc/index.xml.vm b/opendj-sdk-core/src/site/xdoc/index.xml.vm similarity index 87% rename from opendj-core/src/site/xdoc/index.xml.vm rename to opendj-sdk-core/src/site/xdoc/index.xml.vm index dd8c01285..cbedee42f 100644 --- a/opendj-core/src/site/xdoc/index.xml.vm +++ b/opendj-sdk-core/src/site/xdoc/index.xml.vm @@ -1,28 +1,18 @@ diff --git a/opendj-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java similarity index 65% rename from opendj-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java index 5ca577ff6..a1aaea87a 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityRequestControlTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; diff --git a/opendj-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java similarity index 75% rename from opendj-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java index f8ca5bfe5..ab3ffc41c 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/ldap/controls/AccountUsabilityResponseControlTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.ldap.controls; diff --git a/opendj-core/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java similarity index 88% rename from opendj-core/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java index eee500e5c..10b3b8045 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/ASCIICharPropTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/test/java/com/forgerock/opendj/util/OperatingSystemTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/OperatingSystemTestCase.java similarity index 82% rename from opendj-core/src/test/java/com/forgerock/opendj/util/OperatingSystemTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/util/OperatingSystemTestCase.java index a3dd03f6d..b28e814b6 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/util/OperatingSystemTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/OperatingSystemTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/test/java/com/forgerock/opendj/util/ReferenceCountedObjectTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/ReferenceCountedObjectTestCase.java similarity index 83% rename from opendj-core/src/test/java/com/forgerock/opendj/util/ReferenceCountedObjectTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/util/ReferenceCountedObjectTestCase.java index 7fde80c50..c2af56078 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/util/ReferenceCountedObjectTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/ReferenceCountedObjectTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Portions copyright 2013 ForgeRock AS. + * Portions copyright 2013 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java similarity index 93% rename from opendj-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java index cd9a325a2..87bf93c4a 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/StaticUtilsTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java similarity index 79% rename from opendj-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java rename to opendj-sdk-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java index 41215a360..6632c7c14 100644 --- a/opendj-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/StringPrepProfileTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package com.forgerock.opendj.util; diff --git a/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/UtilTestCase.java b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/UtilTestCase.java new file mode 100644 index 000000000..26c6e9421 --- /dev/null +++ b/opendj-sdk-core/src/test/java/com/forgerock/opendj/util/UtilTestCase.java @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package com.forgerock.opendj.util; + +import org.forgerock.testng.ForgeRockTestCase; +import org.testng.annotations.Test; + +/** + * An abstract class that all util unit tests should extend. Util represents the + * classes found directly under the package org.forgerock.opendj.ldap.util. + */ +@Test(groups = { "precommit", "util", "sdk" }) +public abstract class UtilTestCase extends ForgeRockTestCase { +} diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1ByteSequenceReaderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1ByteSequenceReaderTestCase.java new file mode 100644 index 000000000..495f6c81b --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1ByteSequenceReaderTestCase.java @@ -0,0 +1,32 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. + */ + +package org.forgerock.opendj.io; + +import org.forgerock.opendj.ldap.ByteSequenceReader; +import org.forgerock.opendj.ldap.ByteString; + +/** + * Test class for ASN1ByteSequenceReaderTestCase. + */ +public class ASN1ByteSequenceReaderTestCase extends ASN1ReaderTestCase { + @Override + protected ASN1Reader getReader(final byte[] b, final int maxElementSize) { + final ByteSequenceReader reader = ByteString.wrap(b).asReader(); + return ASN1.getReader(reader, maxElementSize); + } +} diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1InputStreamReaderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1InputStreamReaderTestCase.java new file mode 100644 index 000000000..b8c0687c3 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1InputStreamReaderTestCase.java @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. + */ +package org.forgerock.opendj.io; + +import java.io.ByteArrayInputStream; + +/** + * Test class for ASN1InputStreamReader. + */ +public class ASN1InputStreamReaderTestCase extends ASN1ReaderTestCase { + @Override + protected ASN1Reader getReader(final byte[] b, final int maxElementSize) { + final ByteArrayInputStream inStream = new ByteArrayInputStream(b); + return new ASN1InputStreamReader(inStream, maxElementSize); + } +} diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1OutputStreamWriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1OutputStreamWriterTestCase.java new file mode 100644 index 000000000..7821b6705 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1OutputStreamWriterTestCase.java @@ -0,0 +1,45 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. + */ +package org.forgerock.opendj.io; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +/** + * Test class for ASN1OutputStreamWriter. + */ +public class ASN1OutputStreamWriterTestCase extends ASN1WriterTestCase { + private final ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + private final ASN1Writer writer = new ASN1OutputStreamWriter(outStream, 1); + + @Override + protected byte[] getEncodedBytes() { + return outStream.toByteArray(); + } + + @Override + protected ASN1Reader getReader(final byte[] encodedBytes) { + final ByteArrayInputStream inStream = new ByteArrayInputStream(encodedBytes); + return new ASN1InputStreamReader(inStream, 0); + } + + @Override + protected ASN1Writer getWriter() { + outStream.reset(); + return writer; + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1ReaderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1ReaderTestCase.java similarity index 96% rename from opendj-core/src/test/java/org/forgerock/opendj/io/ASN1ReaderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1ReaderTestCase.java index 23b943dd1..cee1bc8fc 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1ReaderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1ReaderTestCase.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1WriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1WriterTestCase.java similarity index 95% rename from opendj-core/src/test/java/org/forgerock/opendj/io/ASN1WriterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1WriterTestCase.java index 7fba32ad5..b68dc77d5 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/io/ASN1WriterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/ASN1WriterTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java similarity index 96% rename from opendj-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java index 41335a4bd..5ba17febc 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/io/LDAPReaderWriterTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.io; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AVATestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AVATestCase.java new file mode 100644 index 000000000..b7ac087a7 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AVATestCase.java @@ -0,0 +1,83 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Portions copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static org.assertj.core.api.Assertions.*; + +import org.forgerock.opendj.ldap.schema.AttributeType; +import org.forgerock.opendj.ldap.schema.Schema; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** This class defines a set of tests for the {@link AVA} class. */ +@SuppressWarnings("javadoc") +public class AVATestCase extends SdkTestCase { + + @DataProvider + private Object[][] valueOfDataProvider() { + AttributeType cnAttrType = Schema.getCoreSchema().getAttributeType("commonName"); + return new Object[][] { + { "CN=value", cnAttrType, "CN", "value" }, + { "commonname=value", cnAttrType, "commonname", "value" }, + { "2.5.4.3=#76616C7565", cnAttrType, "2.5.4.3", "value" }, + }; + } + + @Test(dataProvider = "valueOfDataProvider") + public void valueOf(String avaString, AttributeType expectedAttrType, String expectedAttrName, + String expectedValue) throws Exception { + AVA ava = AVA.valueOf(avaString); + assertThat(ava.getAttributeType()).isEqualTo(expectedAttrType); + assertThat(ava.getAttributeName()).isEqualTo(expectedAttrName); + assertThat(ava.getAttributeValue()).isEqualTo(ByteString.valueOfUtf8(expectedValue)); + assertThat(ava.toString()).isEqualTo(avaString); + } + + @Test + public void hexEncodingDoesNotLoseInformation() throws Exception { + final String avaString = "2.5.4.3=#76616C7565"; + final String roundtrippedValue = AVA.valueOf(avaString).toString(); + assertThat(AVA.valueOf(roundtrippedValue).toString()).isEqualTo(avaString); + } + + @DataProvider + public Object[][] toStringShouldStripOutIllegalWhitespaceDataProvider() { + // @formatter:off + return new Object[][] { + { " dc = hello world ", "dc=hello world" }, + { " dc =\\ hello world\\ ", "dc=\\ hello world\\ " }, + }; + // @formatter:on + } + + @Test(dataProvider = "toStringShouldStripOutIllegalWhitespaceDataProvider") + public void toStringShouldStripOutIllegalWhitespace(String withWhiteSpace, String withoutWhiteSpace) { + assertThat(AVA.valueOf(withWhiteSpace).toString()).isEqualTo(withoutWhiteSpace); + assertThat(AVA.valueOf(withWhiteSpace).toNormalizedByteString(new ByteStringBuilder())) + .isEqualTo(AVA.valueOf(withoutWhiteSpace).toNormalizedByteString(new ByteStringBuilder())); + } + + @Test + public void avaConstructedWithValueContainingLeadingAndTrailingSpacesShouldBeEscaped() { + AVA ava = new AVA("dc", " hello world "); + assertThat(ava.toString()).isEqualTo("dc=\\ hello world\\ "); + } + + @Test + public void valueOfDecodesTrailingEscapedChars() { + assertThat(AVA.valueOf("dc=\\41\\42\\43").toString()).isEqualTo("dc=ABC"); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java similarity index 93% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java index 1363c4af7..f62706a55 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AbstractAsynchronousConnectionTestCase.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import java.util.LinkedList; @@ -66,7 +55,6 @@ */ @SuppressWarnings("javadoc") public class AbstractAsynchronousConnectionTestCase extends SdkTestCase { - public final class MockConnection extends AbstractAsynchronousConnection { private final ResultCode resultCode; private final SearchResultEntry[] entries; @@ -76,7 +64,6 @@ public MockConnection(ResultCode resultCode, SearchResultEntry...entries) { this.entries = entries; } - /** {@inheritDoc} */ @Override public LdapPromise abandonAsync(AbandonRequest request) { if (!resultCode.isExceptional()) { @@ -86,86 +73,73 @@ public LdapPromise abandonAsync(AbandonRequest request) { } } - /** {@inheritDoc} */ @Override public LdapPromise addAsync(AddRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(newResult(resultCode)); } - /** {@inheritDoc} */ @Override public void addConnectionEventListener(ConnectionEventListener listener) { // Do nothing. } - /** {@inheritDoc} */ @Override public LdapPromise bindAsync(BindRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(newBindResult(resultCode)); } - /** {@inheritDoc} */ @Override public void close(UnbindRequest request, String reason) { // Do nothing. } - /** {@inheritDoc} */ @Override public LdapPromise compareAsync(CompareRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(newCompareResult(resultCode)); } - /** {@inheritDoc} */ @Override public LdapPromise deleteAsync(DeleteRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(newResult(resultCode)); } - /** {@inheritDoc} */ @Override public LdapPromise extendedRequestAsync(ExtendedRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(request.getResultDecoder().newExtendedErrorResult(resultCode, "", "")); } - /** {@inheritDoc} */ @Override public boolean isClosed() { return false; } - /** {@inheritDoc} */ @Override public boolean isValid() { return true; } - /** {@inheritDoc} */ @Override public LdapPromise modifyAsync(ModifyRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(newResult(resultCode)); } - /** {@inheritDoc} */ @Override public LdapPromise modifyDNAsync(ModifyDNRequest request, IntermediateResponseHandler intermediateResponseHandler) { return getPromiseFromResultCode(newResult(resultCode)); } - /** {@inheritDoc} */ @Override public void removeConnectionEventListener(ConnectionEventListener listener) { // Do nothing. } - /** {@inheritDoc} */ @Override public LdapPromise searchAsync(SearchRequest request, IntermediateResponseHandler intermediateResponseHandler, SearchResultHandler entryHandler) { @@ -184,12 +158,10 @@ private LdapPromise getPromiseFromResultCode(T correctResu } } - /** {@inheritDoc} */ @Override public String toString() { return "MockConnection"; } - } @Test @@ -487,5 +459,4 @@ public void testSingleEntrySearchAsyncRequestFail() throws Exception { verify(exceptionHandler).handleException(any(LdapException.class)); } } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AddressMaskTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AddressMaskTestCase.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/AddressMaskTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AddressMaskTestCase.java index 8108527ef..7dffda579 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AddressMaskTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AddressMaskTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java new file mode 100644 index 000000000..a2c061c46 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributeDescriptionTestCase.java @@ -0,0 +1,544 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertSame; +import static org.testng.Assert.assertTrue; + +import java.util.Arrays; + +import org.assertj.core.api.Assertions; +import org.forgerock.i18n.LocalizedIllegalArgumentException; +import org.forgerock.opendj.ldap.schema.AttributeType; +import org.forgerock.opendj.ldap.schema.Schema; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Test {@link AttributeDescription}. */ +@SuppressWarnings("javadoc") +public final class AttributeDescriptionTestCase extends SdkTestCase { + + @DataProvider + public Object[][] dataForCompareCoreSchema() { + // @formatter:off + return new Object[][] { + // AD1, AD2, compare result, isSubtype, isSuperType + { "cn", "cn", 0, true, true }, + { "cn", "commonName", 0, true, true }, + { " cn", "commonName ", 0, true, true }, + { "commonName", "cn", 0, true, true }, + { "commonName", "commonName", 0, true, true }, + { "cn", "objectClass", 1, false, false }, + { "objectClass", "cn", -1, false, false }, + { "name", "cn", 1, false, true }, + { "cn", "name", -1, true, false }, + { "name;foo", "cn", 1, false, false }, + { "cn;foo", "name", -1, true, false }, + { "name", "cn;foo", 1, false, true }, + { "cn", "name;foo", -1, false, false }, + }; + // @formatter:on + } + + @DataProvider + public Object[][] dataForCompareNoSchema() { + // @formatter:off + return new Object[][] { + // AD1, AD2, compare result, isSubtype, isSuperType + { "cn", "cn", 0, true, true }, + { "cn", "CN", 0, true, true }, + { "CN", "cn", 0, true, true }, + { "CN", "CN", 0, true, true }, + { "cn", "commonName", -1, false, false }, + { "commonName", "cn", 1, false, false }, + { "commonName", "commonName", 0, true, true }, + { "cn", "cn;foo", -1, false, true }, + { "cn;foo", "cn", 1, true, false }, + { "cn;foo", "cn;foo", 0, true, true }, + { "CN;FOO", "cn;foo", 0, true, true }, + { "cn;foo", "CN;FOO", 0, true, true }, + { "CN;FOO", "CN;FOO", 0, true, true }, + { "cn;foo", "cn;bar", 1, false, false }, + { "cn;bar", "cn;foo", -1, false, false }, + + { "cn;xxx;yyy", "cn", 1, true, false }, + { "cn;xxx;yyy", "cn;yyy", 1, true, false }, + { "cn;xxx;yyy", "cn;xxx", 1, true, false }, + { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true }, + { "cn;xxx;yyy", "cn;yyy;xxx", 0, true, true }, + + { "cn", "cn;xxx;yyy", -1, false, true }, + { "cn;yyy", "cn;xxx;yyy", -1, false, true }, + { "cn;xxx", "cn;xxx;yyy", -1, false, true }, + { "cn;xxx;yyy", "cn;xxx;yyy", 0, true, true }, + { "cn;yyy;xxx", "cn;xxx;yyy", 0, true, true }, + }; + // @formatter:on + } + + @DataProvider + public Object[][] dataForValueOfCoreSchema() { + // @formatter:off + return new Object[][] { + // Value, type, isObjectClass + { "cn", "cn", false }, + { "CN", "cn", false }, + { "commonName", "cn", false }, + { "objectclass", "objectClass", true }, + }; + // @formatter:on + } + + @DataProvider + public Object[][] dataForValueOfInvalidAttributeDescriptions() { + // @formatter:off + return new Object[][] { + { "" }, + { " " }, + { ";" }, + { " ; " }, + { "0cn" }, + { "cn+" }, + { "cn;foo+bar" }, + { "cn;foo;foo+bar" }, + { ";foo" }, + { "cn;" }, + { "cn;;foo" }, + { "cn; ;foo" }, + { "cn;foo;" }, + { "cn;foo; " }, + { "cn;foo;;bar" }, + { "cn;foo; ;bar" }, + { "cn;foo;bar;;" }, + { "1a" }, + { "1.a" }, + { "1-" }, + { "1.1a" }, + { "1.1.a" }, + }; + // @formatter:on + } + + @DataProvider + public Object[][] dataForValueOfNoSchema() { + // @formatter:off + return new Object[][] { + // Value, type, options, containsOptions("foo") + { "cn", "cn", new String[0], false }, + { " cn ", "cn", new String[0], false }, + { " cn ", "cn", new String[0], false }, + { "CN", "CN", new String[0], false }, + { "1", "1", new String[0], false }, + { "1.2", "1.2", new String[0], false }, + { "1.2.3", "1.2.3", new String[0], false }, + { "111.222.333", "111.222.333", new String[0], false }, + { "objectClass", "objectClass", new String[0], false }, + { "cn;foo", "cn", new String[] { "foo" }, true }, + { "cn;FOO", "cn", new String[] { "FOO" }, true }, + { "cn;bar", "cn", new String[] { "bar" }, false }, + { "cn;BAR", "cn", new String[] { "BAR" }, false }, + { "cn;foo;bar", "cn", new String[] { "foo", "bar" }, true }, + { "cn;FOO;bar", "cn", new String[] { "FOO", "bar" }, true }, + { "cn;foo;BAR", "cn", new String[] { "foo", "BAR" }, true }, + { "cn;FOO;BAR", "cn", new String[] { "FOO", "BAR" }, true }, + { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true }, + { "cn;BAR;foo", "cn", new String[] { "BAR", "foo" }, true }, + { "cn;bar;FOO", "cn", new String[] { "bar", "FOO" }, true }, + { "cn;BAR;FOO", "cn", new String[] { "BAR", "FOO" }, true }, + { " cn;BAR;FOO ", "cn", new String[] { "BAR", "FOO" }, true }, + { " cn;BAR;FOO ", "cn", new String[] { "BAR", "FOO" }, true }, + { " CN;BAR;FOO ", "CN", new String[] { "BAR", "FOO" }, true }, + { "cn;xxx;yyy;zzz", "cn", new String[] { "xxx", "yyy", "zzz" }, false }, + { "cn;zzz;YYY;xxx", "cn", new String[] { "zzz", "YYY", "xxx" }, false }, + { "CN;zzz;YYY;xxx", "CN", new String[] { "zzz", "YYY", "xxx" }, false }, + }; + // @formatter:on + } + + @Test(dataProvider = "dataForCompareCoreSchema") + public void testCompareCoreSchema(final String ad1, final String ad2, final int compare, + final boolean isSubType, final boolean isSuperType) { + Schema schema = Schema.getCoreSchema(); + compare0(ad1, ad2, compare, isSubType, isSuperType, schema); + } + + @Test(dataProvider = "dataForCompareNoSchema") + public void testCompareNoSchema(final String ad1, final String ad2, final int compare, + final boolean isSubType, final boolean isSuperType) { + Schema schema = Schema.getEmptySchema(); + compare0(ad1, ad2, compare, isSubType, isSuperType, schema); + } + + private void compare0(final String ad1, final String ad2, final int compare, + final boolean isSubType, final boolean isSuperType, final Schema schema) { + final AttributeDescription attributeDescription1 = AttributeDescription.valueOf(ad1, schema); + final AttributeDescription attributeDescription2 = AttributeDescription.valueOf(ad2, schema); + + // Identity. + assertEquals(attributeDescription1, attributeDescription1); + assertEquals(attributeDescription1.compareTo(attributeDescription1), 0); + assertTrue(attributeDescription1.isSubTypeOf(attributeDescription1)); + assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription1)); + + if (compare == 0) { + assertEquals(attributeDescription1, attributeDescription2); + assertEquals(attributeDescription2, attributeDescription1); + assertEquals(attributeDescription1.compareTo(attributeDescription2), 0); + assertEquals(attributeDescription2.compareTo(attributeDescription1), 0); + + assertTrue(attributeDescription1.isSubTypeOf(attributeDescription2)); + assertTrue(attributeDescription1.isSuperTypeOf(attributeDescription2)); + assertTrue(attributeDescription2.isSubTypeOf(attributeDescription1)); + assertTrue(attributeDescription2.isSuperTypeOf(attributeDescription1)); + } else { + assertFalse(attributeDescription1.equals(attributeDescription2)); + assertFalse(attributeDescription2.equals(attributeDescription1)); + + if (compare < 0) { + assertTrue(attributeDescription1.compareTo(attributeDescription2) < 0); + assertTrue(attributeDescription2.compareTo(attributeDescription1) > 0); + } else { + assertTrue(attributeDescription1.compareTo(attributeDescription2) > 0); + assertTrue(attributeDescription2.compareTo(attributeDescription1) < 0); + } + + assertEquals(attributeDescription1.isSubTypeOf(attributeDescription2), isSubType); + assertEquals(attributeDescription1.isSuperTypeOf(attributeDescription2), isSuperType); + } + } + + @Test(dataProvider = "dataForValueOfCoreSchema") + public void testValueOfCoreSchema(final String ad, final String at, final boolean isObjectClass) { + final AttributeDescription attributeDescription = + AttributeDescription.valueOf(ad, Schema.getCoreSchema()); + + assertEquals(attributeDescription.toString(), ad); + assertEquals(attributeDescription.getNameOrOID(), ad); + assertEquals(attributeDescription.getAttributeType().getNameOrOID(), at); + assertEquals(attributeDescription.isObjectClass(), isObjectClass); + + assertFalse(attributeDescription.hasOptions()); + assertFalse(attributeDescription.hasOption("dummy")); + + Assertions.assertThat(attributeDescription.getOptions()).isEmpty(); + } + + /** FIXME: none of these pass! The valueOf method is far too lenient. */ + @Test(dataProvider = "dataForValueOfInvalidAttributeDescriptions", + expectedExceptions = LocalizedIllegalArgumentException.class) + public void testValueOfInvalidAttributeDescriptions(final String ad) { + AttributeDescription.valueOf(ad, Schema.getEmptySchema()); + } + + @Test(dataProvider = "dataForValueOfNoSchema") + public void testValueOfNoSchema(final String ad, final String at, final String[] options, + final boolean containsFoo) { + final AttributeDescription attributeDescription = + AttributeDescription.valueOf(ad, Schema.getEmptySchema()); + + assertEquals(attributeDescription.toString(), ad); + assertEquals(attributeDescription.getAttributeType().getNameOrOID(), at); + assertFalse(attributeDescription.isObjectClass()); + + assertOptions(attributeDescription, options); + assertFalse(attributeDescription.hasOption("dummy")); + if (containsFoo) { + assertTrue(attributeDescription.hasOption("foo")); + assertTrue(attributeDescription.hasOption("FOO")); + assertTrue(attributeDescription.hasOption("FoO")); + } else { + assertFalse(attributeDescription.hasOption("foo")); + assertFalse(attributeDescription.hasOption("FOO")); + assertFalse(attributeDescription.hasOption("FoO")); + } + } + + private void assertOptions(final AttributeDescription attributeDescription, final String... options) { + assertEquals(attributeDescription.hasOptions(), options.length != 0); + for (final String option : options) { + assertTrue(attributeDescription.hasOption(option)); + } + + Assertions.assertThat(attributeDescription.getOptions()).containsExactly(options); + } + + @Test + public void testWithOptionAddFirstOption() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn"); + AttributeDescription ad2 = ad1.withOption("test"); + assertOptions(ad2, "test"); + assertFalse(ad2.hasOption("dummy")); + assertEquals(ad2.toString(), "cn;test"); + } + + @Test + public void testWithOptionAddExistingFirstOption() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test"); + AttributeDescription ad2 = ad1.withOption("test"); + assertSame(ad1, ad2); + } + + @Test + public void testWithOptionAddSecondOption() { + testWithOptionAddSecondOption("test1", "test2"); + } + + @Test + public void testWithOptionAddSecondOption2() { + testWithOptionAddSecondOption("test2", "test1"); + } + + private void testWithOptionAddSecondOption(String option1, String option2) { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;" + option1); + AttributeDescription ad2 = ad1.withOption(option2); + assertOptions(ad2, option1, option2); + assertFalse(ad2.hasOption("dummy")); + assertEquals(ad2.toString(), toAttributeDescriptionString("cn", option1, option2)); + } + + @Test + public void testWithOptionAddExistingSecondOption() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); + AttributeDescription ad2 = ad1.withOption("test1"); + AttributeDescription ad3 = ad1.withOption("test2"); + assertSame(ad1, ad2); + assertSame(ad1, ad3); + } + + @Test + public void testWithOptionAddMultipleOptions() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); + AttributeDescription ad2 = ad1.withOption("test4").withOption("test3"); + assertOptions(ad2, "test1", "test2", "test4", "test3"); + assertFalse(ad2.hasOption("dummy")); + assertEquals(ad2.toString(), "cn;test1;test2;test4;test3"); + } + + @Test + public void testWithOptionAddMultipleOptions2() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); + AttributeDescription ad2 = ad1.withOption("test0"); + assertOptions(ad2, "test1", "test2", "test0"); + assertFalse(ad2.hasOption("dummy")); + assertEquals(ad2.toString(), "cn;test1;test2;test0"); + } + + @Test + public void testWithoutOptionEmpty() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn"); + AttributeDescription ad2 = ad1.withoutOption("test"); + assertSame(ad1, ad2); + } + + @Test + public void testWithoutOptionFirstOption() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test"); + AttributeDescription ad2 = ad1.withoutOption("test"); + assertOptions(ad2); + assertFalse(ad2.hasOption("test")); + assertEquals(ad2.toString(), "cn"); + } + + @Test + public void testWithoutOptionFirstOptionMissing() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test"); + AttributeDescription ad2 = ad1.withoutOption("dummy"); + assertSame(ad1, ad2); + } + + @Test + public void testWithoutOptionSecondOption1() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); + AttributeDescription ad2 = ad1.withoutOption("test1"); + assertOptions(ad2, "test2"); + assertFalse(ad2.hasOption("test1")); + assertEquals(ad2.toString(), "cn;test2"); + } + + @Test + public void testWithoutOptionSecondOption2() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); + AttributeDescription ad2 = ad1.withoutOption("test2"); + assertOptions(ad2, "test1"); + assertFalse(ad2.hasOption("test2")); + assertEquals(ad2.toString(), "cn;test1"); + } + + @Test + public void testWithoutOptionSecondOptionMissing() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2"); + AttributeDescription ad2 = ad1.withoutOption("dummy"); + assertSame(ad1, ad2); + } + + @Test + public void testWithoutOptionThirdOption1() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); + AttributeDescription ad2 = ad1.withoutOption("test1"); + assertOptions(ad2, "test2", "test3"); + assertFalse(ad2.hasOption("test1")); + assertEquals(ad2.toString(), "cn;test2;test3"); + } + + @Test + public void testWithoutOptionThirdOption2() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); + AttributeDescription ad2 = ad1.withoutOption("test2"); + assertOptions(ad2, "test1", "test3"); + assertFalse(ad2.hasOption("test2")); + assertEquals(ad2.toString(), "cn;test1;test3"); + } + + @Test + public void testWithoutOptionThirdOption3() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); + AttributeDescription ad2 = ad1.withoutOption("test3"); + assertOptions(ad2, "test1", "test2"); + assertFalse(ad2.hasOption("test3")); + assertEquals(ad2.toString(), "cn;test1;test2"); + } + + @Test + public void testWithoutOptionThirdOptionMissing() { + AttributeDescription ad1 = AttributeDescription.valueOf("cn;test1;test2;test3"); + AttributeDescription ad2 = ad1.withoutOption("dummy"); + assertSame(ad1, ad2); + } + + @Test + public void testCreateAttributeType() { + Schema schema = Schema.getCoreSchema(); + AttributeType attributeType = schema.getAttributeType("cn"); + String name = attributeType.getNameOrOID(); + + assertAttributeDescriptionCreate( + AttributeDescription.create(attributeType), + name, attributeType); + } + + @Test + public void testCreateAttributeNameAndType() { + Schema schema = Schema.getCoreSchema(); + String name = "CN"; + AttributeType attributeType = schema.getAttributeType(name); + + assertAttributeDescriptionCreate( + AttributeDescription.create(name, attributeType), + name, attributeType); + } + + @Test + public void testCreateAttributeTypeAndOption() { + Schema schema = Schema.getCoreSchema(); + AttributeType attributeType = schema.getAttributeType("cn"); + String name = attributeType.getNameOrOID(); + + assertAttributeDescriptionCreate( + AttributeDescription.create(attributeType, "option"), + name, attributeType, "option"); + } + + @Test + public void testCreateAttributeNameTypeAndOption() { + Schema schema = Schema.getCoreSchema(); + String name = "CN"; + AttributeType attributeType = schema.getAttributeType(name); + + assertAttributeDescriptionCreate( + AttributeDescription.create(name, attributeType, "option"), + name, attributeType, "option"); + } + + @Test + public void testCreateAttributeTypeAndOptionsArray() { + Schema schema = Schema.getCoreSchema(); + AttributeType attributeType = schema.getAttributeType("cn"); + String name = attributeType.getNameOrOID(); + + String[] options = { "option1", "option2" }; + assertAttributeDescriptionCreate( + AttributeDescription.create(attributeType, options), + name, attributeType, options); + } + + @Test + public void testCreateAttributeNameTypeAndOptionsArray() { + Schema schema = Schema.getCoreSchema(); + String name = "CN"; + AttributeType attributeType = schema.getAttributeType(name); + + String[] options = { "option1", "option2" }; + assertAttributeDescriptionCreate( + AttributeDescription.create(name, attributeType, options), + name, attributeType, options); + } + + @Test + public void testCreateAttributeTypeAndOptionsCollection() { + Schema schema = Schema.getCoreSchema(); + AttributeType attributeType = schema.getAttributeType("cn"); + String name = attributeType.getNameOrOID(); + + String[] options = { "option1", "option2" }; + assertAttributeDescriptionCreate( + AttributeDescription.create(attributeType, Arrays.asList(options)), + name, attributeType, options); + } + + @Test + public void testCreateAttributeNameTypeAndNoOptionsCollection() { + testCreateAttributeNameTypeAndOptionsCollection(); + } + + @Test + public void testCreateAttributeNameTypeAndOneOptionCollection() { + testCreateAttributeNameTypeAndOptionsCollection("option"); + } + + @Test + public void testCreateAttributeNameTypeAndTwoOptionsCollection() { + testCreateAttributeNameTypeAndOptionsCollection("option1", "option2"); + } + + private void testCreateAttributeNameTypeAndOptionsCollection(String... options) { + Schema schema = Schema.getCoreSchema(); + String name = "CN"; + AttributeType attributeType = schema.getAttributeType(name); + + assertAttributeDescriptionCreate( + AttributeDescription.create(name, attributeType, Arrays.asList(options)), + name, attributeType, options); + } + + private void assertAttributeDescriptionCreate(AttributeDescription attrDesc, + String name, AttributeType attributeType, String... options) { + assertEquals(attrDesc.getAttributeType(), attributeType); + assertEquals(attrDesc.getNameOrOID(), name); + assertOptions(attrDesc, options); + assertEquals(attrDesc.toString(), toAttributeDescriptionString(name, options)); + } + + private String toAttributeDescriptionString(String name, String... options) { + StringBuilder sb = new StringBuilder(name); + for (String option : options) { + sb.append(";").append(option); + } + return sb.toString(); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java similarity index 93% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java index 2acdcd05f..56da51263 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributeParserTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2012-2015 ForgeRock AS. + * Copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributesTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributesTestCase.java similarity index 79% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributesTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributesTestCase.java index 79d8421ef..d31dce9e4 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AttributesTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/AttributesTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceReaderTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceReaderTest.java similarity index 92% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceReaderTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceReaderTest.java index 54ccd39eb..2b60f1890 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceReaderTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceReaderTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java similarity index 86% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java index 9de5758b1..e7617427c 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteSequenceTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java similarity index 93% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java index 031964db1..b3134d95e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteStringBuilderTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -304,16 +294,16 @@ private Object[][] byteStringBuilderProvider() throws Exception { b(0xFF), b(0xFF), b(0xFF), b(0xFF), b(0xFF) } }, { new ByteStringBuilder(11).appendUtf8("this is a").appendUtf8(" test"), "this is a test".getBytes("UTF-8") }, - { new ByteStringBuilder().appendObject((Object) "this is a").appendObject((Object) " test"), + { new ByteStringBuilder().appendObject("this is a").appendObject(" test"), "this is a test".getBytes("UTF-8") }, { new ByteStringBuilder().appendUtf8("this is a".toCharArray()).appendUtf8( " test".toCharArray()), "this is a test".getBytes("UTF-8") }, { - new ByteStringBuilder().appendObject((Object) "this is a".toCharArray()).appendObject( - (Object) " test".toCharArray()), "this is a test".getBytes("UTF-8") }, + new ByteStringBuilder().appendObject("this is a".toCharArray()).appendObject( + " test".toCharArray()), "this is a test".getBytes("UTF-8") }, { - new ByteStringBuilder().appendObject((Object) EIGHT_BYTES).appendObject((Object) EIGHT_BYTES), + new ByteStringBuilder().appendObject(EIGHT_BYTES).appendObject(EIGHT_BYTES), new byte[] { b(0x01), b(0x02), b(0x03), b(0x04), b(0x05), b(0x06), b(0x07), b(0x08), b(0x01), b(0x02), b(0x03), b(0x04), b(0x05), b(0x06), b(0x07), b(0x08) } }, diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java similarity index 91% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java index fb3a378c6..5fe9304de 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ByteStringTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -77,13 +67,13 @@ public Object[][] byteSequenceProvider() throws Exception { new byte[] { (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 } }, { ByteString.valueOfUtf8("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") }, - { ByteString.valueOfObject((Object) "cn=testvalue"), "cn=testvalue".getBytes("UTF-8") }, + { ByteString.valueOfObject("cn=testvalue"), "cn=testvalue".getBytes("UTF-8") }, { ByteString.valueOfUtf8("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") }, - { ByteString.valueOfObject((Object) "cn=testvalue".toCharArray()), + { ByteString.valueOfObject("cn=testvalue".toCharArray()), "cn=testvalue".getBytes("UTF-8") }, { ByteString.valueOfBytes(new byte[0]), new byte[0] }, { ByteString.valueOfBytes(testBytes), testBytes }, - { ByteString.valueOfObject((Object) testBytes), testBytes }, + { ByteString.valueOfObject(testBytes), testBytes }, { ByteString.valueOfObject(ByteString.valueOfUtf8("cn=testvalue")), "cn=testvalue".getBytes("UTF-8") }, { ByteString.wrap(new byte[0]), new byte[0] }, @@ -266,7 +256,7 @@ public void testValueOfBase64(final String hexData, final String encodedData) th @Test public void testToHex() throws Exception { ByteString byteString = new ByteStringBuilder().appendUtf8("org=example").toByteString(); - assertThat(byteString.toHexString()).isEqualTo("6F 72 67 3D 65 78 61 6D 70 6C 65"); + assertThat(byteString.toHexString()).isEqualTo("6F72673D6578616D706C65"); assertThat(ByteString.empty().toHexString()).isEqualTo(""); } @@ -342,6 +332,13 @@ public void testValueOfHex() { assertThat(byteString.toString()).isEqualTo("cn=testvalue"); } + @Test + public void testToHexValueOfHex() { + ByteString bs = ByteString.valueOfUtf8("cn=testvalue"); + ByteString roundtrippedBS = ByteString.valueOfHex(bs.toHexString()); + assertThat(roundtrippedBS).isEqualTo(bs); + } + @Test public void testValueOfEmptyHex() { ByteString byteString = ByteString.valueOfHex(""); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/CompactDnTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/CompactDnTestCase.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/CompactDnTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/CompactDnTestCase.java index 4dceee4d6..2b26ad0bb 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/CompactDnTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/CompactDnTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConditionResultTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConditionResultTestCase.java similarity index 84% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ConditionResultTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConditionResultTestCase.java index 555a7979c..c61adf970 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConditionResultTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConditionResultTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2008 Sun Microsystems, Inc. - * Portions Copyright 2014-2015 ForgeRock AS + * Copyright 2008 Sun Microsystems, Inc. + * Portions Copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java similarity index 95% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java index c1512adc2..3261d9850 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConnectionPoolTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java new file mode 100644 index 000000000..5d72977c8 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ConnectionsTestCase.java @@ -0,0 +1,152 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2013-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.forgerock.opendj.ldap.Connections.newShardedRequestLoadBalancerFunction; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.verifyZeroInteractions; +import static org.mockito.Mockito.when; + +import org.forgerock.opendj.ldap.requests.AddRequest; +import org.forgerock.opendj.ldap.requests.CRAMMD5SASLBindRequest; +import org.forgerock.opendj.ldap.requests.CompareRequest; +import org.forgerock.opendj.ldap.requests.DeleteRequest; +import org.forgerock.opendj.ldap.requests.DigestMD5SASLBindRequest; +import org.forgerock.opendj.ldap.requests.GSSAPISASLBindRequest; +import org.forgerock.opendj.ldap.requests.GenericExtendedRequest; +import org.forgerock.opendj.ldap.requests.ModifyDNRequest; +import org.forgerock.opendj.ldap.requests.ModifyRequest; +import org.forgerock.opendj.ldap.requests.PasswordModifyExtendedRequest; +import org.forgerock.opendj.ldap.requests.PlainSASLBindRequest; +import org.forgerock.opendj.ldap.requests.Request; +import org.forgerock.opendj.ldap.requests.SearchRequest; +import org.forgerock.opendj.ldap.requests.SimpleBindRequest; +import org.forgerock.util.Function; +import org.forgerock.util.promise.NeverThrowsException; +import org.testng.annotations.Test; + +@SuppressWarnings("javadoc") +public class ConnectionsTestCase extends SdkTestCase { + + @Test + public void testUncloseableConnectionClose() throws Exception { + final Connection connection = mock(Connection.class); + final Connection uncloseable = Connections.uncloseable(connection); + uncloseable.close(); + verifyZeroInteractions(connection); + } + + @Test + public void testUncloseableConnectionNotClose() throws Exception { + final Connection connection = mock(Connection.class); + final Connection uncloseable = Connections.uncloseable(connection); + uncloseable.applyChange(null); + verify(connection).applyChange(null); + } + + @Test + public void testUncloseableConnectionUnbind() throws Exception { + final Connection connection = mock(Connection.class); + final Connection uncloseable = Connections.uncloseable(connection); + uncloseable.close(null, null); + verifyZeroInteractions(connection); + } + + @Test + public void shardedRequestLoadBalancerUsesConsistentIndexing() { + final Function f = + newShardedRequestLoadBalancerFunction(asList(mock(ConnectionFactory.class), + mock(ConnectionFactory.class))); + + // These two DNs have a different hash code. + final DN dn1 = DN.valueOf("cn=target1,dc=example,dc=com"); + final DN dn2 = DN.valueOf("cn=target2,dc=example,dc=com"); + + final AddRequest addRequest = mock(AddRequest.class); + when(addRequest.getName()).thenReturn(dn1, dn2); + final int dn1index = index(f, addRequest); + final int dn2index = index(f, addRequest); + assertThat(dn1index).isNotEqualTo(dn2index); + + final SimpleBindRequest simpleBindRequest = mock(SimpleBindRequest.class); + when(simpleBindRequest.getName()).thenReturn(dn1.toString(), dn2.toString()); + assertRequestsAreRoutedConsistently(f, simpleBindRequest, dn1index, dn2index); + + final CompareRequest compareRequest = mock(CompareRequest.class); + when(compareRequest.getName()).thenReturn(dn1, dn2); + assertRequestsAreRoutedConsistently(f, compareRequest, dn1index, dn2index); + + final DeleteRequest deleteRequest = mock(DeleteRequest.class); + when(deleteRequest.getName()).thenReturn(dn1, dn2); + assertRequestsAreRoutedConsistently(f, deleteRequest, dn1index, dn2index); + + final ModifyRequest modifyRequest = mock(ModifyRequest.class); + when(modifyRequest.getName()).thenReturn(dn1, dn2); + assertRequestsAreRoutedConsistently(f, modifyRequest, dn1index, dn2index); + + final ModifyDNRequest modifyDNRequest = mock(ModifyDNRequest.class); + when(modifyDNRequest.getName()).thenReturn(dn1, dn2); + assertRequestsAreRoutedConsistently(f, modifyDNRequest, dn1index, dn2index); + + final SearchRequest searchRequest = mock(SearchRequest.class); + when(searchRequest.getName()).thenReturn(dn1, dn2); + assertRequestsAreRoutedConsistently(f, searchRequest, dn1index, dn2index); + + // Authzid based operations. + final String authzid1 = "dn:" + dn1.toString(); + final String authzid2 = "dn:" + dn2.toString(); + + final PasswordModifyExtendedRequest passwordModifyRequest = mock(PasswordModifyExtendedRequest.class); + when(passwordModifyRequest.getUserIdentityAsString()).thenReturn(authzid1, authzid2); + assertRequestsAreRoutedConsistently(f, passwordModifyRequest, dn1index, dn2index); + + final PlainSASLBindRequest plainSASLBindRequest = mock(PlainSASLBindRequest.class); + when(plainSASLBindRequest.getAuthenticationID()).thenReturn(authzid1, authzid2); + assertRequestsAreRoutedConsistently(f, plainSASLBindRequest, dn1index, dn2index); + + final CRAMMD5SASLBindRequest cramMD5SASLBindRequest = mock(CRAMMD5SASLBindRequest.class); + when(cramMD5SASLBindRequest.getAuthenticationID()).thenReturn(authzid1, authzid2); + assertRequestsAreRoutedConsistently(f, cramMD5SASLBindRequest, dn1index, dn2index); + + final DigestMD5SASLBindRequest digestMD5SASLBindRequest = mock(DigestMD5SASLBindRequest.class); + when(digestMD5SASLBindRequest.getAuthenticationID()).thenReturn(authzid1, authzid2); + assertRequestsAreRoutedConsistently(f, digestMD5SASLBindRequest, dn1index, dn2index); + + final GSSAPISASLBindRequest gssapiSASLBindRequest = mock(GSSAPISASLBindRequest.class); + when(gssapiSASLBindRequest.getAuthenticationID()).thenReturn(authzid1, authzid2); + assertRequestsAreRoutedConsistently(f, gssapiSASLBindRequest, dn1index, dn2index); + + // Requests that have no target will return a random index, but since we only have one factory the index will + // always be 0. + final GenericExtendedRequest genericExtendedRequest = mock(GenericExtendedRequest.class); + assertThat(index(f, genericExtendedRequest)).isBetween(0, 1); + } + + private void assertRequestsAreRoutedConsistently(final Function f, + final Request r, + final int firstExpectedIndex, + final int secondExpectedIndex) { + assertThat(index(f, r)).isEqualTo(firstExpectedIndex); + assertThat(index(f, r)).isEqualTo(secondExpectedIndex); + } + + private int index(final Function function, final Request request) { + return function.apply(request); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java similarity index 71% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java index e08bc7090..6c03e6f83 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/DNTestCase.java @@ -1,38 +1,34 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; -import static java.lang.Integer.*; - -import static org.fest.assertions.Assertions.*; -import static org.testng.Assert.*; +import static java.lang.Integer.signum; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; +import java.util.Collection; import java.util.Iterator; +import java.util.Map; import java.util.NoSuchElementException; +import java.util.TreeMap; +import java.util.UUID; import org.forgerock.i18n.LocalizedIllegalArgumentException; import org.testng.annotations.DataProvider; @@ -50,13 +46,19 @@ public class DNTestCase extends SdkTestCase { */ @DataProvider(name = "createChildDNTestData") public Object[][] createChildDNTestData() { - return new Object[][] { { "", "", "" }, { "", "dc=org", "dc=org" }, - { "", "dc=opendj,dc=org", "dc=opendj,dc=org" }, { "dc=org", "", "dc=org" }, + // @formatter:off + return new Object[][] { + { "", "", "" }, + { "", "dc=org", "dc=org" }, + { "", "dc=opendj,dc=org", "dc=opendj,dc=org" }, + { "dc=org", "", "dc=org" }, { "dc=org", "dc=opendj", "dc=opendj,dc=org" }, { "dc=org", "dc=foo,dc=opendj", "dc=foo,dc=opendj,dc=org" }, { "dc=opendj,dc=org", "", "dc=opendj,dc=org" }, { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" }, - { "dc=opendj,dc=org", "dc=bar,dc=foo", "dc=bar,dc=foo,dc=opendj,dc=org" }, }; + { "dc=opendj,dc=org", "dc=bar,dc=foo", "dc=bar,dc=foo,dc=opendj,dc=org" }, + }; + // @formatter:on } /** @@ -66,9 +68,14 @@ public Object[][] createChildDNTestData() { */ @DataProvider(name = "createChildRDNTestData") public Object[][] createChildRDNTestData() { - return new Object[][] { { "", "dc=org", "dc=org" }, + // @formatter:off + return new Object[][] { + { "", "dc=org", "dc=org" }, { "dc=org", "dc=opendj", "dc=opendj,dc=org" }, - { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" }, }; + { "dc=opendj,dc=org", "dc=foo", "dc=foo,dc=opendj,dc=org" }, + }; + // @formatter:on + } /** @@ -78,6 +85,7 @@ public Object[][] createChildRDNTestData() { */ @DataProvider(name = "testDNs") public Object[][] createData() { + // @formatter:off return new Object[][] { { "", "", "" }, { " ", "", "" }, @@ -98,7 +106,7 @@ public Object[][] createData() { "cn=doe+givenname=john,ou=people,dc=example,dc=com", "givenName=John+cn=Doe,ou=People,dc=example,dc=com" }, { "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com", - "givenname=john\\+cn\\=doe,ou=people,dc=example,dc=com", + "givenname=john\\+cn=doe,ou=people,dc=example,dc=com", "givenName=John\\+cn=Doe,ou=People,dc=example,dc=com" }, { "cn=Doe\\, John,ou=People,dc=example,dc=com", "cn=doe\\, john,ou=people,dc=example,dc=com", @@ -120,7 +128,7 @@ public Object[][] createData() { "cn=before after,dc=example,dc=net", "CN=Before\\0dAfter,DC=example,DC=net" }, { "2.5.4.3=#04024869", // Unicode codepoints from 0000-0008 are mapped to nothing. - "cn=hi", "2.5.4.3=\\04\\02Hi" }, + "cn=hi", "2.5.4.3=#04024869" }, { "1.1.1=", "1.1.1=", "1.1.1=" }, { "CN=Lu\\C4\\8Di\\C4\\87", "cn=lu\u010di\u0107", "CN=Lu\u010di\u0107" }, { "ou=\\e5\\96\\b6\\e6\\a5\\ad\\e9\\83\\a8,o=Airius", "ou=\u55b6\u696d\u90e8,o=airius", @@ -130,8 +138,12 @@ public Object[][] createData() { { "OU= Sales + CN = J. Smith ,DC=example,DC=net", "cn=j. smith+ou=sales,dc=example,dc=net", "OU=Sales+CN=J. Smith,DC=example,DC=net" }, { "cn=John+dc=", "dc=+cn=john", "cn=John+dc=" }, - { "O=\"Sue, Grabbit and Runn\",C=US", "o=sue\\, grabbit and runn,c=us", - "O=Sue\\, Grabbit and Runn,C=US" }, }; + { "O=\"Sue, Grabbit + Runn\",C=US", "o=sue\\, grabbit \\+ runn,c=us", + "O=Sue\\, Grabbit \\+ Runn,C=US" }, + { "O=\"John \\\"Tiger\\\" Smith\",C=US", "o=john \\\"tiger\\\" smith,c=us", + "O=John \\\"Tiger\\\" Smith,C=US" }, + }; + // @formatter:on } /** @@ -141,22 +153,19 @@ public Object[][] createData() { */ @DataProvider(name = "createDNComparisonData") public Object[][] createDNComparisonData() { - return new Object[][] { { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 }, + // @formatter:off + return new Object[][] { + { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 }, { "cn=hello world,dc=com", "CN=hello world,dc=com", 0 }, { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 }, { " cn = hello world ,dc=com", "cn=hello world,dc=com", 0 }, { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 }, { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 }, { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 }, - /* - * { "x-test-integer-type=10,dc=com", - * "x-test-integer-type=9,dc=com", 1 }, { - * "x-test-integer-type=999,dc=com", - * "x-test-integer-type=1000,dc=com", -1 }, { - * "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com", - * -1 }, { "x-test-integer-type=0,dc=com", - * "x-test-integer-type=-1,dc=com", 1 }, - **/ + { "governingStructureRule=10,dc=com", "governingStructureRule=9,dc=com", 1 }, + { "governingStructureRule=999,dc=com", "governingStructureRule=1000,dc=com", -1 }, + { "governingStructureRule=-1,dc=com", "governingStructureRule=0,dc=com", -1 }, + { "governingStructureRule=0,dc=com", "governingStructureRule=-1,dc=com", 1 }, { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 }, { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 }, { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 }, { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 }, { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 }, @@ -165,7 +174,9 @@ public Object[][] createDNComparisonData() { { "dc=ccc,dc=aaa", "dc=bbb", -1 }, { "dc=aaa,dc=bbb", "dc=bbb", 1 }, { "dc=bbb,dc=bbb", "dc=bbb", 1 }, { "dc=ccc,dc=bbb", "dc=bbb", 1 }, { "dc=aaa,dc=ccc", "dc=bbb", 1 }, { "dc=bbb,dc=ccc", "dc=bbb", 1 }, - { "dc=ccc,dc=ccc", "dc=bbb", 1 }, { "", "dc=bbb", -1 }, { "dc=bbb", "", 1 } }; + { "dc=ccc,dc=ccc", "dc=bbb", 1 }, { "", "dc=bbb", -1 }, { "dc=bbb", "", 1 } + }; + // @formatter:on } /** @@ -175,26 +186,40 @@ public Object[][] createDNComparisonData() { */ @DataProvider(name = "createDNEqualityData") public Object[][] createDNEqualityData() { - return new Object[][] { { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 }, + // @formatter:off + return new Object[][] { + { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 }, { "cn=hello world,dc=com", "CN=hello world,dc=com", 0 }, { "cn=hello world,dc=com", "cn=hello world,dc=com", 0 }, { " cn = hello world ,dc=com", "cn=hello world,dc=com", 0 }, { "cn=hello world\\ ,dc=com", "cn=hello world,dc=com", 0 }, { "cn=HELLO WORLD,dc=com", "cn=hello world,dc=com", 0 }, { "cn=HELLO+sn=WORLD,dc=com", "sn=world+cn=hello,dc=com", 0 }, - { "x-test-integer-type=10,dc=com", "x-test-integer-type=9,dc=com", 1 }, - { "x-test-integer-type=999,dc=com", "x-test-integer-type=1000,dc=com", -1 }, - { "x-test-integer-type=-1,dc=com", "x-test-integer-type=0,dc=com", -1 }, - { "x-test-integer-type=0,dc=com", "x-test-integer-type=-1,dc=com", 1 }, - { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 }, { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 }, - { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 }, { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 }, - { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 }, - { "cn=aaab,dc=com", "cn=aaaa,dc=com", 1 }, { "cn=aaaa,dc=com", "cn=aaab,dc=com", -1 }, - { "dc=aaa,dc=aaa", "dc=bbb", -1 }, { "dc=bbb,dc=aaa", "dc=bbb", -1 }, - { "dc=ccc,dc=aaa", "dc=bbb", -1 }, { "dc=aaa,dc=bbb", "dc=bbb", 1 }, - { "dc=bbb,dc=bbb", "dc=bbb", 1 }, { "dc=ccc,dc=bbb", "dc=bbb", 1 }, - { "dc=aaa,dc=ccc", "dc=bbb", 1 }, { "dc=bbb,dc=ccc", "dc=bbb", 1 }, - { "dc=ccc,dc=ccc", "dc=bbb", 1 }, { "", "dc=bbb", -1 }, { "dc=bbb", "", 1 } }; + { "governingStructureRule=10,dc=com", "governingStructureRule=9,dc=com", 1 }, + { "governingStructureRule=999,dc=com", "governingStructureRule=1000,dc=com", -1 }, + { "governingStructureRule=-1,dc=com", "governingStructureRule=0,dc=com", -1 }, + { "governingStructureRule=0,dc=com", "governingStructureRule=-1,dc=com", 1 }, + { "cn=aaa,dc=com", "cn=aaaa,dc=com", -1 }, + { "cn=AAA,dc=com", "cn=aaaa,dc=com", -1 }, + { "cn=aaa,dc=com", "cn=AAAA,dc=com", -1 }, + { "cn=aaaa,dc=com", "cn=aaa,dc=com", 1 }, + { "cn=AAAA,dc=com", "cn=aaa,dc=com", 1 }, + { "cn=aaaa,dc=com", "cn=AAA,dc=com", 1 }, + { "cn=aaab,dc=com", "cn=aaaa,dc=com", 1 }, + { "cn=aaaa,dc=com", "cn=aaab,dc=com", -1 }, + { "dc=aaa,dc=aaa", "dc=bbb", -1 }, + { "dc=bbb,dc=aaa", "dc=bbb", -1 }, + { "dc=ccc,dc=aaa", "dc=bbb", -1 }, + { "dc=aaa,dc=bbb", "dc=bbb", 1 }, + { "dc=bbb,dc=bbb", "dc=bbb", 1 }, + { "dc=ccc,dc=bbb", "dc=bbb", 1 }, + { "dc=aaa,dc=ccc", "dc=bbb", 1 }, + { "dc=bbb,dc=ccc", "dc=bbb", 1 }, + { "dc=ccc,dc=ccc", "dc=bbb", 1 }, + { "", "dc=bbb", -1 }, + { "dc=bbb", "", 1 } + }; + // @formatter:on } /** @@ -204,7 +229,10 @@ public Object[][] createDNEqualityData() { */ @DataProvider(name = "illegalDNs") public Object[][] createIllegalData() { - return new Object[][] { { "manager" }, { "manager " }, + // @formatter:off + return new Object[][] { + { "manager" }, + { "manager " }, { "=Jim" }, { " =Jim" }, { "= Jim" }, @@ -214,18 +242,41 @@ public Object[][] createIllegalData() { { "cn=Jim+" }, { "cn=Jim+manager" }, { "cn=Jim+manager " }, - { "cn=Jim+manager," }, // { "cn=Jim," }, { "cn=Jim, " }, { - // "c[n]=Jim" }, - { "_cn=Jim" }, { "c_n=Jim" }, { "cn\"=Jim" }, { "c\"n=Jim" }, { "1cn=Jim" }, - { "cn+uid=Jim" }, { "-cn=Jim" }, { "/tmp=a" }, { "\\tmp=a" }, { "cn;lang-en=Jim" }, - { "@cn=Jim" }, { "_name_=Jim" }, + { "cn=Jim+manager," }, + { "cn=Jim," }, + { "cn=Jim, " }, + { "c[n]=Jim" }, + { "_cn=Jim" }, + { "c_n=Jim" }, + { "cn\"=Jim" }, + { "c\"n=Jim" }, + { "1cn=Jim" }, + { "cn+uid=Jim" }, + { "-cn=Jim" }, + { "/tmp=a" }, + { "\\tmp=a" }, + { "cn;lang-en=Jim" }, + { "@cn=Jim" }, + { "_name_=Jim" }, { "\u03c0=pi" }, - { "v1.0=buggy" }, // { "1.=buggy" }, { ".1=buggy" }, - { "oid.1." }, { "1.3.6.1.4.1.1466..0=#04024869" }, { "cn=#a" }, { "cn=#ag" }, - { "cn=#ga" }, { "cn=#abcdefgh" }, - { "cn=a\\b" }, // { "cn=a\\bg" }, { "cn=\"hello" }, - { "cn=+mail=,dc=example,dc=com" }, { "cn=xyz+sn=,dc=example,dc=com" }, - { "cn=,dc=example,dc=com" } }; + { "v1.0=buggy" }, + { "1.=buggy" }, + { ".1=buggy" }, + { "oid.1." }, + { "1.3.6.1.4.1.1466..0=#04024869" }, + { "cn=#a" }, + { "cn=#ag" }, + { "cn=#ga" }, + { "cn=#abcdefgh" }, + { "cn=a\\b" }, + { "cn=a\\bg" }, + { "cn=\"hello" }, + { "cn=+mail=,dc=example,dc=com" }, + { "cn=xyz+sn=,dc=example,dc=com" }, + { "cn=,dc=example,dc=com" }, + { "cn=a+cn=b,dc=example,dc=com" } + }; + // @formatter:on } /** @@ -235,11 +286,17 @@ public Object[][] createIllegalData() { */ @DataProvider(name = "createIsChildOfTestData") public Object[][] createIsChildOfTestData() { - return new Object[][] { { "", "", false }, { "", "dc=org", false }, - { "", "dc=opendj,dc=org", false }, { "", "dc=foo,dc=opendj,dc=org", false }, - { "dc=org", "", true }, { "dc=org", "dc=org", false }, + // @formatter:off + return new Object[][] { + { "", "", false }, + { "", "dc=org", false }, + { "", "dc=opendj,dc=org", false }, + { "", "dc=foo,dc=opendj,dc=org", false }, + { "dc=org", "", true }, + { "dc=org", "dc=org", false }, { "dc=org", "dc=opendj,dc=org", false }, - { "dc=org", "dc=foo,dc=opendj,dc=org", false }, { "dc=opendj,dc=org", "", false }, + { "dc=org", "dc=foo,dc=opendj,dc=org", false }, + { "dc=opendj,dc=org", "", false }, { "dc=opendj,dc=org", "dc=org", true }, { "dc=opendj,dc=org", "dc=opendj,dc=org", false }, { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false }, @@ -247,8 +304,11 @@ public Object[][] createIsChildOfTestData() { { "dc=foo,dc=opendj,dc=org", "dc=org", false }, { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", true }, { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false }, - { "dc=org", "dc=com", false }, { "dc=opendj,dc=org", "dc=foo,dc=org", false }, - { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, }; + { "dc=org", "dc=com", false }, + { "dc=opendj,dc=org", "dc=foo,dc=org", false }, + { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, + }; + // @formatter:on } /** @@ -258,8 +318,15 @@ public Object[][] createIsChildOfTestData() { */ @DataProvider(name = "createNumComponentsTestData") public Object[][] createNumComponentsTestData() { - return new Object[][] { { "", 0 }, { "dc=com", 1 }, { "dc=opendj,dc=com", 2 }, - { "dc=world,dc=opendj,dc=com", 3 }, { "dc=hello,dc=world,dc=opendj,dc=com", 4 }, }; + // @formatter:off + return new Object[][] { + { "", 0 }, + { "dc=com", 1 }, + { "dc=opendj,dc=com", 2 }, + { "dc=world,dc=opendj,dc=com", 3 }, + { "dc=hello,dc=world,dc=opendj,dc=com", 4 }, + }; + // @formatter:on } /** @@ -269,10 +336,15 @@ public Object[][] createNumComponentsTestData() { */ @DataProvider(name = "createParentAndRDNTestData") public Object[][] createParentAndRDNTestData() { - return new Object[][] { { "", null, null }, { "dc=com", "", "dc=com" }, + // @formatter:off + return new Object[][] { + { "", null, null }, + { "dc=com", "", "dc=com" }, { "dc=opendj,dc=com", "dc=com", "dc=opendj" }, { "dc=world,dc=opendj,dc=com", "dc=opendj,dc=com", "dc=world" }, - { "dc=hello,dc=world,dc=opendj,dc=com", "dc=world,dc=opendj,dc=com", "dc=hello" }, }; + { "dc=hello,dc=world,dc=opendj,dc=com", "dc=world,dc=opendj,dc=com", "dc=hello" }, + }; + // @formatter:on } /** @@ -282,12 +354,17 @@ public Object[][] createParentAndRDNTestData() { */ @DataProvider(name = "createRDNTestData") public Object[][] createRDNTestData() { - return new Object[][] { { "dc=com", 0, "dc=com" }, { "dc=opendj,dc=com", 0, "dc=opendj" }, + // @formatter:off + return new Object[][] { + { "dc=com", 0, "dc=com" }, + { "dc=opendj,dc=com", 0, "dc=opendj" }, { "dc=opendj,dc=com", 1, "dc=com" }, { "dc=hello,dc=world,dc=opendj,dc=com", 0, "dc=hello" }, { "dc=hello,dc=world,dc=opendj,dc=com", 1, "dc=world" }, { "dc=hello,dc=world,dc=opendj,dc=com", 2, "dc=opendj" }, - { "dc=hello,dc=world,dc=opendj,dc=com", 3, "dc=com" }, }; + { "dc=hello,dc=world,dc=opendj,dc=com", 3, "dc=com" }, + }; + // @formatter:on } /** @@ -297,19 +374,29 @@ public Object[][] createRDNTestData() { */ @DataProvider(name = "createSubordinateTestData") public Object[][] createSubordinateTestData() { - return new Object[][] { { "", "", true }, { "", "dc=org", false }, - { "", "dc=opendj,dc=org", false }, { "", "dc=foo,dc=opendj,dc=org", false }, - { "dc=org", "", true }, { "dc=org", "dc=org", true }, + // @formatter:off + return new Object[][] { + { "", "", true }, + { "", "dc=org", false }, + { "", "dc=opendj,dc=org", false }, + { "", "dc=foo,dc=opendj,dc=org", false }, + { "dc=org", "", true }, + { "dc=org", "dc=org", true }, { "dc=org", "dc=opendj,dc=org", false }, - { "dc=org", "dc=foo,dc=opendj,dc=org", false }, { "dc=opendj,dc=org", "", true }, + { "dc=org", "dc=foo,dc=opendj,dc=org", false }, + { "dc=opendj,dc=org", "", true }, { "dc=opendj,dc=org", "dc=org", true }, { "dc=opendj,dc=org", "dc=opendj,dc=org", true }, { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", false }, - { "dc=foo,dc=opendj,dc=org", "", true }, { "dc=foo,dc=opendj,dc=org", "dc=org", true }, + { "dc=foo,dc=opendj,dc=org", "", true }, + { "dc=foo,dc=opendj,dc=org", "dc=org", true }, { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", true }, { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true }, - { "dc=org", "dc=com", false }, { "dc=opendj,dc=org", "dc=foo,dc=org", false }, - { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, }; + { "dc=org", "dc=com", false }, + { "dc=opendj,dc=org", "dc=foo,dc=org", false }, + { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, + }; + // @formatter:on } /** @@ -319,19 +406,29 @@ public Object[][] createSubordinateTestData() { */ @DataProvider(name = "createSuperiorTestData") public Object[][] createSuperiorTestData() { - return new Object[][] { { "", "", true }, { "", "dc=org", true }, - { "", "dc=opendj,dc=org", true }, { "", "dc=foo,dc=opendj,dc=org", true }, - { "dc=org", "", false }, { "dc=org", "dc=org", true }, - { "dc=org", "dc=opendj,dc=org", true }, { "dc=org", "dc=foo,dc=opendj,dc=org", true }, - { "dc=opendj,dc=org", "", false }, { "dc=opendj,dc=org", "dc=org", false }, + // @formatter:off + return new Object[][] { + { "", "", true }, + { "", "dc=org", true }, + { "", "dc=opendj,dc=org", true }, + { "", "dc=foo,dc=opendj,dc=org", true }, + { "dc=org", "", false }, + { "dc=org", "dc=org", true }, + { "dc=org", "dc=opendj,dc=org", true }, + { "dc=org", "dc=foo,dc=opendj,dc=org", true }, + { "dc=opendj,dc=org", "", false }, + { "dc=opendj,dc=org", "dc=org", false }, { "dc=opendj,dc=org", "dc=opendj,dc=org", true }, { "dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true }, { "dc=foo,dc=opendj,dc=org", "", false }, { "dc=foo,dc=opendj,dc=org", "dc=org", false }, { "dc=foo,dc=opendj,dc=org", "dc=opendj,dc=org", false }, { "dc=foo,dc=opendj,dc=org", "dc=foo,dc=opendj,dc=org", true }, - { "dc=org", "dc=com", false }, { "dc=opendj,dc=org", "dc=foo,dc=org", false }, - { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, }; + { "dc=org", "dc=com", false }, + { "dc=opendj,dc=org", "dc=foo,dc=org", false }, + { "dc=opendj,dc=org", "dc=opendj,dc=com", false }, + }; + // @formatter:on } @Test @@ -566,12 +663,16 @@ public void testHashCode(final String first, final String second, final int resu * @throws Exception * If the test failed unexpectedly. */ - @Test(dataProvider = "illegalDNs", expectedExceptions = { - LocalizedIllegalArgumentException.class, NullPointerException.class }) + @Test(dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) public void testIllegalStringDNs(final String dn) throws Exception { DN.valueOf(dn); } + @Test(dataProvider = "illegalDNs", expectedExceptions = LocalizedIllegalArgumentException.class) + public void testIllegalByteStringDNs(final String dn) throws Exception { + DN.valueOf(ByteString.valueOfUtf8(dn)); + } + /** * Test the isChildOf method. * @@ -604,18 +705,22 @@ public void testIsChildOfException() throws Exception { dn.isChildOf((String) null); } - /** - * Tests the parent method that require iteration. - */ + /** Tests the parent and rdn method that require iteration. */ @Test - public void testIterableParent() { + public void testIterableParentAndRdn() { final String str = "ou=people,dc=example,dc=com"; final DN dn = DN.valueOf(str); // Parent at index 0 is self. - assertEquals(dn, dn.parent(0)); + assertEquals(dn.parent(0), dn); assertEquals(dn.parent(1), DN.valueOf("dc=example,dc=com")); assertEquals(dn.parent(2), DN.valueOf("dc=com")); assertEquals(dn.parent(3), DN.rootDN()); + assertEquals(dn.parent(4), null); + + assertEquals(dn.rdn(0), RDN.valueOf("ou=people")); + assertEquals(dn.rdn(1), RDN.valueOf("dc=example")); + assertEquals(dn.rdn(2), RDN.valueOf("dc=com")); + assertEquals(dn.rdn(3), null); } /** @@ -684,8 +789,6 @@ public void testParentInteraction() throws Exception { assertEquals(p.rdn(), RDN.valueOf("dc=bar")); - assertEquals(p.rdn(), RDN.valueOf("dc=bar")); - assertEquals(p.parent(), DN.valueOf("dc=opendj,dc=org")); assertEquals(p.parent(), e.parent()); @@ -729,15 +832,25 @@ public void testRootDN1() throws Exception { } /** - * Tests the root DN. + * Tests {@link DN#valueOf(String)}. * * @throws Exception * If the test failed unexpectedly. */ - @Test(expectedExceptions = { NullPointerException.class, AssertionError.class }) - public void testRootDN2() throws Exception { - final DN dn = DN.valueOf(null); - assertEquals(dn, DN.rootDN()); + @Test(expectedExceptions = NullPointerException.class) + public void valueOfStringShouldThrowNPEForNullParameter() { + DN.valueOf((String) null); + } + + /** + * Tests {@link DN#valueOf(ByteString)}. + * + * @throws Exception + * If the test failed unexpectedly. + */ + @Test(expectedExceptions = NullPointerException.class) + public void valueOfByteStringShouldThrowNPEForNullParameter() throws Exception { + DN.valueOf((ByteString) null); } /** @@ -800,8 +913,8 @@ public void testSuperiorDN(final String base, final String sub, final boolean e) @Test(dataProvider = "testDNs") public void testToString(final String rawDN, final String normDN, final String stringDN) throws Exception { - // DN dn = DN.valueOf(rawDN); - // assertEquals(dn.toString(), stringDN); + DN dn = DN.valueOf(rawDN); + assertThat(dn.toString()).isEqualTo(stringDN); } /** @@ -997,14 +1110,14 @@ public void testFormatEscape() { DN actual = DN.format("uid=%s,dc=test", "#cn=foo+sn=bar"); DN expected = DN.valueOf("dc=test").child("uid", "#cn=foo+sn=bar"); assertEquals(actual, expected); - assertEquals(actual.toString(), "uid=\\#cn\\=foo\\+sn\\=bar,dc=test"); + assertEquals(actual.toString(), "uid=\\#cn=foo\\+sn=bar,dc=test"); } /** Tests the {@link DN#escapeAttributeValue(Object)} method. */ @Test public void testEscapeAttributeValue() { String actual = DN.escapeAttributeValue("#cn=foo+sn=bar"); - assertEquals(actual, "\\#cn\\=foo\\+sn\\=bar"); + assertEquals(actual, "\\#cn=foo\\+sn=bar"); } /** Tests the {@link DN#toNormalizedByteString()} method. */ @@ -1040,7 +1153,7 @@ public void testIterator() { } @DataProvider - public Object[][] toIrreversibleNormalizedByteStringDataProvider() { + public Object[][] toNormalizedByteStringDataProvider() { // @formatter:off return new Object[][] { // first value to normalize, second value to normalize, expected sign of comparison between the two @@ -1048,6 +1161,13 @@ public Object[][] toIrreversibleNormalizedByteStringDataProvider() { { "dc=example,dc=com", "dc=example,dc=com", 0 }, { "cn=test+dc=example,dc=com", "cn=test+dc=example,dc=com", 0 }, { "dc=example+cn=test,dc=com", "cn=test+dc=example,dc=com", 0 }, + // siblings + { "cn=test,dc=com", "cn=test+dc=example,dc=com", -1 }, + { "cn=test+dc=example,dc=com", "cn=test,dc=com", 1 }, + { "dc=example,dc=com", "cn=test+dc=example,dc=com", 1 }, + { "cn=test+dc=example,dc=com", "dc=example,dc=com", -1 }, + { "dc=example,dc=com", "dc=example+cn=test,dc=com", 1 }, + { "dc=example+cn=test,dc=com", "dc=example,dc=com", -1 }, // parent entry is followed by its children, not its siblings { "dc=com", "dc=example,dc=com", -1 }, { "dc=com", "dc=test,dc=example,dc=com", -1}, @@ -1081,7 +1201,7 @@ public Object[][] toIrreversibleNormalizedByteStringDataProvider() { // @formatter:on } - @Test(dataProvider = "toIrreversibleNormalizedByteStringDataProvider") + @Test(dataProvider = "toNormalizedByteStringDataProvider") public void testToNormalizedByteString(String first, String second, int expectedCompareResult) { DN actual = DN.valueOf(first); DN expected = DN.valueOf(second); @@ -1102,7 +1222,81 @@ public void testToNormalizedByteString2(String one, String two, String three) { } @DataProvider - public Object[][] toIrreversibleReadableStringDataProvider() { + private Object[][] minAndMaxRdnsDataProvider() { + DN dcCom = DN.valueOf("dc=com"); + DN dcExampleDcCom = DN.valueOf("dc=example,dc=com"); + DN cnTestDcCom = DN.valueOf("cn=test,dc=com"); + return new Object[][] { + { dcCom, dcCom.child(RDN.minValue()), -1 }, + { dcCom, dcCom.child(RDN.maxValue()), -1 }, + { dcExampleDcCom, dcExampleDcCom.child(RDN.minValue()), -1 }, + { dcExampleDcCom, dcExampleDcCom.child(RDN.maxValue()), -1 }, + { dcExampleDcCom, dcCom.child(RDN.minValue()), 1 }, + { dcExampleDcCom, dcCom.child(RDN.maxValue()), -1 }, + // siblings + { DN.valueOf("cn=test+dc=example,dc=com"), cnTestDcCom.child(RDN.minValue()), 1 }, + { DN.valueOf("dc=example+cn=test,dc=com"), cnTestDcCom.child(RDN.minValue()), 1 }, + { DN.valueOf("cn=test+dc=example,dc=com"), cnTestDcCom.child(RDN.maxValue()), 1 }, + { DN.valueOf("dc=example+cn=test,dc=com"), cnTestDcCom.child(RDN.maxValue()), 1 }, + }; + } + + /** Using DN as a Map key depends on this behaviour. In particular MemoryBackend depends on this behaviour. */ + @Test(dataProvider = "minAndMaxRdnsDataProvider") + public void testToNormalizedByteStringWithMinAndMaxRdns(DN dn1, DN dn2, int expectedCompareResult) { + int cmp = dn1.toNormalizedByteString().compareTo(dn2.toNormalizedByteString()); + assertThat(signum(cmp)).isEqualTo(expectedCompareResult); + } + + @Test + public void testToNormalizedByteStringWithMinAndMaxRdnsInOrderedCollection() { + DN dcCom = DN.valueOf("dc=com"); + DN cnTestDcCom = DN.valueOf("cn=test,dc=com"); + DN cnDeeperCnTestDcCom = DN.valueOf("cn=deeper,cn=test,dc=com"); + DN cnTestAndDcExampleDcCom = DN.valueOf("cn=test+dc=example,dc=com"); + DN dcExampleDcCom = DN.valueOf("dc=example,dc=com"); + + TreeMap map = new TreeMap<>(); + putAll(map, dcCom, cnTestDcCom, cnDeeperCnTestDcCom, cnTestAndDcExampleDcCom, dcExampleDcCom); + + assertThat(subordinates(map, dcCom)) + .containsExactly(cnTestDcCom, cnDeeperCnTestDcCom, cnTestAndDcExampleDcCom, dcExampleDcCom); + assertThat(subordinates(map, cnTestDcCom)) + .containsExactly(cnDeeperCnTestDcCom); + + assertThat(after(map, cnTestDcCom)) + .containsExactly(cnDeeperCnTestDcCom, cnTestAndDcExampleDcCom, dcExampleDcCom); + assertThat(after(map, cnDeeperCnTestDcCom)) + .containsExactly(cnTestAndDcExampleDcCom, dcExampleDcCom); + + assertThat(before(map, cnTestDcCom)) + .containsExactly(dcCom); + assertThat(before(map, cnDeeperCnTestDcCom)) + .containsExactly(dcCom, cnTestDcCom); + } + + private void putAll(Map map, DN... dns) { + for (DN dn : dns) { + map.put(dn.toNormalizedByteString(), dn); + } + } + + private Collection subordinates(TreeMap map, DN dn) { + return map.subMap( + dn.child(RDN.minValue()).toNormalizedByteString(), + dn.child(RDN.maxValue()).toNormalizedByteString()).values(); + } + + private Collection before(TreeMap map, DN dn) { + return map.headMap(dn.toNormalizedByteString(), false).values(); + } + + private Collection after(TreeMap map, DN dn) { + return map.tailMap(dn.toNormalizedByteString(), false).values(); + } + + @DataProvider + public Object[][] toNormalizedUrlSafeStringDataProvider() { // @formatter:off return new Object[][] { // first value = string used to build DN, second value = expected readable string @@ -1135,7 +1329,7 @@ public Object[][] toIrreversibleReadableStringDataProvider() { // @formatter:on } - @Test(dataProvider = "toIrreversibleReadableStringDataProvider") + @Test(dataProvider = "toNormalizedUrlSafeStringDataProvider") public void testToNormalizedUrlSafeString(String dnAsString, String expectedReadableString) { DN actual = DN.valueOf(dnAsString); assertEquals(actual.toNormalizedUrlSafeString(), expectedReadableString); @@ -1151,4 +1345,52 @@ public void testToNormalizedUrlSafeString2(String one, String two, String three) assertEquals(irreversibleReadableString, dn2.toNormalizedUrlSafeString()); assertEquals(irreversibleReadableString, dn3.toNormalizedUrlSafeString()); } + + @Test + public void toUUID() { + UUID uuid1 = DN.valueOf("dc=example+cn=test,dc=com").toUUID(); + UUID uuid2 = DN.valueOf("cn=test+dc=example,dc=com").toUUID(); + assertEquals(uuid1, uuid2); + } + + @DataProvider + public Object[][] toStringShouldStripOutIllegalWhitespaceDataProvider() { + // @formatter:off + return new Object[][] { + { " ", "" }, + { " dc = hello world ", "dc=hello world" }, + { " dc =\\ hello world\\ ", "dc=\\ hello world\\ " }, + { " dc = example , dc = com ", "dc=example,dc=com" }, + { " uid = crystal + dc = example , uid = palace + dc = com ", "uid=crystal+dc=example,uid=palace+dc=com" }, + }; + // @formatter:on + } + + @Test(dataProvider = "toStringShouldStripOutIllegalWhitespaceDataProvider") + public void toStringShouldStripOutIllegalWhitespace(String withWhiteSpace, String withoutWhiteSpace) { + assertThat(DN.valueOf(withWhiteSpace).toString()).isEqualTo(withoutWhiteSpace); + assertThat(DN.valueOf(withWhiteSpace).toNormalizedByteString()) + .isEqualTo(DN.valueOf(withoutWhiteSpace).toNormalizedByteString()); + } + + @DataProvider + public Object[][] rdnShouldReturnNullWhenIndexIsOutOfRangeData() { + return new Object[][] { + { "", 0 }, + { "", 1 }, + { "dc=com", 1 }, + { "dc=opends,dc=com", 2 }, + { "dc=hello,dc=world,dc=opends,dc=com", 4 }, + }; + } + + @Test(dataProvider = "rdnShouldReturnNullWhenIndexIsOutOfRangeData") + public void rdnShouldReturnNullWhenIndexIsOutOfRange(String rdn, int i) { + assertThat((Object) DN.valueOf(rdn).rdn(i)).isNull(); + } + + @Test(expectedExceptions = IllegalArgumentException.class) + public void rdnShouldThrowIAEForNegativeIndexes() throws Exception { + DN.valueOf("dc=example,dc=com").rdn(-1); + } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/DataProviderIterator.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/DataProviderIterator.java similarity index 50% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/DataProviderIterator.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/DataProviderIterator.java index 2bafa8bb1..6dabc39d0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/DataProviderIterator.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/DataProviderIterator.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java similarity index 93% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java index 01265604c..a78ee9336 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/EntriesTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -434,7 +424,7 @@ public void testDiffEntriesReplaceSingleValue() { "replace: description", "description: to"); // @formatter:on - assertEquals(diffEntries(from, to, diffOptions().alwaysReplaceAttributes()), expected); + assertEquals(diffEntries(from, to, diffOptions().replaceSingleValuedAttributes()), expected); } @Test diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java similarity index 97% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java index d5a55b378..468e0602d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/EntryTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java similarity index 92% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java index 130025374..74a97c841 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/FilterTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/GSERParserTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/GSERParserTestCase.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/GSERParserTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/GSERParserTestCase.java index e33b3bb42..5b6310315 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/GSERParserTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/GSERParserTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2014 Manuel Gaupp + * Copyright 2013-2014 Manuel Gaupp */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/GeneralizedTimeTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/GeneralizedTimeTest.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/GeneralizedTimeTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/GeneralizedTimeTest.java index 9faf8b210..a08e02026 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/GeneralizedTimeTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/GeneralizedTimeTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java similarity index 95% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java index 3668c6be0..98787a8c5 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/HeartBeatConnectionFactoryTestCase.java @@ -1,29 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldap; import static org.fest.assertions.Assertions.assertThat; @@ -307,7 +296,6 @@ public void testHeartBeatTimeout() throws Exception { assertThat(hbc.isClosed()).isFalse(); } - @SuppressWarnings({ "rawtypes", "unchecked" }) @Test(description = "OPENDJ-1348") public void testBindPreventsHeartBeatTimeout() throws Exception { mockConnectionWithInitialHeartbeatResult(ResultCode.SUCCESS); @@ -366,7 +354,6 @@ public void testBindTriggersHeartBeatTimeoutWhenTooSlow() throws Exception { assertThat(hbc.isValid()).isFalse(); } - @SuppressWarnings({ "unchecked", "rawtypes" }) @Test public void testHeartBeatWhileBindInProgress() throws Exception { mockConnectionWithInitialHeartbeatResult(ResultCode.SUCCESS); @@ -449,7 +436,7 @@ public Promise answer(final InvocationOnMock } private BindResultLdapPromiseImpl mockBindAsyncResponse() { - final BindResultLdapPromiseImpl bindPromise = newBindLdapPromise(-1, null, null, null, ldapConnection); + final BindResultLdapPromiseImpl bindPromise = newBindLdapPromise(-1, null, null, null); when(ldapConnection.bindAsync(any(BindRequest.class), any(IntermediateResponseHandler.class))) .thenReturn(bindPromise); return bindPromise; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java similarity index 96% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java index 25c6e94bf..25abde349 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LDAPServer.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java similarity index 89% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java index ace585202..a316d9b8f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LDAPUrlTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java similarity index 95% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java index abfc94665..114a0a888 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LinkedAttributeTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithmTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LoadBalancerTestCase.java similarity index 83% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithmTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LoadBalancerTestCase.java index d13164a12..da0a9112e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/AbstractLoadBalancingAlgorithmTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/LoadBalancerTestCase.java @@ -1,38 +1,28 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; import static java.util.Arrays.asList; import static org.fest.assertions.Assertions.assertThat; import static org.fest.assertions.Fail.fail; +import static org.forgerock.opendj.ldap.Connections.LOAD_BALANCER_EVENT_LISTENER; +import static org.forgerock.opendj.ldap.Connections.LOAD_BALANCER_MONITORING_INTERVAL; +import static org.forgerock.opendj.ldap.Connections.LOAD_BALANCER_SCHEDULER; import static org.forgerock.opendj.ldap.Connections.newRoundRobinLoadBalancer; import static org.forgerock.opendj.ldap.LdapException.newLdapException; -import static org.forgerock.opendj.ldap.LoadBalancingAlgorithm.LOAD_BALANCER_EVENT_LISTENER; -import static org.forgerock.opendj.ldap.LoadBalancingAlgorithm.LOAD_BALANCER_MONITORING_INTERVAL; -import static org.forgerock.opendj.ldap.LoadBalancingAlgorithm.LOAD_BALANCER_SCHEDULER; import static org.forgerock.util.Options.defaultOptions; import static org.forgerock.util.promise.Promises.newExceptionPromise; import static org.forgerock.util.promise.Promises.newResultPromise; @@ -51,7 +41,7 @@ import org.testng.annotations.Test; @SuppressWarnings("javadoc") -public class AbstractLoadBalancingAlgorithmTestCase extends SdkTestCase { +public class LoadBalancerTestCase extends SdkTestCase { private static ConnectionFactory mockAsync(final ConnectionFactory mock) { return new ConnectionFactory() { @Override diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java similarity index 92% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java index 31eadf39e..f32c608ff 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MemoryBackendTestCase.java @@ -1,41 +1,27 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; -import static org.fest.assertions.Assertions.assertThat; -import static org.forgerock.opendj.ldap.Connections.newInternalConnection; -import static org.forgerock.opendj.ldap.requests.Requests.newAddRequest; -import static org.forgerock.opendj.ldap.requests.Requests.newDeleteRequest; -import static org.forgerock.opendj.ldap.requests.Requests.newModifyRequest; -import static org.forgerock.opendj.ldap.requests.Requests.newSimpleBindRequest; -import static org.forgerock.opendj.ldif.LDIFEntryReader.valueOfLDIFEntry; +import static org.fest.assertions.Assertions.*; +import static org.forgerock.opendj.ldap.Connections.*; +import static org.forgerock.opendj.ldap.requests.Requests.*; +import static org.forgerock.opendj.ldif.LDIFEntryReader.*; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.List; @@ -52,6 +38,7 @@ import org.forgerock.opendj.ldap.responses.SearchResultEntry; import org.forgerock.opendj.ldif.ConnectionEntryReader; import org.forgerock.opendj.ldif.LDIFEntryReader; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; /** @@ -148,15 +135,11 @@ public void testDeleteNoSuchObject() throws Exception { connection.delete("uid=missing,ou=people,dc=example,dc=com"); } - @Test + @Test(expectedExceptions = EntryNotFoundException.class) public void testDeleteOnLeaf() throws Exception { final Connection connection = getConnection(); connection.delete("uid=test1,ou=people,dc=example,dc=com"); - try { - connection.readEntry("dc=example,dc=com"); - } catch (final EntryNotFoundException expected) { - // Do nothing. - } + connection.readEntry("uid=test1,ou=people,dc=example,dc=com"); } @Test(expectedExceptions = ConstraintViolationException.class) @@ -188,19 +171,25 @@ PreReadResponseControl.DECODER, new DecodeOptions()).getEntry()).isEqualTo( "dc: xxx")); } - @Test - public void testDeleteSubtree() throws Exception { + @DataProvider + public Object[][] deleteSubtreeData() { + return new Object[][] { + { "dc=example,dc=com" }, + { "ou=people,dc=example,dc=com" }, + { "uid=test1,ou=people,dc=example,dc=com" }, + { "uid=test2,ou=people,dc=example,dc=com" }, + }; + } + + @Test(dataProvider = "deleteSubtreeData", expectedExceptions = EntryNotFoundException.class) + public void testDeleteSubtree(final String name) throws Exception { final Connection connection = getConnection(); connection.deleteSubtree("dc=example,dc=com"); - for (final String name : Arrays.asList("dc=example,dc=com", "ou=people,dc=example,dc=com", - "uid=test1,ou=people,dc=example,dc=com", "uid=test2,ou=people,dc=example,dc=com")) { - try { - connection.readEntry(name); - } catch (final EntryNotFoundException expected) { - // Do nothing. - } + try { + connection.readEntry(name); + } finally { + assertThat(connection.readEntry("dc=xxx,dc=com")).isNotNull(); } - assertThat(connection.readEntry("dc=xxx,dc=com")).isNotNull(); } @Test @@ -667,8 +656,8 @@ private Connection getConnection() throws IOException { private int getNumberOfEntries(String[] ldifEntries) { int entries = 0; - for (int i = 0; i < ldifEntries.length; i++) { - if (ldifEntries[i].startsWith("dn: ")) { + for (String ldifEntry : ldifEntries) { + if (ldifEntry.startsWith("dn: ")) { entries++; } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java similarity index 69% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java index 86c6bb491..aca05b04f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MockConnectionEventListener.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2012-2014 ForgeRock AS. + * Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -33,10 +23,7 @@ import org.forgerock.opendj.ldap.responses.ExtendedResult; -/** - * A connection event listener which records events and signals when it has been - * notified. - */ +/** A connection event listener which records events and signals when it has been notified. */ @SuppressWarnings("javadoc") public final class MockConnectionEventListener implements ConnectionEventListener { private final CountDownLatch closedLatch = new CountDownLatch(1); @@ -47,14 +34,12 @@ public final class MockConnectionEventListener implements ConnectionEventListene private ExtendedResult notification; private final AtomicInteger invocationCount = new AtomicInteger(); - /** {@inheritDoc} */ @Override public void handleConnectionClosed() { invocationCount.incrementAndGet(); closedLatch.countDown(); } - /** {@inheritDoc} */ @Override public void handleConnectionError(boolean isDisconnectNotification, LdapException error) { this.isDisconnectNotification = isDisconnectNotification; @@ -63,7 +48,6 @@ public void handleConnectionError(boolean isDisconnectNotification, LdapExceptio errorLatch.countDown(); } - /** {@inheritDoc} */ @Override public void handleUnsolicitedNotification(ExtendedResult notification) { this.notification = notification; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/MockScheduler.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MockScheduler.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/MockScheduler.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MockScheduler.java index 517641360..1de769bbd 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/MockScheduler.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/MockScheduler.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ModificationTypeTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ModificationTypeTestCase.java similarity index 51% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ModificationTypeTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ModificationTypeTestCase.java index c95834e13..979e2fde9 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ModificationTypeTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ModificationTypeTestCase.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014 ForgeRock AS + * Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/PackedLongTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/PackedLongTestCase.java similarity index 62% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/PackedLongTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/PackedLongTestCase.java index 078fb1cfa..9b593d85d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/PackedLongTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/PackedLongTestCase.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2015 ForgeRock AS + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java similarity index 78% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java index 39113de64..a6d6547dc 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/RDNTestCase.java @@ -1,33 +1,23 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap; -import static org.fest.assertions.Assertions.*; +import static org.assertj.core.api.Assertions.assertThat; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; @@ -114,19 +104,42 @@ public Object[][] createData() { */ @DataProvider(name = "illegalRDNs") public Object[][] createIllegalData() { - return new Object[][] { { null }, { "" }, { " " }, { "=" }, { "manager" }, { "manager " }, - { "cn+" }, { "cn+Jim" }, + // @formatter:off + return new Object[][] { + { null }, + { "" }, + { " " }, + { "=" }, + { "manager" }, + { "manager " }, + { "cn+" }, + { "cn+Jim" }, { "cn=Jim+" }, { "cn=Jim +" }, { "cn=Jim+ " }, + { "cn=Jim+cn=John" }, { "cn=Jim+sn" }, { "cn=Jim+sn " }, - { "cn=Jim+sn equals" }, // { "cn=Jim," }, { "cn=Jim;" }, { - // "cn=Jim, " }, - // { "cn=Jim+sn=a," }, { "cn=Jim, sn=Jam " }, { "cn+uid=Jim" }, - { "-cn=Jim" }, { "/tmp=a" }, { "\\tmp=a" }, { "cn;lang-en=Jim" }, { "@cn=Jim" }, - { "_name_=Jim" }, { "\u03c0=pi" }, { "v1.0=buggy" }, { "cn=Jim+sn=Bob++" }, - { "cn=Jim+sn=Bob+," }, { "1.3.6.1.4.1.1466..0=#04024869" }, }; + { "cn=Jim+sn equals" }, + { "cn=Jim," }, + { "cn=Jim;" }, + { "cn=Jim, " }, + { "cn=Jim+sn=a," }, + { "cn=Jim, sn=Jam " }, + { "cn+uid=Jim" }, + { "-cn=Jim" }, + { "/tmp=a" }, + { "\\tmp=a" }, + { "cn;lang-en=Jim" }, + { "@cn=Jim" }, + { "_name_=Jim" }, + { "\u03c0=pi" }, + { "v1.0=buggy" }, + { "cn=Jim+sn=Bob++" }, + { "cn=Jim+sn=Bob+," }, + { "1.3.6.1.4.1.1466..0=#04024869" }, + }; + // @formatter:on } /** @@ -152,10 +165,10 @@ public Object[][] createRDNEqualityData() { { "cn=hello+sn=world", "cn=hello+description=world", 1 }, { "cn=hello", "sn=world", -1 }, { "sn=hello", "cn=world", 1 }, - // { "x-test-integer-type=10", "x-test-integer-type=9", 1 }, - // { "x-test-integer-type=999", "x-test-integer-type=1000", -1 }, - // { "x-test-integer-type=-1", "x-test-integer-type=0", -1 }, - // { "x-test-integer-type=0", "x-test-integer-type=-1", 1 }, + { "governingStructureRule=10", "governingStructureRule=9", 1 }, + { "governingStructureRule=999", "governingStructureRule=1000", -1 }, + { "governingStructureRule=-1", "governingStructureRule=0", -1 }, + { "governingStructureRule=0", "governingStructureRule=-1", 1 }, { "cn=aaa", "cn=aaaa", -1 }, { "cn=AAA", "cn=aaaa", -1 }, { "cn=aaa", "cn=AAAA", -1 }, @@ -205,6 +218,11 @@ private RDN parseRDN(final Object value) { return (value instanceof RDN) ? ((RDN) value) : RDN.valueOf(value.toString()); } + @Test(expectedExceptions = IllegalArgumentException.class) + public void ensureRDNIsCreatedWithNonEmptyArguments() { + new RDN(); + } + /** * Test RDN construction with single AVA. * @@ -248,9 +266,9 @@ public void testConstructorWithAVA() throws Exception { @Test public void testConstructorWithMultipleAVAs() throws Exception { AVA example = new AVA("dc", "example"); - AVA org = new AVA("dc", "org"); + AVA user = new AVA("cn", "bjensen"); - final RDN rdn = new RDN(example, org); + final RDN rdn = new RDN(example, user); assertEquals(rdn.size(), 2); Iterator rdnIt = rdn.iterator(); AVA firstAva = rdnIt.next(); @@ -258,16 +276,23 @@ public void testConstructorWithMultipleAVAs() throws Exception { assertEquals(firstAva, example); AVA secondAva = rdnIt.next(); - assertEquals(secondAva.getAttributeType(), ATTR_TYPE_DC); - assertEquals(secondAva, org); + assertEquals(secondAva.getAttributeType(), ATTR_TYPE_CN); + assertEquals(secondAva, user); + } + + @Test(expectedExceptions = LocalizedIllegalArgumentException.class) + public void testConstructorWithDuplicateAVAs() { + AVA example = new AVA("dc", "example"); + AVA org = new AVA("dc", "org"); + new RDN(example, org); } @Test public void testConstructorWithCollectionOfAVAs() throws Exception { AVA example = new AVA("dc", "example"); - AVA org = new AVA("dc", "org"); + AVA user = new AVA("cn", "bjensen"); - final RDN rdn = new RDN(Arrays.asList(example, org)); + final RDN rdn = new RDN(Arrays.asList(example, user)); assertEquals(rdn.size(), 2); Iterator rdnIt = rdn.iterator(); AVA firstAva = rdnIt.next(); @@ -275,8 +300,15 @@ public void testConstructorWithCollectionOfAVAs() throws Exception { assertEquals(firstAva, example); AVA secondAva = rdnIt.next(); - assertEquals(secondAva.getAttributeType(), ATTR_TYPE_DC); - assertEquals(secondAva, org); + assertEquals(secondAva.getAttributeType(), ATTR_TYPE_CN); + assertEquals(secondAva, user); + } + + @Test(expectedExceptions = LocalizedIllegalArgumentException.class) + public void testConstructorWithCollectionOfDuplicateAVAs() { + AVA example = new AVA("dc", "example"); + AVA org = new AVA("dc", "org"); + new RDN(Arrays.asList(example, org)); } /** @@ -459,4 +491,22 @@ public void testHashCode(final Object first, final Object second, final int resu .isNotEqualTo(h2); } } + + @DataProvider + public Object[][] toStringShouldStripOutIllegalWhitespaceDataProvider() { + // @formatter:off + return new Object[][] { + { " dc = hello world ", "dc=hello world" }, + { " dc =\\ hello world\\ ", "dc=\\ hello world\\ " }, + { " uid = cpfc + dc = example ", "uid=cpfc+dc=example" }, + }; + // @formatter:on + } + + @Test(dataProvider = "toStringShouldStripOutIllegalWhitespaceDataProvider") + public void toStringShouldStripOutIllegalWhitespace(String withWhiteSpace, String withoutWhiteSpace) { + assertThat(RDN.valueOf(withWhiteSpace).toString()).isEqualTo(withoutWhiteSpace); + assertThat(RDN.valueOf(withWhiteSpace).toNormalizedByteString(new ByteStringBuilder())) + .isEqualTo(RDN.valueOf(withoutWhiteSpace).toNormalizedByteString(new ByteStringBuilder())); + } } diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/RequestLoadBalancerTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/RequestLoadBalancerTestCase.java new file mode 100644 index 000000000..e1e6d0b05 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/RequestLoadBalancerTestCase.java @@ -0,0 +1,950 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static java.util.Arrays.asList; +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; +import static org.forgerock.opendj.ldap.LdapException.newLdapException; +import static org.forgerock.opendj.ldap.ResultCode.CLIENT_SIDE_CONNECT_ERROR; +import static org.forgerock.opendj.ldap.responses.Responses.newBindResult; +import static org.forgerock.opendj.ldap.responses.Responses.newCompareResult; +import static org.forgerock.opendj.ldap.responses.Responses.newGenericExtendedResult; +import static org.forgerock.opendj.ldap.responses.Responses.newResult; +import static org.forgerock.opendj.ldap.spi.LdapPromises.newSuccessfulLdapPromise; +import static org.forgerock.util.Options.defaultOptions; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.eq; +import static org.mockito.Matchers.isNotNull; +import static org.mockito.Matchers.isNull; +import static org.mockito.Matchers.same; +import static org.mockito.Mockito.*; +import static org.mockito.MockitoAnnotations.initMocks; + +import java.util.ArrayList; +import java.util.logging.Level; + +import org.forgerock.opendj.ldap.requests.AbandonRequest; +import org.forgerock.opendj.ldap.requests.AddRequest; +import org.forgerock.opendj.ldap.requests.BindRequest; +import org.forgerock.opendj.ldap.requests.CompareRequest; +import org.forgerock.opendj.ldap.requests.DeleteRequest; +import org.forgerock.opendj.ldap.requests.ExtendedRequest; +import org.forgerock.opendj.ldap.requests.GenericExtendedRequest; +import org.forgerock.opendj.ldap.requests.ModifyDNRequest; +import org.forgerock.opendj.ldap.requests.ModifyRequest; +import org.forgerock.opendj.ldap.requests.Request; +import org.forgerock.opendj.ldap.requests.SearchRequest; +import org.forgerock.util.Function; +import org.forgerock.util.promise.NeverThrowsException; +import org.forgerock.util.promise.Promises; +import org.mockito.Mock; +import org.testng.annotations.AfterMethod; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +@SuppressWarnings("javadoc") +public class RequestLoadBalancerTestCase extends SdkTestCase { + @Test + public void closeLoadBalancerShouldCloseDelegateFactories() throws Exception { + configureAllFactoriesOnline(); + loadBalancer.close(); + verify(factory1).close(); + verify(factory2).close(); + verify(factory3).close(); + } + + @Test + public void getConnectionShouldNotInvokeDelegateFactory() throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnection()) { + assertThat(connection).isNotNull(); + verifyZeroInteractions(factory1, factory2, factory3); + } + verifyZeroInteractions(factory1, factory2, factory3); + loadBalancer.close(); + } + + @Test + public void getConnectionReturnANewConnectionEachTime() throws Exception { + configureAllFactoriesOnline(); + try (Connection connection1 = loadBalancer.getConnection(); + Connection connection2 = loadBalancer.getConnection()) { + assertThat(connection1).isNotSameAs(connection2); + } + loadBalancer.close(); + } + + @Test + public void getConnectionAsyncReturnANewConnectionEachTime() throws Exception { + configureAllFactoriesOnline(); + try (Connection connection1 = loadBalancer.getConnectionAsync().get(); + Connection connection2 = loadBalancer.getConnectionAsync().get()) { + assertThat(connection1).isNotSameAs(connection2); + } + loadBalancer.close(); + } + + @Test + public void getConnectionAsyncShouldNotInvokeDelegateFactory() throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + assertThat(connection).isNotNull(); + verifyZeroInteractions(factory1, factory2, factory3); + } + verifyZeroInteractions(factory1, factory2, factory3); + } + + @Test + public void connectionEventListenersNotifiedOnClose() throws Exception { + configureAllFactoriesOnline(); + final ConnectionEventListener listener = mock(ConnectionEventListener.class); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.addConnectionEventListener(listener); + } + verify(listener).handleConnectionClosed(); + } + + @Test + public void connectionEventListenersNotifiedOnError() throws Exception { + configureAllFactoriesOffline(); + final ConnectionEventListener listener = mock(ConnectionEventListener.class); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.addConnectionEventListener(listener); + try { + connection.add(addRequest1); + fail("add unexpectedly succeeded"); + } catch (LdapException ignored) { + // Ignore. + } + } + verify(listener).handleConnectionError(eq(false), any(LdapException.class)); + verify(listener).handleConnectionClosed(); + } + + @Test + public void removedConnectionEventListenersShouldNotBeNotified() throws Exception { + configureAllFactoriesOnline(); + final ConnectionEventListener listener = mock(ConnectionEventListener.class); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.addConnectionEventListener(listener); + connection.removeConnectionEventListener(listener); + } + verifyZeroInteractions(listener); + } + + @Test + public void validAndClosedStateShouldBeMaintained() throws Exception { + configureAllFactoriesOffline(); + final Connection connection = loadBalancer.getConnectionAsync().get(); + assertThat(connection.isValid()).isTrue(); + assertThat(connection.isClosed()).isFalse(); + + try { + connection.add(addRequest1); + fail("add unexpectedly succeeded"); + } catch (LdapException ignored) { + // Ignore. + } + assertThat(connection.isValid()).isFalse(); + assertThat(connection.isClosed()).isFalse(); + + connection.close(); + assertThat(connection.isValid()).isFalse(); + assertThat(connection.isClosed()).isTrue(); + } + + @Test + public void factoryToStringShouldReturnANonEmptyString() throws Exception { + configureAllFactoriesOffline(); + assertThat(loadBalancer.toString()).isNotEmpty(); + } + + @Test + public void connectionToStringShouldReturnANonEmptyString() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + assertThat(connection.toString()).isNotEmpty(); + } + } + + @Test + public void abandonRequestShouldBeIgnored() throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.abandonAsync(mock(AbandonRequest.class)); + } + verifyZeroInteractions(factory1, factory2, factory3); + } + + // We can't use a DataProviders here because the mocks will be re-initialized for each test method call. + + // ################## Add Requests #################### + + @Test + public void addRequestsShouldBeRoutedCorrectly1() throws Exception { + addRequestsShouldBeRoutedCorrectlyImpl(addRequest1, factory1, connection1); + } + + @Test + public void addRequestsShouldBeRoutedCorrectly2() throws Exception { + addRequestsShouldBeRoutedCorrectlyImpl(addRequest2, factory2, connection2); + } + + @Test + public void addRequestsShouldBeRoutedCorrectly3() throws Exception { + addRequestsShouldBeRoutedCorrectlyImpl(addRequest3, factory3, connection3); + } + + private void addRequestsShouldBeRoutedCorrectlyImpl(final AddRequest addRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.add(addRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).addAsync(same(addRequest), isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void addRequestsShouldLinearProbeOnFailure1() throws Exception { + addRequestsShouldLinearProbeOnFailureImpl(addRequest1); + } + + @Test + public void addRequestsShouldLinearProbeOnFailure2() throws Exception { + addRequestsShouldLinearProbeOnFailureImpl(addRequest2); + } + + @Test + public void addRequestsShouldLinearProbeOnFailure3() throws Exception { + addRequestsShouldLinearProbeOnFailureImpl(addRequest3); + } + + private void addRequestsShouldLinearProbeOnFailureImpl(final AddRequest addRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.add(addRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).addAsync(same(addRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void addRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.add(addRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## Bind Requests #################### + + @Test + public void bindRequestsShouldBeRoutedCorrectly1() throws Exception { + bindRequestsShouldBeRoutedCorrectlyImpl(bindRequest1, factory1, connection1); + } + + @Test + public void bindRequestsShouldBeRoutedCorrectly2() throws Exception { + bindRequestsShouldBeRoutedCorrectlyImpl(bindRequest2, factory2, connection2); + } + + @Test + public void bindRequestsShouldBeRoutedCorrectly3() throws Exception { + bindRequestsShouldBeRoutedCorrectlyImpl(bindRequest3, factory3, connection3); + } + + private void bindRequestsShouldBeRoutedCorrectlyImpl(final BindRequest bindRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.bind(bindRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).bindAsync(same(bindRequest), isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void bindRequestsShouldLinearProbeOnFailure1() throws Exception { + bindRequestsShouldLinearProbeOnFailureImpl(bindRequest1); + } + + @Test + public void bindRequestsShouldLinearProbeOnFailure2() throws Exception { + bindRequestsShouldLinearProbeOnFailureImpl(bindRequest2); + } + + @Test + public void bindRequestsShouldLinearProbeOnFailure3() throws Exception { + bindRequestsShouldLinearProbeOnFailureImpl(bindRequest3); + } + + private void bindRequestsShouldLinearProbeOnFailureImpl(final BindRequest bindRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.bind(bindRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).bindAsync(same(bindRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void bindRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.bind(bindRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## Compare Requests #################### + + @Test + public void compareRequestsShouldBeRoutedCorrectly1() throws Exception { + compareRequestsShouldBeRoutedCorrectlyImpl(compareRequest1, factory1, connection1); + } + + @Test + public void compareRequestsShouldBeRoutedCorrectly2() throws Exception { + compareRequestsShouldBeRoutedCorrectlyImpl(compareRequest2, factory2, connection2); + } + + @Test + public void compareRequestsShouldBeRoutedCorrectly3() throws Exception { + compareRequestsShouldBeRoutedCorrectlyImpl(compareRequest3, factory3, connection3); + } + + private void compareRequestsShouldBeRoutedCorrectlyImpl(final CompareRequest compareRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.compare(compareRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).compareAsync(same(compareRequest), isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void compareRequestsShouldLinearProbeOnFailure1() throws Exception { + compareRequestsShouldLinearProbeOnFailureImpl(compareRequest1); + } + + @Test + public void compareRequestsShouldLinearProbeOnFailure2() throws Exception { + compareRequestsShouldLinearProbeOnFailureImpl(compareRequest2); + } + + @Test + public void compareRequestsShouldLinearProbeOnFailure3() throws Exception { + compareRequestsShouldLinearProbeOnFailureImpl(compareRequest3); + } + + private void compareRequestsShouldLinearProbeOnFailureImpl(final CompareRequest compareRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.compare(compareRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).compareAsync(same(compareRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void compareRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.compare(compareRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## Delete Requests #################### + + @Test + public void deleteRequestsShouldBeRoutedCorrectly1() throws Exception { + deleteRequestsShouldBeRoutedCorrectlyImpl(deleteRequest1, factory1, connection1); + } + + @Test + public void deleteRequestsShouldBeRoutedCorrectly2() throws Exception { + deleteRequestsShouldBeRoutedCorrectlyImpl(deleteRequest2, factory2, connection2); + } + + @Test + public void deleteRequestsShouldBeRoutedCorrectly3() throws Exception { + deleteRequestsShouldBeRoutedCorrectlyImpl(deleteRequest3, factory3, connection3); + } + + private void deleteRequestsShouldBeRoutedCorrectlyImpl(final DeleteRequest deleteRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.delete(deleteRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).deleteAsync(same(deleteRequest), isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void deleteRequestsShouldLinearProbeOnFailure1() throws Exception { + deleteRequestsShouldLinearProbeOnFailureImpl(deleteRequest1); + } + + @Test + public void deleteRequestsShouldLinearProbeOnFailure2() throws Exception { + deleteRequestsShouldLinearProbeOnFailureImpl(deleteRequest2); + } + + @Test + public void deleteRequestsShouldLinearProbeOnFailure3() throws Exception { + deleteRequestsShouldLinearProbeOnFailureImpl(deleteRequest3); + } + + private void deleteRequestsShouldLinearProbeOnFailureImpl(final DeleteRequest deleteRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.delete(deleteRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).deleteAsync(same(deleteRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void deleteRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.delete(deleteRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## Extended Requests #################### + + @Test + public void extendedRequestsShouldBeRoutedCorrectly1() throws Exception { + extendedRequestsShouldBeRoutedCorrectlyImpl(extendedRequest1, factory1, connection1); + } + + @Test + public void extendedRequestsShouldBeRoutedCorrectly2() throws Exception { + extendedRequestsShouldBeRoutedCorrectlyImpl(extendedRequest2, factory2, connection2); + } + + @Test + public void extendedRequestsShouldBeRoutedCorrectly3() throws Exception { + extendedRequestsShouldBeRoutedCorrectlyImpl(extendedRequest3, factory3, connection3); + } + + private void extendedRequestsShouldBeRoutedCorrectlyImpl(final ExtendedRequest extendedRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.extendedRequest(extendedRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).extendedRequestAsync(same(extendedRequest), + isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void extendedRequestsShouldLinearProbeOnFailure1() throws Exception { + extendedRequestsShouldLinearProbeOnFailureImpl(extendedRequest1); + } + + @Test + public void extendedRequestsShouldLinearProbeOnFailure2() throws Exception { + extendedRequestsShouldLinearProbeOnFailureImpl(extendedRequest2); + } + + @Test + public void extendedRequestsShouldLinearProbeOnFailure3() throws Exception { + extendedRequestsShouldLinearProbeOnFailureImpl(extendedRequest3); + } + + private void extendedRequestsShouldLinearProbeOnFailureImpl( + final ExtendedRequest extendedRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.extendedRequest(extendedRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).extendedRequestAsync(same(extendedRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void extendedRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.extendedRequest(extendedRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## Modify Requests #################### + + @Test + public void modifyRequestsShouldBeRoutedCorrectly1() throws Exception { + modifyRequestsShouldBeRoutedCorrectlyImpl(modifyRequest1, factory1, connection1); + } + + @Test + public void modifyRequestsShouldBeRoutedCorrectly2() throws Exception { + modifyRequestsShouldBeRoutedCorrectlyImpl(modifyRequest2, factory2, connection2); + } + + @Test + public void modifyRequestsShouldBeRoutedCorrectly3() throws Exception { + modifyRequestsShouldBeRoutedCorrectlyImpl(modifyRequest3, factory3, connection3); + } + + private void modifyRequestsShouldBeRoutedCorrectlyImpl(final ModifyRequest modifyRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.modify(modifyRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).modifyAsync(same(modifyRequest), isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void modifyRequestsShouldLinearProbeOnFailure1() throws Exception { + modifyRequestsShouldLinearProbeOnFailureImpl(modifyRequest1); + } + + @Test + public void modifyRequestsShouldLinearProbeOnFailure2() throws Exception { + modifyRequestsShouldLinearProbeOnFailureImpl(modifyRequest2); + } + + @Test + public void modifyRequestsShouldLinearProbeOnFailure3() throws Exception { + modifyRequestsShouldLinearProbeOnFailureImpl(modifyRequest3); + } + + private void modifyRequestsShouldLinearProbeOnFailureImpl(final ModifyRequest modifyRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.modify(modifyRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).modifyAsync(same(modifyRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void modifyRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.modify(modifyRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## ModifyDN Requests #################### + + @Test + public void modifyDNRequestsShouldBeRoutedCorrectly1() throws Exception { + modifyDNRequestsShouldBeRoutedCorrectlyImpl(modifyDNRequest1, factory1, connection1); + } + + @Test + public void modifyDNRequestsShouldBeRoutedCorrectly2() throws Exception { + modifyDNRequestsShouldBeRoutedCorrectlyImpl(modifyDNRequest2, factory2, connection2); + } + + @Test + public void modifyDNRequestsShouldBeRoutedCorrectly3() throws Exception { + modifyDNRequestsShouldBeRoutedCorrectlyImpl(modifyDNRequest3, factory3, connection3); + } + + private void modifyDNRequestsShouldBeRoutedCorrectlyImpl(final ModifyDNRequest modifyDNRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.modifyDN(modifyDNRequest); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).modifyDNAsync(same(modifyDNRequest), isNull(IntermediateResponseHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void modifyDNRequestsShouldLinearProbeOnFailure1() throws Exception { + modifyDNRequestsShouldLinearProbeOnFailureImpl(modifyDNRequest1); + } + + @Test + public void modifyDNRequestsShouldLinearProbeOnFailure2() throws Exception { + modifyDNRequestsShouldLinearProbeOnFailureImpl(modifyDNRequest2); + } + + @Test + public void modifyDNRequestsShouldLinearProbeOnFailure3() throws Exception { + modifyDNRequestsShouldLinearProbeOnFailureImpl(modifyDNRequest3); + } + + private void modifyDNRequestsShouldLinearProbeOnFailureImpl( + final ModifyDNRequest modifyDNRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.modifyDN(modifyDNRequest); + } + verify(factory3).getConnectionAsync(); + verify(connection3).modifyDNAsync(same(modifyDNRequest), isNull(IntermediateResponseHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void modifyDNRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.modifyDN(modifyDNRequest1); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + // ################## Search Requests #################### + + @Test + public void searchRequestsShouldBeRoutedCorrectly1() throws Exception { + searchRequestsShouldBeRoutedCorrectlyImpl(searchRequest1, factory1, connection1); + } + + @Test + public void searchRequestsShouldBeRoutedCorrectly2() throws Exception { + searchRequestsShouldBeRoutedCorrectlyImpl(searchRequest2, factory2, connection2); + } + + @Test + public void searchRequestsShouldBeRoutedCorrectly3() throws Exception { + searchRequestsShouldBeRoutedCorrectlyImpl(searchRequest3, factory3, connection3); + } + + private void searchRequestsShouldBeRoutedCorrectlyImpl(final SearchRequest searchRequest, + final ConnectionFactory expectedFactory, + final Connection expectedConnection) throws Exception { + configureAllFactoriesOnline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.search(searchRequest, new ArrayList<>()); + } + verify(expectedFactory).getConnectionAsync(); + verify(expectedConnection).searchAsync(same(searchRequest), + isNull(IntermediateResponseHandler.class), + isNotNull(SearchResultHandler.class)); + verify(expectedConnection).close(); + verifyZeroInteractionsForRemainingFactories(expectedFactory); + } + + @Test + public void searchRequestsShouldLinearProbeOnFailure1() throws Exception { + searchRequestsShouldLinearProbeOnFailureImpl(searchRequest1); + } + + @Test + public void searchRequestsShouldLinearProbeOnFailure2() throws Exception { + searchRequestsShouldLinearProbeOnFailureImpl(searchRequest2); + } + + @Test + public void searchRequestsShouldLinearProbeOnFailure3() throws Exception { + searchRequestsShouldLinearProbeOnFailureImpl(searchRequest3); + } + + private void searchRequestsShouldLinearProbeOnFailureImpl(final SearchRequest searchRequest) throws Exception { + configureFactoriesOneAndTwoOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + connection.search(searchRequest, new ArrayList<>()); + } + verify(factory3).getConnectionAsync(); + verify(connection3).searchAsync(same(searchRequest), + isNull(IntermediateResponseHandler.class), + isNotNull(SearchResultHandler.class)); + verify(connection3).close(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + } + + @Test + public void searchRequestsShouldFailWhenAllFactoriesOffline() throws Exception { + configureAllFactoriesOffline(); + try (Connection connection = loadBalancer.getConnectionAsync().get()) { + try { + connection.search(searchRequest1, new ArrayList<>()); + } catch (ConnectionException e) { + assertThat(e.getResult().getResultCode()).isEqualTo(CLIENT_SIDE_CONNECT_ERROR); + } + } + verify(factory1, atLeastOnce()).getConnectionAsync(); + verify(factory2, atLeastOnce()).getConnectionAsync(); + verify(factory3, atLeastOnce()).getConnectionAsync(); + verifyZeroInteractions(connection1); + verifyZeroInteractions(connection2); + verifyZeroInteractions(connection3); + } + + @Mock private ConnectionFactory factory1; + @Mock private ConnectionFactory factory2; + @Mock private ConnectionFactory factory3; + + @Mock private AbstractAsynchronousConnection connection1; + @Mock private AbstractAsynchronousConnection connection2; + @Mock private AbstractAsynchronousConnection connection3; + + @Mock private AddRequest addRequest1; + @Mock private AddRequest addRequest2; + @Mock private AddRequest addRequest3; + + @Mock private BindRequest bindRequest1; + @Mock private BindRequest bindRequest2; + @Mock private BindRequest bindRequest3; + + @Mock private CompareRequest compareRequest1; + @Mock private CompareRequest compareRequest2; + @Mock private CompareRequest compareRequest3; + + @Mock private DeleteRequest deleteRequest1; + @Mock private DeleteRequest deleteRequest2; + @Mock private DeleteRequest deleteRequest3; + + @Mock private GenericExtendedRequest extendedRequest1; + @Mock private GenericExtendedRequest extendedRequest2; + @Mock private GenericExtendedRequest extendedRequest3; + + @Mock private ModifyRequest modifyRequest1; + @Mock private ModifyRequest modifyRequest2; + @Mock private ModifyRequest modifyRequest3; + + @Mock private ModifyDNRequest modifyDNRequest1; + @Mock private ModifyDNRequest modifyDNRequest2; + @Mock private ModifyDNRequest modifyDNRequest3; + + @Mock private SearchRequest searchRequest1; + @Mock private SearchRequest searchRequest2; + @Mock private SearchRequest searchRequest3; + + private ConnectionFactory loadBalancer; + + @BeforeMethod + public void beforeMethod() { + TestCaseUtils.setDefaultLogLevel(Level.SEVERE); + initMocks(this); + stub(this.connection1); + stub(this.connection2); + stub(this.connection3); + loadBalancer = new RequestLoadBalancer("Test", + asList(factory1, factory2, factory3), + defaultOptions(), newNextFactoryFunction()); + } + + private Function newNextFactoryFunction() { + return new Function() { + @Override + public Integer apply(final Request request) { + if (request == addRequest1 || request == bindRequest1 || request == compareRequest1 + || request == deleteRequest1 || request == extendedRequest1 || request == modifyRequest1 + || request == modifyDNRequest1 || request == searchRequest1) { + return 0; + } + + if (request == addRequest2 || request == bindRequest2 || request == compareRequest2 + || request == deleteRequest2 || request == extendedRequest2 || request == modifyRequest2 + || request == modifyDNRequest2 || request == searchRequest2) { + return 1; + } + + if (request == addRequest3 || request == bindRequest3 || request == compareRequest3 + || request == deleteRequest3 || request == extendedRequest3 || request == modifyRequest3 + || request == modifyDNRequest3 || request == searchRequest3) { + return 2; + } + + fail("Received unexpected request"); + return -1; // Keep compiler happy. + } + }; + } + + private void stub(final Connection connection) { + when(connection.addAsync(any(AddRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newResult(ResultCode.SUCCESS))); + when(connection.bindAsync(any(BindRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newBindResult(ResultCode.SUCCESS))); + when(connection.compareAsync(any(CompareRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newCompareResult(ResultCode.SUCCESS))); + when(connection.deleteAsync(any(DeleteRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newResult(ResultCode.SUCCESS))); + when(connection.extendedRequestAsync(any(GenericExtendedRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newGenericExtendedResult(ResultCode.SUCCESS))); + when(connection.modifyAsync(any(ModifyRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newResult(ResultCode.SUCCESS))); + when(connection.modifyDNAsync(any(ModifyDNRequest.class), any(IntermediateResponseHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newResult(ResultCode.SUCCESS))); + when(connection.searchAsync(any(SearchRequest.class), any(IntermediateResponseHandler.class), + any(SearchResultHandler.class))) + .thenReturn(newSuccessfulLdapPromise(newResult(ResultCode.SUCCESS))); + } + + @AfterMethod + public void afterMethod() { + loadBalancer.close(); + TestCaseUtils.setDefaultLogLevel(Level.INFO); + } + + private void configureAllFactoriesOnline() { + when(factory1.getConnectionAsync()) + .thenReturn(Promises.newResultPromise(connection1)); + when(factory2.getConnectionAsync()) + .thenReturn(Promises.newResultPromise(connection2)); + when(factory3.getConnectionAsync()) + .thenReturn(Promises.newResultPromise(connection3)); + } + + private void configureFactoriesOneAndTwoOffline() { + final LdapException connectionFailure = newLdapException(CLIENT_SIDE_CONNECT_ERROR); + when(factory1.getConnectionAsync()) + .thenReturn(Promises.newExceptionPromise(connectionFailure)); + when(factory2.getConnectionAsync()) + .thenReturn(Promises.newExceptionPromise(connectionFailure)); + when(factory3.getConnectionAsync()) + .thenReturn(Promises.newResultPromise(connection3)); + } + + private void configureAllFactoriesOffline() { + final LdapException connectionFailure = newLdapException(CLIENT_SIDE_CONNECT_ERROR); + when(factory1.getConnectionAsync()) + .thenReturn(Promises.newExceptionPromise(connectionFailure)); + when(factory2.getConnectionAsync()) + .thenReturn(Promises.newExceptionPromise(connectionFailure)); + when(factory3.getConnectionAsync()) + .thenReturn(Promises.newExceptionPromise(connectionFailure)); + } + + private void verifyZeroInteractionsForRemainingFactories(final ConnectionFactory expectedFactory) { + if (expectedFactory != factory1) { + verifyZeroInteractions(factory1); + } + if (expectedFactory != factory2) { + verifyZeroInteractions(factory2); + } + if (expectedFactory != factory3) { + verifyZeroInteractions(factory3); + } + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ResultCodeTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ResultCodeTestCase.java similarity index 63% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/ResultCodeTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ResultCodeTestCase.java index 74604fe59..2d63ebff7 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/ResultCodeTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/ResultCodeTestCase.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014 ForgeRock AS + * Copyright 2014 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java new file mode 100644 index 000000000..735fda384 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/SdkTestCase.java @@ -0,0 +1,29 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import org.forgerock.testng.ForgeRockTestCase; +import org.testng.annotations.Test; + +/** + * An abstract class that all types unit tests should extend. A type represents + * the classes found directly under the package org.forgerock.opendj.ldap. + */ +@Test(groups = { "precommit", "types", "sdk" }) +public abstract class SdkTestCase extends ForgeRockTestCase { + +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/SearchScopeTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/SearchScopeTestCase.java similarity index 74% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/SearchScopeTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/SearchScopeTestCase.java index fac4d9f84..9829399e9 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/SearchScopeTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/SearchScopeTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java similarity index 84% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java index 5cce402c0..13134d3ca 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtils.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap; @@ -31,7 +21,6 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.ServerSocket; -import java.net.SocketAddress; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; @@ -66,13 +55,12 @@ public static String createTempFile(final String... lines) throws Exception { final File f = File.createTempFile("LDIFBasedTestCase", ".txt"); f.deleteOnExit(); - final FileWriter w = new FileWriter(f); - for (final String s : lines) { - w.write(s + System.getProperty("line.separator")); + try (final FileWriter w = new FileWriter(f)) { + for (final String s : lines) { + w.write(s + System.getProperty("line.separator")); + } } - w.close(); - return f.getAbsolutePath(); } @@ -101,13 +89,10 @@ public static String getTestFilePath(String relativePathFromClasspath) throws Ex * @return The free port. */ public static InetSocketAddress findFreeSocketAddress() { - try { - ServerSocket serverLdapSocket = new ServerSocket(); + try (ServerSocket serverLdapSocket = new ServerSocket()) { serverLdapSocket.setReuseAddress(true); serverLdapSocket.bind(new InetSocketAddress("127.0.0.1", 0)); - final SocketAddress address = serverLdapSocket.getLocalSocketAddress(); - serverLdapSocket.close(); - return (InetSocketAddress) address; + return (InetSocketAddress) serverLdapSocket.getLocalSocketAddress(); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtilsTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtilsTestCase.java new file mode 100644 index 000000000..ef59a8148 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/TestCaseUtilsTestCase.java @@ -0,0 +1,43 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2013 ForgeRock AS. + */ +package org.forgerock.opendj.ldap; + +import static org.fest.assertions.Assertions.assertThat; +import static org.forgerock.opendj.ldap.TestCaseUtils.mockTimeService; + +import org.testng.annotations.Test; + +import org.forgerock.util.time.TimeService; + +@SuppressWarnings("javadoc") +public class TestCaseUtilsTestCase extends SdkTestCase { + + /** + * Test for {@link #mockTimeSource(long...)}. + */ + @Test + public void testMockTimeSource() { + final TimeService mock1 = mockTimeService(10); + assertThat(mock1.now()).isEqualTo(10); + assertThat(mock1.now()).isEqualTo(10); + + final TimeService mock2 = mockTimeService(10, 20, 30); + assertThat(mock2.now()).isEqualTo(10); + assertThat(mock2.now()).isEqualTo(20); + assertThat(mock2.now()).isEqualTo(30); + assertThat(mock2.now()).isEqualTo(30); + } +} diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java new file mode 100644 index 000000000..3d6900c5d --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/controls/ControlsTestCase.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.controls; + +import org.forgerock.opendj.ldap.TestCaseUtils; +import org.forgerock.testng.ForgeRockTestCase; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +/** + * An abstract class that all controls unit tests should extend. A control + * represents the classes found directly under the package + * org.forgerock.opendj.ldap.controls. + */ + +@Test(groups = { "precommit", "controls", "sdk" }) +public abstract class ControlsTestCase extends ForgeRockTestCase { + /** + * Set up the environment for performing the tests in this suite. + * + * @throws Exception + * If the environment could not be set up. + */ + @BeforeClass + public void setUp() throws Exception { + // This test suite depends on having the schema available. + TestCaseUtils.startServer(); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java similarity index 71% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java index b498fa2ef..80c261af4 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AbandonRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java similarity index 86% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java index a4d0853e5..5098a8d90 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AddRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java index 39f0ced7e..6d824988e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/AnonymousSASLBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java similarity index 67% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java index 6a7435b3a..1302360c1 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/BindRequestTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. + * Copyright 2010 Sun Microsystems, Inc. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java similarity index 81% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java index 41690c6d5..776456521 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CRAMMD5SASLBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestTestCase.java similarity index 81% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestTestCase.java index ddcffd364..5fbd8eebb 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CancelExtendedRequestTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java similarity index 82% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java index be929ad78..f91b7120e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/CompareRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java similarity index 74% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java index c951572c9..acc83ced1 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/DeleteRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java similarity index 91% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java index f5d567908..2ce693297 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/DigestMD5SASLBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java new file mode 100644 index 000000000..0ccda7c4e --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ExtendedRequestTestCase.java @@ -0,0 +1,35 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + */ + +package org.forgerock.opendj.ldap.requests; + +import static org.testng.Assert.assertNotNull; + +import org.forgerock.opendj.ldap.responses.ExtendedResultDecoder; +import org.testng.annotations.Test; + +/** + * Tests various extended requests. + */ +@SuppressWarnings("javadoc") +public abstract class ExtendedRequestTestCase extends RequestsTestCase { + + @Test(dataProvider = "ExtendedRequests") + public void testDecoder(final ExtendedRequest request) throws Exception { + final ExtendedResultDecoder decoder = request.getResultDecoder(); + assertNotNull(decoder); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java similarity index 73% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java index 4b5eb5eae..719b86c3c 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ExternalSASLBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java index e4f272d0a..c0b2aae50 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GSSAPISASLBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -63,6 +53,7 @@ protected GSSAPISASLBindRequest[] newInstance() { }; } + @Override @Test(enabled = false) public void testBindClient(BindRequest request) throws Exception { // Should setup a test krb server... diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java index e7eeaa224..3732dfb9f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java index a53d3470f..7555c3531 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/GenericExtendedRequestTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java index b1301596e..abdc7a64d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyDNRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -41,7 +31,7 @@ public class ModifyDNRequestTestCase extends RequestsTestCase { private static final ModifyDNRequest NEW_MODIFY_DN_REQUEST = Requests.newModifyDNRequest( - "uid=user.100,ou=people,o=test", "uid=100.user,ou=people,o=testl"); + "uid=user.100,ou=people,o=test", "uid=100.user"); private static final ModifyDNRequest NEW_MODIFY_DN_REQUEST2 = Requests.newModifyDNRequest( "cn=ModifyDNrequesttestcase", "cn=xyz"); @@ -112,13 +102,13 @@ public void testUnmodifiableSetName2(final ModifyDNRequest original) { @Test(dataProvider = "ModifyDNRequests", expectedExceptions = UnsupportedOperationException.class) public void testUnmodifiableSetNewRDN(final ModifyDNRequest original) { final ModifyDNRequest unmodifiable = (ModifyDNRequest) unmodifiableOf(original); - unmodifiable.setNewRDN("dc=example,dc=org"); + unmodifiable.setNewRDN("dc=org"); } @Test(dataProvider = "ModifyDNRequests", expectedExceptions = UnsupportedOperationException.class) public void testUnmodifiableSetNewRDN2(final ModifyDNRequest original) { final ModifyDNRequest unmodifiable = (ModifyDNRequest) unmodifiableOf(original); - unmodifiable.setNewRDN(RDN.valueOf("dc=example,dc=org")); + unmodifiable.setNewRDN(RDN.valueOf("dc=org")); } @Test(dataProvider = "ModifyDNRequests", expectedExceptions = UnsupportedOperationException.class) diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java similarity index 81% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java index fdcdf76a0..97d2cca7f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/ModifyRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java similarity index 87% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java index 37a986269..d5c8cd6ec 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/PasswordModifyExtendedRequestTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java similarity index 82% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java index bc71c0f56..cd00e1c37 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/PlainSASLBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java index b33a33665..03a789160 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/RequestsTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; @@ -56,11 +46,13 @@ public abstract class RequestsTestCase extends ForgeRockTestCase { /** Dummy decoder which does nothing. */ private static class MyDecoder implements ControlDecoder { + @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(); } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java similarity index 89% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java index 2042b58fa..73d85182c 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/SearchRequestTestCase.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java similarity index 79% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java index 65894839d..6c4e58f6e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/SimpleBindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestTestCase.java similarity index 84% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestTestCase.java index 8aa7977bf..c958c33be 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/StartTLSExtendedRequestTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java similarity index 56% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java index 67e6f42bf..b6a88a86a 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/UnbindRequestTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestTestCase.java similarity index 78% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestTestCase.java index 8e44e0f41..04bd5d669 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/requests/WhoAmIExtendedRequestTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.ldap.requests; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java new file mode 100644 index 000000000..8dae00cd2 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/responses/ResponsesTestCase.java @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.responses; + +import org.forgerock.testng.ForgeRockTestCase; +import org.testng.annotations.Test; + +/** + * An abstract class that all responses unit tests should extend. Responses + * represents the classes found directly under the package + * org.forgerock.opendj.ldap.responses. + */ + +@Test(groups = { "precommit", "responses", "sdk" }) +public abstract class ResponsesTestCase extends ForgeRockTestCase { +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java similarity index 81% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java index 302d9af5d..f32f9c762 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaElementTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java new file mode 100644 index 000000000..98ba71d3e --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSchemaTestCase.java @@ -0,0 +1,27 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import org.forgerock.testng.ForgeRockTestCase; +import org.testng.annotations.Test; + +/** + * An abstract class that all schema unit test should extend. + */ +@Test(groups = { "precommit", "schema", "sdk" }) +public abstract class AbstractSchemaTestCase extends ForgeRockTestCase { +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java index 4a5ac9dfd..faab9af3f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSubstringMatchingRuleImplTest.java @@ -1,26 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2014-2015 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -47,28 +38,23 @@ import static org.mockito.Mockito.*; import static org.testng.Assert.*; -/** - * Tests all generic code of AbstractSubstringMatchingRuleImpl. - */ +/** Tests all generic code of AbstractSubstringMatchingRuleImpl. */ @SuppressWarnings("javadoc") public class AbstractSubstringMatchingRuleImplTest extends AbstractSchemaTestCase { + private int subStringLength = 3; private static class FakeSubstringMatchingRuleImpl extends AbstractSubstringMatchingRuleImpl { - FakeSubstringMatchingRuleImpl() { super(SMR_CASE_EXACT_OID, EMR_CASE_EXACT_OID); } - /** {@inheritDoc} */ @Override public ByteString normalizeAttributeValue(Schema schema, ByteSequence value) throws DecodeException { return value.toByteString(); } - } static class FakeIndexQueryFactory implements IndexQueryFactory { - private final IndexingOptions options; private final boolean normalizedValuesAreReadable; @@ -136,7 +122,6 @@ public String createUnionQuery(Collection subqueries) { public IndexingOptions getIndexingOptions() { return options; } - } private MatchingRuleImpl getRule() { @@ -144,8 +129,12 @@ private MatchingRuleImpl getRule() { } static IndexingOptions newIndexingOptions() { + return newIndexingOptions(3); + } + + static IndexingOptions newIndexingOptions(int subStringLength) { final IndexingOptions options = mock(IndexingOptions.class); - when(options.substringKeySize()).thenReturn(3); + when(options.substringKeySize()).thenReturn(subStringLength); return options; } @@ -163,7 +152,7 @@ public Object[][] invalidAssertions() { }; } - @Test(dataProvider = "invalidAssertions", expectedExceptions = { DecodeException.class }) + @Test(dataProvider = "invalidAssertions", expectedExceptions = DecodeException.class) public void testInvalidAssertion(String assertionValue) throws Exception { getRule().getAssertion(null, valueOfUtf8(assertionValue)); } @@ -197,6 +186,10 @@ private String gen() { return sb.toString(); } + private String subStringIndexID(String matchingRule) { + return matchingRule + ":" + subStringLength; + } + @Test(dataProvider = "validAssertions") public void testValidAssertions(String attrValue, String assertionValue, ConditionResult expected) throws Exception { @@ -213,10 +206,10 @@ public void testSubstringCreateIndexQueryForFinalWithMultipleSubqueries() throws null, null, Collections.EMPTY_LIST, valueOfUtf8("this")); assertEquals( - assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())), + assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(subStringLength))), "intersect[" - + "exactMatch(" + SMR_CASE_EXACT_OID + ", value=='his'), " - + "exactMatch(" + SMR_CASE_EXACT_OID + ", value=='thi')" + + "exactMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", value=='his'), " + + "exactMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", value=='thi')" + "]"); } @@ -226,13 +219,13 @@ public void testSubstringCreateIndexQueryForAllNoSubqueries() throws Exception { null, valueOfUtf8("abc"), Arrays.asList(toByteStrings("def", "ghi")), valueOfUtf8("jkl")); assertEquals( - assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())), + assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(subStringLength))), "intersect[" + "rangeMatch(" + EMR_CASE_EXACT_OID + ", 'abc' <= value < 'abd'), " - + "exactMatch(" + SMR_CASE_EXACT_OID + ", value=='def'), " - + "exactMatch(" + SMR_CASE_EXACT_OID + ", value=='ghi'), " - + "exactMatch(" + SMR_CASE_EXACT_OID + ", value=='jkl'), " - + "exactMatch(" + SMR_CASE_EXACT_OID + ", value=='abc')" + + "exactMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", value=='def'), " + + "exactMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", value=='ghi'), " + + "exactMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", value=='jkl'), " + + "exactMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", value=='abc')" + "]"); } @@ -243,10 +236,10 @@ public void testSubstringCreateIndexQueryWithInitial() throws Exception { null, valueOfUtf8("aa"), Collections.EMPTY_LIST, null); assertEquals( - assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())), + assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(subStringLength))), "intersect[" - + "rangeMatch(" + EMR_CASE_EXACT_OID + ", 'aa' <= value < 'ab'), " - + "rangeMatch(" + SMR_CASE_EXACT_OID + ", 'aa' <= value < 'ab')" + + "rangeMatch(" + EMR_CASE_EXACT_OID + ", 'aa' <= value < 'ab'), " + + "rangeMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", 'aa' <= value < 'ab')" + "]"); } @@ -258,12 +251,12 @@ public void testSubstringCreateIndexQueryWithInitialOverflowsInRange() throws Ex null, lower, Collections.EMPTY_LIST, null); assertEquals( - assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions())), + assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(subStringLength))), // 0x00 is the nul byte, a.k.a. string terminator // so everything after it is not part of the string "intersect[" + "rangeMatch(" + EMR_CASE_EXACT_OID + ", '" + lower + "' <= value < 'b\u0000'), " - + "rangeMatch(" + SMR_CASE_EXACT_OID + ", '" + lower + "' <= value < 'b\u0000')" + + "rangeMatch(" + subStringIndexID(SMR_CASE_EXACT_OID) + ", '" + lower + "' <= value < 'b\u0000')" + "]"); } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java similarity index 65% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java index fff1f7dbd..f26c2834d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AbstractSyntaxTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java index 8cb1fe6a5..3b7392fb4 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ApproximateMatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeBuilderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeBuilderTestCase.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeBuilderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeBuilderTestCase.java index 93d6ad39d..1a3f3071e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeBuilderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeBuilderTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java similarity index 83% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java index 88da6be69..5f79e1581 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,12 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Attribute type syntax tests. - */ +/** Attribute type syntax tests. */ @Test public class AttributeTypeSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -120,10 +107,8 @@ public Object[][] createAcceptableValues() { + " NO-USER-MODIFICATION USAGE userApplications", false }, }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_ATTRIBUTE_TYPE_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java index bed5db598..c261aa08f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AttributeTypeTest.java @@ -1,31 +1,22 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; +import static org.assertj.core.api.Assertions.assertThat; import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; import java.util.Iterator; @@ -90,6 +81,7 @@ public AttributeTypeTest() throws Exception { } } + @Override @DataProvider(name = "equalsTestData") public Object[][] createEqualsTestData() throws SchemaException, DecodeException { return new Object[][] { @@ -490,37 +482,39 @@ public void testIsSingleValue() throws Exception { Assert.assertFalse(type.isSingleValue()); } - /** - * Check that the simple constructor throws an NPE when mandatory parameters - * are not specified. - * - * @throws Exception - * If the test failed unexpectedly. - */ - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNoSupNorSyntax1() throws Exception { - final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema()); - builder.buildAttributeType("1.2.1") - .names(EMPTY_NAMES) - .obsolete(true) - .usage(AttributeUsage.DSA_OPERATION) - .addToSchema(); + @Test(expectedExceptions = LocalizedIllegalArgumentException.class) + public void attributeTypeDefinitionsRequireSyntaxOrSuperiorWhenStrict1() throws Exception { + new SchemaBuilder(Schema.getCoreSchema()) + .setOption(SchemaOptions.ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX, false) + .addAttributeType("(1.2.1)", true); + } - builder.addAttributeType("( 1.2.2 OBSOLETE SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )", false); + @Test(expectedExceptions = IllegalArgumentException.class) + public void attributeTypeDefinitionsRequireSyntaxOrSuperiorWhenStrict2() throws Exception { + new SchemaBuilder(Schema.getCoreSchema()) + .setOption(SchemaOptions.ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX, false) + .buildAttributeType("1.2.1") + .addToSchema(); + } + @Test + public void attributeTypeDefinitionsDoNotRequireSyntaxOrSuperiorWhenTolerant1() throws Exception { + final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) + .addAttributeType("(1.2.1)", true).toSchema(); + assertThat(schema.getWarnings()).isEmpty(); + assertThat(schema.getAttributeType("1.2.1").getSuperiorType()).isNull(); + assertThat(schema.getAttributeType("1.2.1").getSyntax()).isSameAs(schema.getDefaultSyntax()); } - /** - * Check that the simple constructor throws an NPE when mandatory parameters - * are not specified. - * - * @throws Exception - * If the test failed unexpectedly. - */ - @Test(expectedExceptions = IllegalArgumentException.class) - public void testNoSupNorSyntax2() throws Exception { - final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema()); - builder.addAttributeType("( 1.2.2 OBSOLETE SINGLE-VALUE )", false); + @Test + public void attributeTypeDefinitionsDoNotRequireSyntaxOrSuperiorWhenTolerant2() throws Exception { + final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) + .buildAttributeType("1.2.1") + .addToSchema() + .toSchema(); + assertThat(schema.getWarnings()).isEmpty(); + assertThat(schema.getAttributeType("1.2.1").getSuperiorType()).isNull(); + assertThat(schema.getAttributeType("1.2.1").getSyntax()).isSameAs(schema.getDefaultSyntax()); } @Test @@ -535,6 +529,7 @@ public void testNoUserModNonOperational() throws Exception { Assert.assertFalse(builder.toSchema().getWarnings().isEmpty()); } + @Override protected SchemaElement getElement(final String description, final Map> extraProperties) throws SchemaException { final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema()); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImplTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImplTest.java similarity index 72% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImplTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImplTest.java index 17d3bc664..84b4a5e20 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImplTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/AuthPasswordSyntaxImplTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Portions Copyright 2015 ForgeRock AS + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java similarity index 51% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java index e788f2bfc..5157b8dda 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringEqualityMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,11 +21,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the BitStringEqualityMatchingRule. - */ +/** Test the BitStringEqualityMatchingRule. */ public class BitStringEqualityMatchingRuleTest extends MatchingRuleTest { - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -46,7 +34,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { { "\'1010\'A" }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -56,7 +43,6 @@ public Object[][] createMatchingRuleTest() { { "\'0\'B", "\'1\'B", ConditionResult.FALSE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_BIT_STRING_OID); diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java new file mode 100644 index 000000000..9d7a650c8 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BitStringSyntaxTest.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BIT_STRING_OID; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Bit string syntax tests. */ +@Test +public class BitStringSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object[][] { + { "'0101'B", true }, + { "'1'B", true }, + { "'0'B", true }, + { "invalid", false }, + { "1", false }, + { "'010100000111111010101000'B", true }, + }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_BIT_STRING_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java similarity index 55% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java index b1e73982c..2614b368d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanEqualityMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,19 +21,14 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the BooleanEqualityMatchingRule. - */ +/** Test the BooleanEqualityMatchingRule. */ public class BooleanEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { { "garbage" }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -58,10 +44,8 @@ public Object[][] createMatchingRuleTest() { { "TRUE", "false", ConditionResult.FALSE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_BOOLEAN_OID); } - } diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxTest.java new file mode 100644 index 000000000..c283de39f --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/BooleanSyntaxTest.java @@ -0,0 +1,52 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_BOOLEAN_OID; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Boolean syntax tests. */ +@Test +public class BooleanSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object[][] { + { "TRUE", true }, + { "FALSE", true }, + { "true", true }, + { "false", true }, + { "YES", true }, + { "NO", true }, + { "ON", true }, + { "OFF", true }, + { "1", true }, + { "0", true }, + { "'0'B", false }, + { "invalidtrue", false }, + { " true", false }, + { "NOT", false }, + { "'010100000111111010101000'B", false } + }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_BOOLEAN_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java similarity index 55% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java index d12cc6131..fb4e0c7f6 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactEqualityMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,19 +21,14 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseExactEqualityMatchingRule. - */ +/** Test the CaseExactEqualityMatchingRule. */ public class CaseExactEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] {}; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -57,10 +43,8 @@ public Object[][] createMatchingRuleTest() { { "ABC45678", "abc45678", ConditionResult.FALSE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_CASE_EXACT_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java similarity index 56% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java index abf20b3ca..0c10fc180 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5EqualityMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +21,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseExactIA5EqualityMatchingRule. - */ +/** Test the CaseExactIA5EqualityMatchingRule. */ public class CaseExactIA5EqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -44,7 +31,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -59,10 +45,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_CASE_EXACT_IA5_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java similarity index 78% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java index fccd3e02f..4bb534b10 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactIA5SubstringMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,10 +21,7 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseExactIA5SubstringMatchingRule. - */ -@SuppressWarnings("javadoc") +/** Test the CaseExactIA5SubstringMatchingRule. */ public class CaseExactIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest { @Override @@ -51,7 +39,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { { "12345678\uFFFD" }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringFinalMatchData") public Object[][] createSubstringFinalMatchData() { @@ -69,7 +56,6 @@ public Object[][] createSubstringFinalMatchData() { { "end with space ", "space", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringInitialMatchData") public Object[][] createSubstringInitialMatchData() { @@ -85,7 +71,6 @@ public Object[][] createSubstringInitialMatchData() { { "this is a value", "THIS", ConditionResult.FALSE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringMiddleMatchData") public Object[][] createSubstringMiddleMatchData() { @@ -107,7 +92,6 @@ public Object[][] createSubstringMiddleMatchData() { { "this is a value", strings(" "), ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_IA5_OID); diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java new file mode 100644 index 000000000..0b6b7dc43 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactOrderingMatchingRuleTest.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.OMR_CASE_EXACT_OID; + +import org.testng.annotations.DataProvider; + +/** Test the CaseExactOrderingMatchingRule. */ +public class CaseExactOrderingMatchingRuleTest extends OrderingMatchingRuleTest { + @Override + @DataProvider(name = "OrderingMatchingRuleInvalidValues") + public Object[][] createOrderingMatchingRuleInvalidValues() { + return new Object[][] {}; + } + + @Override + @DataProvider(name = "Orderingmatchingrules") + public Object[][] createOrderingMatchingRuleTestData() { + return new Object[][] { + { "12345678", "02345678", 1 }, + { "abcdef", "bcdefa", -1 }, + { "abcdef", "abcdef", 0 }, }; + } + + @Override + protected MatchingRule getRule() { + return Schema.getCoreSchema().getMatchingRule(OMR_CASE_EXACT_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java similarity index 77% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java index bbbaf3872..3ff3625dd 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseExactSubstringMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,10 +21,7 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseExactSubstringMatchingRule class. - */ -@SuppressWarnings("javadoc") +/** Test the CaseExactSubstringMatchingRule class. */ public class CaseExactSubstringMatchingRuleTest extends SubstringMatchingRuleTest { @Override @@ -48,7 +36,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] {}; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringFinalMatchData") public Object[][] createSubstringFinalMatchData() { @@ -66,7 +53,6 @@ public Object[][] createSubstringFinalMatchData() { { "end with space ", "space", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringInitialMatchData") public Object[][] createSubstringInitialMatchData() { @@ -82,7 +68,6 @@ public Object[][] createSubstringInitialMatchData() { { "this is a value", "THIS", ConditionResult.FALSE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringMiddleMatchData") public Object[][] createSubstringMiddleMatchData() { @@ -104,7 +89,6 @@ public Object[][] createSubstringMiddleMatchData() { { "this is a value", strings(" "), ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(SMR_CASE_EXACT_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java similarity index 63% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java index 2c7cab8e3..01d112b60 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreEqualityMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,18 +21,14 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseIgnoreEqualityMatchingRule. - */ +/** Test the CaseIgnoreEqualityMatchingRule. */ public class CaseIgnoreEqualityMatchingRuleTest extends MatchingRuleTest { - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] {}; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -62,12 +49,9 @@ public Object[][] createMatchingRuleTest() { { "foo\u0149bar", "foo\u02BC\u006Ebar", ConditionResult.TRUE }, { "foo\u017Bbar", "foo\u017Cbar", ConditionResult.TRUE }, { "foo\u017BBAR", "foo\u017Cbar", ConditionResult.TRUE }, - - }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_CASE_IGNORE_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java similarity index 50% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java index c826a5380..735859d2c 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5EqualityMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +21,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseExactIA5EqualityMatchingRule. - */ +/** Test the CaseExactIA5EqualityMatchingRule. */ public class CaseIgnoreIA5EqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -44,7 +31,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -54,10 +40,8 @@ public Object[][] createMatchingRuleTest() { { "ABC45678", "abc45678", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_CASE_IGNORE_IA5_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java similarity index 81% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java index 444b46a90..1ccf4df67 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreIA5SubstringMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +21,10 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseIgnoreIA5SubstringMatchingRule. - */ -@SuppressWarnings("javadoc") +/** Test the CaseIgnoreIA5SubstringMatchingRule. */ public class CaseIgnoreIA5SubstringMatchingRuleTest extends SubstringMatchingRuleTest { + @Override @DataProvider(name = "substringInvalidAssertionValues") public Object[][] createMatchingRuleInvalidAssertionValues() { return new Object[][] { { "12345678\uFFFD", new String[0], null }, @@ -43,12 +32,12 @@ public Object[][] createMatchingRuleInvalidAssertionValues() { { null, strings(), "12345678\uFFFD" }, }; } + @Override @DataProvider(name = "substringInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { { "12345678\uFFFD" }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringFinalMatchData") public Object[][] createSubstringFinalMatchData() { @@ -72,7 +61,6 @@ public Object[][] createSubstringFinalMatchData() { { "end with space ", "SPACE", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringInitialMatchData") public Object[][] createSubstringInitialMatchData() { @@ -92,7 +80,6 @@ public Object[][] createSubstringInitialMatchData() { { "this is a value", "THIS", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringMiddleMatchData") public Object[][] createSubstringMiddleMatchData() { @@ -118,7 +105,6 @@ public Object[][] createSubstringMiddleMatchData() { { "this is a value", strings(" "), ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_IA5_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java similarity index 57% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java index 28598575b..f104125ce 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreOrderingMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -29,19 +20,14 @@ import org.testng.annotations.DataProvider; -/** - * Test the CaseIgnoreOrderingMatchingRule. - */ +/** Test the CaseIgnoreOrderingMatchingRule. */ public class CaseIgnoreOrderingMatchingRuleTest extends OrderingMatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "OrderingMatchingRuleInvalidValues") public Object[][] createOrderingMatchingRuleInvalidValues() { return new Object[][] {}; } - /** {@inheritDoc} */ @Override @DataProvider(name = "Orderingmatchingrules") public Object[][] createOrderingMatchingRuleTestData() { @@ -61,7 +47,6 @@ public Object[][] createOrderingMatchingRuleTestData() { { "a", "\u00f8", -1 }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(OMR_CASE_IGNORE_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java similarity index 81% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java index bf0431feb..d6ff79c09 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CaseIgnoreSubstringMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,23 +21,21 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the CaseIgnoreSubstringMatchingRule. - */ -@SuppressWarnings("javadoc") +/** Test the CaseIgnoreSubstringMatchingRule. */ 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[][] {}; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringFinalMatchData") public Object[][] createSubstringFinalMatchData() { @@ -70,7 +59,6 @@ public Object[][] createSubstringFinalMatchData() { { "end with space ", "SPACE", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringInitialMatchData") public Object[][] createSubstringInitialMatchData() { @@ -90,7 +78,6 @@ public Object[][] createSubstringInitialMatchData() { { "this is a value", "THIS", ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringMiddleMatchData") public Object[][] createSubstringMiddleMatchData() { @@ -116,7 +103,6 @@ public Object[][] createSubstringMiddleMatchData() { { "this is a value", strings(" "), ConditionResult.TRUE }, }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(SMR_CASE_IGNORE_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java index 1fb467386..fedff9681 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateExactMatchingRuleImplTest.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2006-2008 Sun Microsystems, Inc. - * Portions Copyright 2013-2014 Manuel Gaupp - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2006-2008 Sun Microsystems, Inc. + * Portions Copyright 2013-2014 Manuel Gaupp + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java similarity index 85% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java index f22a84b4d..e2f1be85f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CertificateSyntaxTest.java @@ -1,29 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java index 00b1057ea..5fec536e2 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -39,15 +29,12 @@ @SuppressWarnings("javadoc") @Test public class CollationEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -82,7 +69,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule("fr.eq"); @@ -117,5 +103,4 @@ public void testCreateIndexQuery() throws Exception { ByteString normalizedValue = matchingRule.normalizeAttributeValue(value); assertEquals(indexQuery, "exactMatch(fr.shared, value=='" + normalizedValue.toHexString() + "')"); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java index 3752552ad..0fec59629 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,15 +28,12 @@ @SuppressWarnings("javadoc") @Test public class CollationGreaterThanMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -81,7 +68,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule("fr.gt"); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java index 9bd63972b..53b8d2d58 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationGreaterThanOrEqualMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,15 +28,12 @@ @SuppressWarnings("javadoc") @Test public class CollationGreaterThanOrEqualMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -81,11 +68,9 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule("fr.gte"); - } @Test diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java index 17017aa87..3cc18f6e4 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,15 +28,12 @@ @SuppressWarnings("javadoc") @Test public class CollationLessThanMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -81,7 +68,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule("fr.lt"); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java index 13dfc1275..ed8bcae3b 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationLessThanOrEqualMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,15 +28,12 @@ @SuppressWarnings("javadoc") @Test public class CollationLessThanOrEqualMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -81,7 +68,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule("fr.lte"); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java similarity index 84% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java index a7d7651ff..c140bc89e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CollationSubstringMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,18 +28,18 @@ @SuppressWarnings("javadoc") @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[][] { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringFinalMatchData") public Object[][] createSubstringFinalMatchData() { @@ -80,7 +70,6 @@ public Object[][] createSubstringFinalMatchData() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringInitialMatchData") public Object[][] createSubstringInitialMatchData() { @@ -107,7 +96,6 @@ public Object[][] createSubstringInitialMatchData() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringMiddleMatchData") public Object[][] createSubstringMiddleMatchData() { @@ -141,7 +129,6 @@ public Object[][] createSubstringMiddleMatchData() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule("fr.sub"); @@ -153,15 +140,17 @@ public void testCreateIndexQuery() throws Exception { MatchingRule matchingRule = getRule(); Assertion assertion = matchingRule.getAssertion(value); - String indexQuery = assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(), false)); + int subStringLength = 3; + String indexQuery = assertion.createIndexQuery(new FakeIndexQueryFactory(newIndexingOptions(subStringLength), + false)); ByteString binit = matchingRule.normalizeAttributeValue(ByteString.valueOfUtf8("a")); ByteString bfinal = matchingRule.normalizeAttributeValue(ByteString.valueOfUtf8("c")); assertEquals(indexQuery, "intersect[" - + "rangeMatch(fr.shared, '" + binit.toHexString() + "' <= value < '00 54'), " - + "rangeMatch(fr.substring, '" + bfinal.toHexString() + "' <= value < '00 56'), " - + "rangeMatch(fr.substring, '" + binit.toHexString() + "' <= value < '00 54')]" + + "rangeMatch(fr.shared, '" + binit.toHexString() + "' <= value < '0054'), " + + "rangeMatch(fr.substring:" + subStringLength + ", '" + bfinal.toHexString() + "' <= value < '0056'), " + + "rangeMatch(fr.substring:" + subStringLength + ", '" + binit.toHexString() + "' <= value < '0054')]" ); } } diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java new file mode 100644 index 000000000..9527a75de --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CoreSchemaTest.java @@ -0,0 +1,31 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + */ +package org.forgerock.opendj.ldap.schema; + +import org.testng.Assert; +import org.testng.annotations.Test; + +/** + * Core schema tests. + */ +@SuppressWarnings("javadoc") +public class CoreSchemaTest extends AbstractSchemaTestCase { + @Test + public final void testCoreSchemaWarnings() { + // Make sure core schema doesn't have any warnings. + Assert.assertTrue(Schema.getCoreSchema().getWarnings().isEmpty()); + } +} diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxTest.java new file mode 100644 index 000000000..ddc814d90 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/CountryStringSyntaxTest.java @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2012 Manuel Gaupp + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_COUNTRY_STRING_OID; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Country String syntax tests. */ +@Test +public class CountryStringSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object[][] { + // tests for the Country String syntax. + { "DE", true }, + { "de", false }, + { "SX", true }, + { "12", false }, + { "UK", true }, + { "Xf", false }, + { "ÖÄ", false }, // "\u00D6\u00C4" + }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_COUNTRY_STRING_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java similarity index 68% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java index ef90695a1..8c5de6489 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,9 +20,7 @@ import org.testng.annotations.DataProvider; -/** - * DIT content rule syntax tests. - */ +/** DIT content rule syntax tests. */ public class DITContentRuleSyntaxTest extends AbstractSyntaxTestCase { @Override @DataProvider(name = "acceptableValues") @@ -70,7 +58,6 @@ public Object[][] createAcceptableValues() { }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_DIT_CONTENT_RULE_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleTestCase.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleTestCase.java index b3246f4e3..735e375e5 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITContentRuleTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITStructureRuleTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITStructureRuleTestCase.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITStructureRuleTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITStructureRuleTestCase.java index 1cf899ac0..933f3d224 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DITStructureRuleTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DITStructureRuleTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java similarity index 52% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java index bcc92a9f5..dcf5cd8a9 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DirectoryStringFirstComponentEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,20 +21,15 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test the DirectoryStringFirstComponentEqualityMatchingRule. - */ +/** Test the DirectoryStringFirstComponentEqualityMatchingRule. */ @Test public class DirectoryStringFirstComponentEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] {}; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -55,10 +40,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_DIRECTORY_STRING_FIRST_COMPONENT_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java index c0e700f30..5a5a79ead 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/DistinguishedNameEqualityMatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2013-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,6 +21,7 @@ import static org.testng.Assert.assertEquals; import org.forgerock.opendj.ldap.ByteString; +import org.forgerock.opendj.ldap.ByteStringBuilder; import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; import org.testng.annotations.Test; @@ -40,6 +31,7 @@ */ @SuppressWarnings("javadoc") public class DistinguishedNameEqualityMatchingRuleTest extends MatchingRuleTest { + @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { return new Object[][] { { "manager" }, { "manager " }, @@ -66,6 +58,7 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { { "cn=,dc=example,dc=com" } }; } + @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { return new Object[][] { @@ -184,6 +177,7 @@ public Object[][] createData() { { "O=\"Sue, Grabbit and Runn\",C=US", "c=us\u0000o=sue\u002C grabbit and runn" }, }; } + @Override protected MatchingRule getRule() { return CoreSchema.getDistinguishedNameMatchingRule(); } @@ -201,8 +195,14 @@ public void testNormalization(final String value1, final String value2) throws E final MatchingRule rule = getRule(); final ByteString normalizedValue1 = rule.normalizeAttributeValue(ByteString.valueOfUtf8(value1)); - final ByteString expectedValue = ByteString.valueOfUtf8(value2); + final ByteString expectedValue = toExpectedNormalizedByteString(value2); assertEquals(normalizedValue1, expectedValue); } + private ByteString toExpectedNormalizedByteString(final String s) { + if (s.isEmpty()) { + return ByteString.valueOfUtf8(s); + } + return new ByteStringBuilder().appendByte(0).appendUtf8(s).toByteString(); + } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java similarity index 98% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java index 6c652493c..5ac5881fa 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/EntrySchemaCheckingTestCase.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -1132,6 +1123,7 @@ private Entry newEntry(final String... ldif) { 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); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java index 71c03992f..7ce2b00d4 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/EnumSyntaxTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -35,12 +25,9 @@ import static org.forgerock.opendj.ldap.schema.SchemaConstants.*; import static org.testng.Assert.*; -/** - * Enum syntax tests. - */ +/** Enum syntax tests. */ @SuppressWarnings("javadoc") public class EnumSyntaxTestCase extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -83,7 +70,6 @@ public void testDuplicateEnum() throws SchemaException, DecodeException { builder.toSchema(); } - /** {@inheritDoc} */ @Override protected Syntax getRule() throws SchemaException, DecodeException { final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema()); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java similarity index 73% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java index eeeac74d4..2a95e90f3 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the GeneralizedTimeEqualityMatchingRule. - */ +/** Test the GeneralizedTimeEqualityMatchingRule. */ public class GeneralizedTimeEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -61,7 +47,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -84,10 +69,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_GENERALIZED_TIME_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java similarity index 66% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java index ca7ab8200..c90aea434 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeOrderingMatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.testng.annotations.DataProvider; -/** - * Test the GeneralizedTimeOrderingMatchingRule. - */ +/** Test the GeneralizedTimeOrderingMatchingRule. */ public class GeneralizedTimeOrderingMatchingRuleTest extends OrderingMatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "OrderingMatchingRuleInvalidValues") public Object[][] createOrderingMatchingRuleInvalidValues() { @@ -61,7 +47,6 @@ public Object[][] createOrderingMatchingRuleInvalidValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "Orderingmatchingrules") public Object[][] createOrderingMatchingRuleTestData() { @@ -80,7 +65,6 @@ public Object[][] createOrderingMatchingRuleTestData() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(OMR_GENERALIZED_TIME_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java similarity index 59% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java index 9fa5e173e..b7ec520b5 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GeneralizedTimeSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,9 +20,7 @@ import org.testng.annotations.DataProvider; -/** - * Generalized time syntax tests. - */ +/** Generalized time syntax tests. */ public class GeneralizedTimeSyntaxTest extends AbstractSyntaxTestCase { @Override @DataProvider(name = "acceptableValues") @@ -49,10 +37,8 @@ public Object[][] createAcceptableValues() { { "2006", false }, }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_GENERALIZED_TIME_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java similarity index 50% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java index c46802c05..a6106a141 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/GuideSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,11 +20,8 @@ import org.testng.annotations.DataProvider; -/** - * Guide syntax tests. - */ +/** Guide syntax tests. */ public class GuideSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -46,7 +33,6 @@ public Object[][] createAcceptableValues() { { "sn$EQ|(cn$APPROX&?false)", true }, { "sn$EQ|(cn$APPROX&|?false)", false }, }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_GUIDE_OID); diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java new file mode 100644 index 000000000..bb0fe1cd6 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IA5StringSyntaxTest.java @@ -0,0 +1,35 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_IA5_STRING_OID; + +import org.testng.annotations.DataProvider; + +/** IA5 string syntax tests. */ +public class IA5StringSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object[][] { { "12345678", true }, { "12345678\u2163", false }, }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_IA5_STRING_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java similarity index 65% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java index 1daa2d694..b0bfb70c0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the IntegerEqualityMatchingRule. - */ +/** Test the IntegerEqualityMatchingRule. */ public class IntegerEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -60,7 +46,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -76,10 +61,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_INTEGER_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java similarity index 83% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java index d9fc857e3..38116bd3e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerOrderingMatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -37,13 +27,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test the IntegerOrderingMatchingRule. - */ +/** Test the IntegerOrderingMatchingRule. */ @SuppressWarnings("javadoc") public class IntegerOrderingMatchingRuleTest extends OrderingMatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "OrderingMatchingRuleInvalidValues") public Object[][] createOrderingMatchingRuleInvalidValues() { @@ -68,7 +54,6 @@ public Object[][] createOrderingMatchingRuleInvalidValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "Orderingmatchingrules") public Object[][] createOrderingMatchingRuleTestData() { @@ -96,7 +81,6 @@ public Object[][] createOrderingMatchingRuleTestData() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(OMR_INTEGER_OID); diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxTest.java new file mode 100644 index 000000000..92b70837d --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/IntegerSyntaxTest.java @@ -0,0 +1,47 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_INTEGER_OID; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Integer syntax tests. */ +@Test +public class IntegerSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object [][] { + {"123", true}, + {"987654321", true}, + {"-1", true}, + {"10001", true}, + {"001", false}, + {"-01", false}, + {"12345678\u2163", false}, + {" 123", false}, + {"123 ", false} + }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_INTEGER_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxTest.java similarity index 84% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxTest.java index fe48ba262..7c5616b96 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/JPEGSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java similarity index 76% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java index d80d1fef9..099621850 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/LDAPSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,12 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * LDAP syntax tests. - */ +/** LDAP syntax tests. */ @Test public class LDAPSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -83,7 +70,6 @@ public Object[][] createAcceptableValues() { }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_LDAP_SYNTAX_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java similarity index 52% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java index 18dc614d0..952559590 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,12 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Matching rule syntax tests. - */ +/** Matching rule syntax tests. */ @Test public class MatchingRuleSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -53,10 +40,8 @@ public Object[][] createAcceptableValues() { + " X-name ( 'this is an extension' ) ", false }, }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_MATCHING_RULE_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java similarity index 77% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java index 086dfbc19..538652d74 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java similarity index 97% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java index 5b9292daa..5e7829e86 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseBuilderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseBuilderTestCase.java similarity index 87% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseBuilderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseBuilderTestCase.java index cf88dec3a..8489a6bbd 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseBuilderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseBuilderTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java similarity index 51% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java index 39415549b..c3f1c8f28 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/MatchingRuleUseSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,12 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Matching rule use syntax tests. - */ +/** Matching rule use syntax tests. */ @Test public class MatchingRuleUseSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -51,7 +38,6 @@ public Object[][] createAcceptableValues() { + " X-name ( 'this is an extension' ) ", false }, }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_MATCHING_RULE_USE_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java similarity index 97% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java index 98e03013c..f66aabf35 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NameFormTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java similarity index 56% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java index 0e53965bf..05fa3305a 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,13 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test the NumericStringEqualityMatchingRule. - */ +/** Test the NumericStringEqualityMatchingRule. */ @Test public class NumericStringEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -45,7 +31,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -60,10 +45,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_NUMERIC_STRING_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java similarity index 54% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java index d89fcd071..8aa4b0591 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringOrderingMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,13 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test the NumericStringOrderingMatchingRule. - */ +/** Test the NumericStringOrderingMatchingRule. */ @Test public class NumericStringOrderingMatchingRuleTest extends OrderingMatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "OrderingMatchingRuleInvalidValues") public Object[][] createOrderingMatchingRuleInvalidValues() { @@ -44,7 +31,6 @@ public Object[][] createOrderingMatchingRuleInvalidValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "Orderingmatchingrules") public Object[][] createOrderingMatchingRuleTestData() { @@ -62,7 +48,6 @@ public Object[][] createOrderingMatchingRuleTestData() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(OMR_NUMERIC_STRING_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java similarity index 77% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java index e3bbce316..86fefb16e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/NumericStringSubstringMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,10 +22,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test the NumericStringSubstringMatchingRule. - */ -@SuppressWarnings("javadoc") +/** Test the NumericStringSubstringMatchingRule. */ @Test public class NumericStringSubstringMatchingRuleTest extends SubstringMatchingRuleTest { @@ -52,7 +40,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringFinalMatchData") public Object[][] createSubstringFinalMatchData() { @@ -67,7 +54,6 @@ public Object[][] createSubstringFinalMatchData() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringInitialMatchData") public Object[][] createSubstringInitialMatchData() { @@ -84,7 +70,6 @@ public Object[][] createSubstringInitialMatchData() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "substringMiddleMatchData") public Object[][] createSubstringMiddleMatchData() { @@ -108,7 +93,6 @@ public Object[][] createSubstringMiddleMatchData() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(SMR_NUMERIC_STRING_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java similarity index 91% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java index 37ad0a0da..626957582 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ObjectClassBuilderTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java similarity index 77% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java index ae2a407bd..33f8034a0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/OrderingMatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java new file mode 100644 index 000000000..31661ca9e --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/OtherMailboxSyntaxTest.java @@ -0,0 +1,37 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_OTHER_MAILBOX_OID; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Other mailbox syntax tests. */ +@Test +public class OtherMailboxSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object[][] { { "MyMail$Mymailbox", true }, { "MyMailMymailbox", false }, }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_OTHER_MAILBOX_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java similarity index 88% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java index ac2a722ce..41baa5090 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/PartialDateAndTimeMatchingRuleTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -44,8 +34,6 @@ @SuppressWarnings("javadoc") @Test public class PartialDateAndTimeMatchingRuleTestCase extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -67,6 +55,7 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } + @Override @DataProvider(name = "matchingRuleInvalidAssertionValues") public Object[][] createMatchingRuleInvalidAssertionValues() { return new Object[][] { @@ -107,7 +96,6 @@ public Object[][] createMatchingRuleInvalidAssertionValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -176,7 +164,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return CoreSchema.getInstance().getMatchingRule(SchemaConstants.MR_PARTIAL_DATE_AND_TIME_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java similarity index 51% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java index afad82a6f..1ea2f0678 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/PresentationAddressEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the PresentationAddressEqualityMatchingRule. - */ +/** Test the PresentationAddressEqualityMatchingRule. */ public class PresentationAddressEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -43,7 +29,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -55,10 +40,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_PRESENTATION_ADDRESS_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java similarity index 51% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java index 9ef118bbd..63ec174b3 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/ProtocolInformationEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the ProtocolInformationEqualityMatchingRule. - */ +/** Test the ProtocolInformationEqualityMatchingRule. */ public class ProtocolInformationEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -43,7 +29,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -55,10 +40,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_PROTOCOL_INFORMATION_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java similarity index 61% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java index 01552ae1e..b538354f4 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RegexSyntaxTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -32,12 +22,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Regex syntax tests. - */ +/** Regex syntax tests. */ @SuppressWarnings("javadoc") public class RegexSyntaxTestCase extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -62,7 +49,6 @@ public void testInvalidPattern() { Assert.assertFalse(builder.toSchema().getWarnings().isEmpty()); } - /** {@inheritDoc} */ @Override protected Syntax getRule() { final SchemaBuilder builder = new SchemaBuilder(Schema.getCoreSchema()); @@ -70,5 +56,4 @@ protected Syntax getRule() { .compile("^[a-z-A-Z]+:[0-9.]+\\d$"), false); return builder.toSchema().getSyntax("1.1.1"); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java index ff05a00c5..2cf608273 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeGreaterThanMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -44,8 +34,6 @@ @SuppressWarnings("javadoc") @Test public class RelativeTimeGreaterThanMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -67,6 +55,7 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } + @Override @DataProvider(name = "matchingRuleInvalidAssertionValues") public Object[][] createMatchingRuleInvalidAssertionValues() { return new Object[][] { @@ -77,7 +66,6 @@ public Object[][] createMatchingRuleInvalidAssertionValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -112,7 +100,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return CoreSchema.getInstance().getMatchingRule(SchemaConstants.OMR_RELATIVE_TIME_GREATER_THAN_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java similarity index 80% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java index 5a02902f3..aa354042a 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/RelativeTimeLessThanMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014-2015 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -44,8 +34,6 @@ @SuppressWarnings("javadoc") @Test public class RelativeTimeLessThanMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -67,6 +55,7 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } + @Override @DataProvider(name = "matchingRuleInvalidAssertionValues") public Object[][] createMatchingRuleInvalidAssertionValues() { return new Object[][] { @@ -77,7 +66,6 @@ public Object[][] createMatchingRuleInvalidAssertionValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -113,7 +101,6 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return CoreSchema.getInstance().getMatchingRule(SchemaConstants.OMR_RELATIVE_TIME_LESS_THAN_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java similarity index 82% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java index 2402b869f..953c591fc 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaBuilderTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Portions Copyright 2012-2015 ForgeRock AS. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -35,6 +25,10 @@ import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; +import java.util.ArrayList; +import java.util.regex.Pattern; + +import org.forgerock.i18n.LocalizableMessageBuilder; import org.forgerock.i18n.LocalizedIllegalArgumentException; import org.forgerock.opendj.ldap.ByteString; import org.forgerock.opendj.ldap.Connection; @@ -47,11 +41,10 @@ import org.forgerock.opendj.ldap.requests.SearchRequest; import org.forgerock.opendj.ldap.responses.Responses; import org.forgerock.opendj.ldap.responses.SearchResultEntry; +import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test SchemaBuilder. - */ +/** Test SchemaBuilder. */ @SuppressWarnings("javadoc") public class SchemaBuilderTestCase extends AbstractSchemaTestCase { @@ -60,7 +53,7 @@ public class SchemaBuilderTestCase extends AbstractSchemaTestCase { * attribute types regardless of the order in which they were added. */ @Test - public void testAttributeTypeDependenciesChildThenParent() { + public void attributeTypeDependenciesChildThenParent() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .addAttributeType("( childtype-oid NAME 'childtype' SUP parenttype )", @@ -78,7 +71,7 @@ public void testAttributeTypeDependenciesChildThenParent() { * attribute types regardless of the order in which they were added. */ @Test - public void testAttributeTypeDependenciesParentThenChild() { + public void attributeTypeDependenciesParentThenChild() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .addAttributeType( @@ -91,13 +84,23 @@ public void testAttributeTypeDependenciesParentThenChild() { "1.3.6.1.4.1.1466.115.121.1.15"); } - /** - * Tests that attribute types must have a syntax or a superior. - */ + /** Tests that attribute types must have a syntax or a superior when strict. */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public void testAttributeTypeNoSuperiorNoSyntax() { - new SchemaBuilder(Schema.getCoreSchema()).addAttributeType( - "( parenttype-oid NAME 'parenttype' )", false); + public void attributeTypeNoSuperiorNoSyntaxWhenStrict() { + new SchemaBuilder(Schema.getCoreSchema()) + .setOption(ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX, false) + .addAttributeType("( parenttype-oid NAME 'parenttype' )", false); + } + + /** Tests that attribute types do not have to have a syntax or a superior when leniant. */ + @Test + public void attributeTypeNoSuperiorNoSyntaxWhenLeniant() { + final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) + .addAttributeType("( parenttype-oid NAME 'parenttype' )", false) + .toSchema(); + assertThat(schema.getAttributeType("parenttype").getSyntax()).isNotNull(); + assertThat(schema.getAttributeType("parenttype").getSyntax().getOID()) + .isEqualTo("1.3.6.1.4.1.1466.115.121.1.40"); } /** @@ -105,7 +108,7 @@ public void testAttributeTypeNoSuperiorNoSyntax() { * attribute types regardless of the order. */ @Test - public void testAttributeTypeSuperiorFailureChildThenParent() { + public void attributeTypeSuperiorFailureChildThenParent() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).addAttributeType( "( childtype-oid NAME 'childtype' SUP parenttype )", false) @@ -132,7 +135,7 @@ public void testAttributeTypeSuperiorFailureChildThenParent() { * attribute types regardless of the order. */ @Test - public void testAttributeTypeSuperiorFailureParentThenChild() { + public void attributeTypeSuperiorFailureParentThenChild() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).addAttributeType( "( parenttype-oid NAME 'parenttype' SUP xxx )", false).addAttributeType( @@ -153,12 +156,9 @@ public void testAttributeTypeSuperiorFailureParentThenChild() { } } - /** - * Test for OPENDJ-156: Errors when parsing collective attribute - * definitions. - */ + /** Test for OPENDJ-156: Errors when parsing collective attribute definitions. */ @Test - public void testCollectiveAttribute() { + public void collectiveAttribute() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).addAttributeType( "( 2.5.4.11.1 NAME 'c-ou' " @@ -172,39 +172,33 @@ public void testCollectiveAttribute() { * another and take advantage of copy on write. */ @Test - public void testCopyOnWriteNoChanges() { + public void copyOnWriteNoChanges() { final Schema baseSchema = Schema.getCoreSchema(); final Schema schema = new SchemaBuilder(baseSchema).toSchema(); assertThat(schema).isSameAs(baseSchema); } - /** - * Tests that it is possible to create a schema which is based on another. - */ + /** Tests that it is possible to create a schema which is based on another. */ @Test - public void testCopyOnWriteWithChanges() { - + public void copyOnWriteWithChanges() { final Schema baseSchema = Schema.getCoreSchema(); final Schema schema = new SchemaBuilder(baseSchema).addAttributeType( "( testtype-oid NAME 'testtype' SUP name )", false).toSchema(); assertThat(schema).isNotSameAs(baseSchema); - assertThat(schema.getObjectClasses().containsAll(baseSchema.getObjectClasses())); - assertThat(schema.getObjectClasses().size()) - .isEqualTo(baseSchema.getObjectClasses().size()); + assertThat(new ArrayList<>(schema.getObjectClasses())).isEqualTo( + new ArrayList<>(baseSchema.getObjectClasses())); assertThat(schema.getAttributeTypes().containsAll(baseSchema.getAttributeTypes())); assertThat(schema.getAttributeType("testtype")).isNotNull(); - assertThat(schema.getSchemaName()).isEqualTo(baseSchema.getSchemaName()); + assertThat(schema.getSchemaName()).startsWith(baseSchema.getSchemaName()); assertThat(schema.getOption(ALLOW_MALFORMED_NAMES_AND_OPTIONS)) .isEqualTo(baseSchema.getOption(ALLOW_MALFORMED_NAMES_AND_OPTIONS)); } - /** - * Tests that it is possible to create an empty schema. - */ + /** Tests that it is possible to create an empty schema. */ @Test - public void testCreateEmptySchema() { + public void createEmptySchema() { final Schema schema = new SchemaBuilder().toSchema(); assertThat(schema.getAttributeTypes()).isEmpty(); assertThat(schema.getObjectClasses()).isEmpty(); @@ -216,12 +210,9 @@ public void testCreateEmptySchema() { // Could go on... } - /** - * Tests that multiple consecutive invocations of toSchema return the exact - * same schema. - */ + /** Tests that multiple consecutive invocations of toSchema return the exact same schema. */ @Test - public void testMultipleToSchema1() { + public void multipleToSchema1() { final Schema baseSchema = Schema.getCoreSchema(); final SchemaBuilder builder = new SchemaBuilder(baseSchema); final Schema schema1 = builder.toSchema(); @@ -230,12 +221,9 @@ public void testMultipleToSchema1() { assertThat(schema1).isSameAs(schema2); } - /** - * Tests that multiple consecutive invocations of toSchema return the exact - * same schema. - */ + /** Tests that multiple consecutive invocations of toSchema return the exact same schema. */ @Test - public void testMultipleToSchema2() { + public void multipleToSchema2() { final SchemaBuilder builder = new SchemaBuilder().addAttributeType( "( testtype-oid NAME 'testtype' SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )", @@ -252,7 +240,7 @@ public void testMultipleToSchema2() { * object classes regardless of the order in which they were added. */ @Test - public void testObjectClassDependenciesChildThenParent() { + public void objectClassDependenciesChildThenParent() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).addObjectClass( "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )", @@ -272,7 +260,7 @@ public void testObjectClassDependenciesChildThenParent() { * object classes regardless of the order in which they were added. */ @Test - public void testObjectClassDependenciesParentThenChild() { + public void objectClassDependenciesParentThenChild() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .addObjectClass( @@ -294,7 +282,7 @@ public void testObjectClassDependenciesParentThenChild() { * object classes regardless of the order. */ @Test - public void testObjectClassSuperiorFailureChildThenParent() { + public void objectClassSuperiorFailureChildThenParent() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).addObjectClass( "( childtype-oid NAME 'childtype' SUP parenttype STRUCTURAL MUST sn )", @@ -322,7 +310,7 @@ public void testObjectClassSuperiorFailureChildThenParent() { * object classes regardless of the order. */ @Test - public void testObjectClassSuperiorFailureParentThenChild() { + public void objectClassSuperiorFailureParentThenChild() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .addObjectClass( @@ -347,12 +335,9 @@ public void testObjectClassSuperiorFailureParentThenChild() { } } - /** - * Tests that a schema builder can be re-used after toSchema has been - * called. - */ + /** Tests that a schema builder can be re-used after toSchema has been called. */ @Test - public void testReuseSchemaBuilder() { + public void reuseSchemaBuilder() { final SchemaBuilder builder = new SchemaBuilder(); final Schema schema1 = builder.addAttributeType( @@ -377,7 +362,7 @@ public void testReuseSchemaBuilder() { * @throws Exception */ @Test(expectedExceptions = NullPointerException.class) - public final void testSchemaBuilderDoesntAllowNullEntry() throws Exception { + public final void schemaBuilderDoesntAllowNullEntry() throws Exception { new SchemaBuilder((Entry) null); } @@ -387,7 +372,7 @@ public final void testSchemaBuilderDoesntAllowNullEntry() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryWithCoreSchema() throws Exception { + public final void schemaBuilderWithEntryWithCoreSchema() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -439,7 +424,7 @@ public final void testSchemaBuilderWithEntryWithCoreSchema() throws Exception { * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderWithEntryWithoutCoreSchema() throws Exception { + public final void schemaBuilderWithEntryWithoutCoreSchema() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -475,7 +460,7 @@ public final void testSchemaBuilderWithEntryWithoutCoreSchema() throws Exception * @throws Exception */ @Test - public final void testSchemaBuilderAttributeWithoutSpace() throws Exception { + public final void schemaBuilderAttributeWithoutSpace() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -513,7 +498,7 @@ public final void testSchemaBuilderAttributeWithoutSpace() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderAttributeExtensionWithoutSpace() throws Exception { + public final void schemaBuilderAttributeExtensionWithoutSpace() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -551,7 +536,7 @@ public final void testSchemaBuilderAttributeExtensionWithoutSpace() throws Excep * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddLdapSyntax() throws Exception { + public final void schemaBuilderWithEntryAddLdapSyntax() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -592,7 +577,7 @@ public final void testSchemaBuilderWithEntryAddLdapSyntax() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMalformedLdapSyntax() throws Exception { + public final void schemaBuilderWithEntryAddMalformedLdapSyntax() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -631,7 +616,7 @@ public final void testSchemaBuilderWithEntryAddMalformedLdapSyntax() throws Exce * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMatchingRuleUse() throws Exception { + public final void schemaBuilderWithEntryAddMatchingRuleUse() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -673,7 +658,7 @@ public final void testSchemaBuilderWithEntryAddMatchingRuleUse() throws Exceptio * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMalformedMatchingRuleUse() throws Exception { + public final void schemaBuilderWithEntryAddMalformedMatchingRuleUse() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -712,7 +697,7 @@ public final void testSchemaBuilderWithEntryAddMalformedMatchingRuleUse() throws * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMatchingRule() throws Exception { + public final void schemaBuilderWithEntryAddMatchingRule() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -755,7 +740,7 @@ public final void testSchemaBuilderWithEntryAddMatchingRule() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMalformedMatchingRule() throws Exception { + public final void schemaBuilderWithEntryAddMalformedMatchingRule() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -795,7 +780,7 @@ public final void testSchemaBuilderWithEntryAddMalformedMatchingRule() throws Ex * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddDITContentRule() throws Exception { + public final void schemaBuilderWithEntryAddDITContentRule() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -838,7 +823,7 @@ public final void testSchemaBuilderWithEntryAddDITContentRule() throws Exception * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMalformedDITContentRule() throws Exception { + public final void schemaBuilderWithEntryAddMalformedDITContentRule() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -878,7 +863,7 @@ public final void testSchemaBuilderWithEntryAddMalformedDITContentRule() throws * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddObjectClass() throws Exception { + public final void schemaBuilderWithEntryAddObjectClass() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -919,7 +904,7 @@ public final void testSchemaBuilderWithEntryAddObjectClass() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderWithEntryAddMalformedObjectClass() throws Exception { + public final void schemaBuilderWithEntryAddMalformedObjectClass() throws Exception { // @formatter:off final String[] strEntry = { "dn: cn=schema", @@ -960,7 +945,7 @@ public final void testSchemaBuilderWithEntryAddMalformedObjectClass() throws Exc * @throws Exception */ @Test - public final void testSchemaBuilderAddAttributeWithEntryContainingDescriptionWithCoreSchema() + public final void schemaBuilderAddAttributeWithEntryContainingDescriptionWithCoreSchema() throws Exception { // @formatter:off final String[] strEntry = { @@ -1015,9 +1000,8 @@ public final void testSchemaBuilderAddAttributeWithEntryContainingDescriptionWit * @throws Exception */ @Test - public final void testSchemaBuilderAddAttributeContainingDescriptionWithCoreSchema() + public final void schemaBuilderAddAttributeContainingDescriptionWithCoreSchema() throws Exception { - final SchemaBuilder scBuild = new SchemaBuilder(); // Adding the new schema containing the customclass scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" @@ -1050,8 +1034,7 @@ public final void testSchemaBuilderAddAttributeContainingDescriptionWithCoreSche * @throws Exception */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public final void testSchemaBuilderAddAttributeDoesntAllowWrongUsage() throws Exception { - + public final void schemaBuilderAddAttributeDoesntAllowWrongUsage() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); // Adding the new schema containing the customclass scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" @@ -1068,7 +1051,7 @@ public final void testSchemaBuilderAddAttributeDoesntAllowWrongUsage() throws Ex * @throws Exception */ @Test(expectedExceptions = NullPointerException.class) - public final void testSchemaBuilderAddAttributeTypeDoesntAllowNull() throws Exception { + public final void schemaBuilderAddAttributeTypeDoesntAllowNull() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); // Adding the new schema containing the customclass scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" @@ -1082,14 +1065,12 @@ public final void testSchemaBuilderAddAttributeTypeDoesntAllowNull() throws Exce * @throws Exception */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public final void testSchemaBuilderAddAttributeTypeDoesntAllowEmptyString() throws Exception { - + public final void schemaBuilderAddAttributeTypeDoesntAllowEmptyString() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); // Adding the new schema containing the customclass scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" + "' SUP top AUXILIARY MAY myCustomAttribute )", false); scBuild.addAttributeType(" ", false); - } /** @@ -1099,9 +1080,8 @@ public final void testSchemaBuilderAddAttributeTypeDoesntAllowEmptyString() thro * @throws Exception */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public final void testSchemaBuilderAddAttributeDoesntAllowLeftParenthesisMising() + public final void schemaBuilderAddAttributeDoesntAllowLeftParenthesisMising() throws Exception { - final SchemaBuilder scBuild = new SchemaBuilder(Schema.getDefaultSchema()); scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" + "' SUP top AUXILIARY MAY myCustomAttribute )", false); @@ -1119,9 +1099,8 @@ public final void testSchemaBuilderAddAttributeDoesntAllowLeftParenthesisMising( * @throws Exception */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public final void testSchemaBuilderAddAttributeDoesntAllowRightParenthesisMising() + public final void schemaBuilderAddAttributeDoesntAllowRightParenthesisMising() throws Exception { - final SchemaBuilder scBuild = new SchemaBuilder(Schema.getDefaultSchema()); scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" + "' SUP top AUXILIARY MAY myCustomAttribute )", false); @@ -1139,8 +1118,7 @@ public final void testSchemaBuilderAddAttributeDoesntAllowRightParenthesisMising * @throws Exception */ @Test - public final void testSchemaBuilderCompareAddAttributeTypesSucceed() throws Exception { - + public final void schemaBuilderCompareAddAttributeTypesSucceed() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getDefaultSchema()); scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" + "' SUP top AUXILIARY MAY myCustomAttribute )", false); @@ -1188,9 +1166,8 @@ public final void testSchemaBuilderCompareAddAttributeTypesSucceed() throws Exce * @throws Exception */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public final void testSchemaBuilderAddObjectClassDoesntAllowMalformedObjectClass() + public final void schemaBuilderAddObjectClassDoesntAllowMalformedObjectClass() throws Exception { - final SchemaBuilder scBuild = new SchemaBuilder(); // Left parenthesis is missing underneath scBuild.addObjectClass(" temporary-fake-oc-id NAME 'myCustomObjClass" @@ -1209,9 +1186,8 @@ public final void testSchemaBuilderAddObjectClassDoesntAllowMalformedObjectClass * @throws Exception */ @Test(expectedExceptions = LocalizedIllegalArgumentException.class) - public final void testSchemaBuilderAddObjectClassDoesntAllowMalformedObjectClassIllegalToken() + public final void schemaBuilderAddObjectClassDoesntAllowMalformedObjectClassIllegalToken() throws Exception { - final SchemaBuilder scBuild = new SchemaBuilder(); // Wrong object class definition (AUXI) scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" @@ -1223,11 +1199,9 @@ public final void testSchemaBuilderAddObjectClassDoesntAllowMalformedObjectClass false); } - /** - * Rewrite an existing object class. - */ + /** Rewrite an existing object class. */ @Test - public final void testSchemaBuilderAddObjectClass() throws Exception { + public final void schemaBuilderAddObjectClass() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(getDefaultSchema()); scBuild.buildObjectClass("2.5.6.14") .names("device") @@ -1252,9 +1226,8 @@ public final void testSchemaBuilderAddObjectClass() throws Exception { * @throws Exception */ @Test(expectedExceptions = ConflictingSchemaElementException.class) - public final void testSchemaBuilderDoesntAllowConflictingAttributesOverwriteFalse() + public final void schemaBuilderDoesntAllowConflictingAttributesOverwriteFalse() throws Exception { - final SchemaBuilder scBuild = new SchemaBuilder(); scBuild.addAttributeType( @@ -1271,7 +1244,7 @@ public final void testSchemaBuilderDoesntAllowConflictingAttributesOverwriteFals } @Test - public final void testSchemaBuilderWithAttributeUsageDifferentFromSuperior() { + public final void schemaBuilderWithAttributeUsageDifferentFromSuperior() { final SchemaBuilder scBuild = new SchemaBuilder(); // directoryOperation can't inherit from userApplications @@ -1293,7 +1266,7 @@ public final void testSchemaBuilderWithAttributeUsageDifferentFromSuperior() { * @throws Exception */ @Test - public final void testSchemaBuilderAllowsConflictingAttributesOverwriteTrue() throws Exception { + public final void schemaBuilderAllowsConflictingAttributesOverwriteTrue() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); //@formatter:off @@ -1332,7 +1305,7 @@ public final void testSchemaBuilderAllowsConflictingAttributesOverwriteTrue() th * @throws Exception */ @Test(expectedExceptions = ConflictingSchemaElementException.class) - public final void testSchemaBuilderDoesntAllowConflictingDITOverwriteFalse() throws Exception { + public final void schemaBuilderDoesntAllowConflictingDITOverwriteFalse() throws Exception { //@formatter:off new SchemaBuilder(Schema.getDefaultSchema()) .addObjectClass( @@ -1372,7 +1345,7 @@ public final void testSchemaBuilderDoesntAllowConflictingDITOverwriteFalse() thr * @throws Exception */ @Test - public final void testSchemaBuilderAllowsConflictingDITStructureRuleOverwriteTrue() + public final void schemaBuilderAllowsConflictingDITStructureRuleOverwriteTrue() throws Exception { // @formatter:off final Schema schema = @@ -1420,7 +1393,7 @@ public final void testSchemaBuilderAllowsConflictingDITStructureRuleOverwriteTru * @throws Exception */ @Test - public final void testSchemaBuilderAddDITContentRuleBuilder() throws Exception { + public final void schemaBuilderAddDITContentRuleBuilder() throws Exception { // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) @@ -1449,7 +1422,7 @@ public final void testSchemaBuilderAddDITContentRuleBuilder() throws Exception { * @throws Exception */ @Test(expectedExceptions = ConflictingSchemaElementException.class) - public final void testSchemaBuilderDoesntAllowConflictingDITContentRuleOverwriteFalse() + public final void schemaBuilderDoesntAllowConflictingDITContentRuleOverwriteFalse() throws Exception { // @formatter:off new SchemaBuilder(Schema.getDefaultSchema()) @@ -1480,7 +1453,7 @@ public final void testSchemaBuilderDoesntAllowConflictingDITContentRuleOverwrite * @throws Exception */ @Test - public final void testSchemaBuilderAllowsConflictingDITContentRuleOverwriteTrue() + public final void schemaBuilderAllowsConflictingDITContentRuleOverwriteTrue() throws Exception { // @formatter:off final Schema schema = new SchemaBuilder(Schema.getDefaultSchema()) @@ -1517,7 +1490,7 @@ public final void testSchemaBuilderAllowsConflictingDITContentRuleOverwriteTrue( * @throws Exception */ @Test(expectedExceptions = ConflictingSchemaElementException.class) - public final void testSchemaBuilderDoesntAllowConflictingMatchingRuleOverwriteFalse() + public final void schemaBuilderDoesntAllowConflictingMatchingRuleOverwriteFalse() throws Exception { // @formatter:off new SchemaBuilder(Schema.getDefaultSchema()) @@ -1537,7 +1510,7 @@ public final void testSchemaBuilderDoesntAllowConflictingMatchingRuleOverwriteFa * @throws Exception */ @Test - public final void testSchemaBuilderAllowsConflictingMatchingRuleOverwriteTrue() + public final void schemaBuilderAllowsConflictingMatchingRuleOverwriteTrue() throws Exception { // @formatter:off final Schema schema = @@ -1564,7 +1537,7 @@ public final void testSchemaBuilderAllowsConflictingMatchingRuleOverwriteTrue() * @throws Exception */ @Test(expectedExceptions = ConflictingSchemaElementException.class) - public final void testSchemaBuilderDoesntAllowConflictingMatchingRuleUseOverwriteFalse() + public final void schemaBuilderDoesntAllowConflictingMatchingRuleUseOverwriteFalse() throws Exception { // @formatter:off new SchemaBuilder(Schema.getDefaultSchema()) @@ -1583,7 +1556,7 @@ public final void testSchemaBuilderDoesntAllowConflictingMatchingRuleUseOverwrit * @throws Exception */ @Test - public final void testSchemaBuilderAllowsConflictingMatchingRuleUseOverwriteTrue() + public final void schemaBuilderAllowsConflictingMatchingRuleUseOverwriteTrue() throws Exception { // @formatter:off final Schema schema = @@ -1607,7 +1580,6 @@ public final void testSchemaBuilderAllowsConflictingMatchingRuleUseOverwriteTrue + " X-ORIGIN 'RFC 4512' )"); } assertThat(schema.getWarnings()).isEmpty(); - } /** @@ -1617,7 +1589,7 @@ public final void testSchemaBuilderAllowsConflictingMatchingRuleUseOverwriteTrue * @throws Exception */ @Test(expectedExceptions = ConflictingSchemaElementException.class) - public final void testSchemaBuilderDoesntAllowConflictingNameFormOverwriteFalse() + public final void schemaBuilderDoesntAllowConflictingNameFormOverwriteFalse() throws Exception { // @formatter:off new SchemaBuilder(Schema.getDefaultSchema()) @@ -1641,7 +1613,7 @@ public final void testSchemaBuilderDoesntAllowConflictingNameFormOverwriteFalse( * @throws Exception */ @Test - public final void testSchemaBuilderAllowsConflictingNameFormOverwriteTrue() throws Exception { + public final void schemaBuilderAllowsConflictingNameFormOverwriteTrue() throws Exception { // @formatter:off final Schema schema = new SchemaBuilder(Schema.getDefaultSchema()) @@ -1679,8 +1651,7 @@ public final void testSchemaBuilderAllowsConflictingNameFormOverwriteTrue() thro * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveAttributeType() throws Exception { - + public final void schemaBuilderRemoveAttributeType() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getDefaultSchema()); scBuild.addObjectClass("( temporary-fake-oc-id NAME 'myCustomObjClass" + "' SUP top AUXILIARY MAY myCustomAttribute )", false); @@ -1703,7 +1674,7 @@ public final void testSchemaBuilderRemoveAttributeType() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantAttributeType() throws Exception { + public final void schemaBuilderRemoveInexistantAttributeType() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeAttributeType("wrongName"); assertThat(isRemoved).isFalse(); @@ -1715,7 +1686,7 @@ public final void testSchemaBuilderRemoveInexistantAttributeType() throws Except * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantSyntax() throws Exception { + public final void schemaBuilderRemoveInexistantSyntax() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeSyntax("1.3.6.1.4.1.14aa"); assertThat(isRemoved).isFalse(); @@ -1727,8 +1698,7 @@ public final void testSchemaBuilderRemoveInexistantSyntax() throws Exception { * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveSyntax() throws Exception { - + public final void schemaBuilderRemoveSyntax() throws Exception { assertThat(Schema.getCoreSchema().getSyntax("1.3.6.1.4.1.1466.115.121.1.15")).isNotNull(); final SchemaBuilder scBuild = new SchemaBuilder(Schema.getDefaultSchema()); @@ -1744,7 +1714,7 @@ public final void testSchemaBuilderRemoveSyntax() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveDitContentRule() throws Exception { + public final void schemaBuilderRemoveDitContentRule() throws Exception { // @formatter:off final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); scBuild.addObjectClass("( 2.16.840.1.113730.3.2.2 NAME 'myCustomObjClass" @@ -1770,7 +1740,7 @@ public final void testSchemaBuilderRemoveDitContentRule() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantDitContentRule() throws Exception { + public final void schemaBuilderRemoveInexistantDitContentRule() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeDITContentRule("badDITContentRule"); assertThat(isRemoved).isFalse(); @@ -1782,8 +1752,7 @@ public final void testSchemaBuilderRemoveInexistantDitContentRule() throws Excep * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveDitStructureRule() throws Exception { - + public final void schemaBuilderRemoveDitStructureRule() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); scBuild.addObjectClass( "( testditstructureruleconstraintssupoc-oid " @@ -1819,7 +1788,7 @@ public final void testSchemaBuilderRemoveDitStructureRule() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantDitStructureRule() throws Exception { + public final void schemaBuilderRemoveInexistantDitStructureRule() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeDITStructureRule(999014); assertThat(isRemoved).isFalse(); @@ -1831,8 +1800,7 @@ public final void testSchemaBuilderRemoveInexistantDitStructureRule() throws Exc * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveMatchingRule() throws Exception { - + public final void schemaBuilderRemoveMatchingRule() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); scBuild.addMatchingRule( // Matching rules from RFC 2252 @@ -1852,7 +1820,7 @@ public final void testSchemaBuilderRemoveMatchingRule() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantMatchingRule() throws Exception { + public final void schemaBuilderRemoveInexistantMatchingRule() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeMatchingRule("bitStringMatchZ"); assertThat(isRemoved).isFalse(); @@ -1864,8 +1832,7 @@ public final void testSchemaBuilderRemoveInexistantMatchingRule() throws Excepti * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveMatchingRuleUSe() throws Exception { - + public final void schemaBuilderRemoveMatchingRuleUSe() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); scBuild.addMatchingRuleUse( "( 2.5.13.16 NAME 'bitStringMatch' APPLIES ( givenName $ surname ) )", false); @@ -1883,7 +1850,7 @@ public final void testSchemaBuilderRemoveMatchingRuleUSe() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantMatchingRuleUse() throws Exception { + public final void schemaBuilderRemoveInexistantMatchingRuleUse() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeMatchingRuleUse("bitStringMatchZ"); assertThat(isRemoved).isFalse(); @@ -1895,8 +1862,7 @@ public final void testSchemaBuilderRemoveInexistantMatchingRuleUse() throws Exce * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveNameForm() throws Exception { - + public final void schemaBuilderRemoveNameForm() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); scBuild.addNameForm("( testviolatessinglevaluednameform-oid " + "NAME 'testViolatesSingleValuedNameForm' " @@ -1915,7 +1881,7 @@ public final void testSchemaBuilderRemoveNameForm() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantNameForm() throws Exception { + public final void schemaBuilderRemoveInexistantNameForm() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeNameForm("bitStringMatchZ"); assertThat(isRemoved).isFalse(); @@ -1927,8 +1893,7 @@ public final void testSchemaBuilderRemoveInexistantNameForm() throws Exception { * @throws Exception */ @Test(expectedExceptions = UnknownSchemaElementException.class) - public final void testSchemaBuilderRemoveObjectClass() throws Exception { - + public final void schemaBuilderRemoveObjectClass() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(); scBuild.addObjectClass("( 2.5.6.6 NAME 'person' SUP top STRUCTURAL MUST ( sn $ cn )" + " MAY ( userPassword $ telephoneNumber $ seeAlso $ description )" @@ -1946,7 +1911,7 @@ public final void testSchemaBuilderRemoveObjectClass() throws Exception { * @throws Exception */ @Test - public final void testSchemaBuilderRemoveInexistantObjectClass() throws Exception { + public final void schemaBuilderRemoveInexistantObjectClass() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); boolean isRemoved = scBuild.removeObjectClass("bitStringMatchZ"); assertThat(isRemoved).isFalse(); @@ -1958,8 +1923,7 @@ public final void testSchemaBuilderRemoveInexistantObjectClass() throws Exceptio * @throws Exception */ @Test(expectedExceptions = NullPointerException.class) - public final void testSchemaBuilderAddSchemaForEntryDoesntAllowNull() throws Exception { - + public final void schemaBuilderAddSchemaForEntryDoesntAllowNull() throws Exception { final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); scBuild.addSchemaForEntry(null, null, false); } @@ -1973,7 +1937,7 @@ public final void testSchemaBuilderAddSchemaForEntryDoesntAllowNull() throws Exc * @throws Exception */ @Test(expectedExceptions = EntryNotFoundException.class) - public final void testSchemaBuilderAddSchemaForEntryDoesntContainSubschemaMockConnection() + public final void schemaBuilderAddSchemaForEntryDoesntContainSubschemaMockConnection() throws Exception { Connection connection = mock(Connection.class); final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); @@ -1996,7 +1960,6 @@ public final void testSchemaBuilderAddSchemaForEntryDoesntContainSubschemaMockCo scBuild.addSchemaForEntry(connection, DN.valueOf("uid=scarter,ou=People,dc=example,dc=com"), false); - } /** @@ -2005,7 +1968,7 @@ public final void testSchemaBuilderAddSchemaForEntryDoesntContainSubschemaMockCo * @throws Exception */ @Test - public final void testSchemaBuilderAddSchemaForEntryMockConnection() throws Exception { + public final void schemaBuilderAddSchemaForEntryMockConnection() throws Exception { Connection connection = mock(Connection.class); final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); @@ -2055,7 +2018,7 @@ public final void testSchemaBuilderAddSchemaForEntryMockConnection() throws Exce * @throws Exception */ @Test - public final void testSchemaBuilderAddSchemaForEntryAsyncMockConnection() throws Exception { + public final void schemaBuilderAddSchemaForEntryAsyncMockConnection() throws Exception { Connection connection = mock(Connection.class); final SchemaBuilder scBuild = new SchemaBuilder(Schema.getCoreSchema()); @@ -2098,7 +2061,7 @@ public final void testSchemaBuilderAddSchemaForEntryAsyncMockConnection() throws } @Test - public void testDefaultSyntax() { + public void defaultSyntax() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).toSchema().asNonStrictSchema(); assertThat(schema.getDefaultSyntax()).isEqualTo(CoreSchema.getOctetStringSyntax()); @@ -2107,7 +2070,7 @@ public void testDefaultSyntax() { } @Test - public void testOverrideDefaultSyntax() { + public void overrideDefaultSyntax() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .setOption(DEFAULT_SYNTAX_OID, getDirectoryStringSyntax().getOID()) @@ -2117,7 +2080,7 @@ public void testOverrideDefaultSyntax() { } @Test - public void testDefaultMatchingRule() { + public void defaultMatchingRule() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()).toSchema().asNonStrictSchema(); assertThat(schema.getDefaultMatchingRule()).isEqualTo( @@ -2127,7 +2090,7 @@ public void testDefaultMatchingRule() { } @Test - public void testOverrideMatchingRule() { + public void overrideMatchingRule() { final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .setOption(DEFAULT_MATCHING_RULE_OID, getCaseIgnoreMatchingRule().getOID()) @@ -2139,7 +2102,7 @@ public void testOverrideMatchingRule() { } @Test - public void testDefaultSyntaxDefinedInSchema() { + public void defaultSyntaxDefinedInSchema() { // The next line was triggering a NPE with OPENDJ-1252. final Schema schema = new SchemaBuilder().addSyntax("( 9.9.9 DESC 'Test Syntax' )", false).addSyntax( @@ -2151,7 +2114,7 @@ public void testDefaultSyntaxDefinedInSchema() { } @Test - public void testDefaultMatchingRuleDefinedInSchema() throws DecodeException { + public void defaultMatchingRuleDefinedInSchema() throws DecodeException { final Schema schema = new SchemaBuilder().addSyntax(CoreSchema.getOctetStringSyntax().toString(), false) .addMatchingRule( @@ -2166,4 +2129,212 @@ public void testDefaultMatchingRuleDefinedInSchema() throws DecodeException { .isEqualTo(ByteString.valueOfUtf8("test")); } + @Test + public void enumSyntaxAddThenRemove() { + final Schema coreSchema = Schema.getCoreSchema(); + final Schema schemaWithEnum = new SchemaBuilder(coreSchema) + .addSyntax("( 3.3.3 DESC 'Day Of The Week' " + + "X-ENUM ( 'monday' 'tuesday' 'wednesday' 'thursday' 'friday' 'saturday' 'sunday') )", + false) + .toSchema(); + + assertThat(schemaWithEnum.getWarnings()).isEmpty(); + assertThat(schemaWithEnum.getMatchingRules()) + .as("Expected an enum ordering matching rule to be added for the enum syntax") + .hasSize(coreSchema.getMatchingRules().size() + 1); + + final SchemaBuilder builder = new SchemaBuilder(schemaWithEnum); + assertThat(builder.removeSyntax("3.3.3")).isTrue(); + final Schema schemaNoEnum = builder.toSchema(); + + assertThat(schemaNoEnum.getWarnings()).isEmpty(); + assertThat(schemaNoEnum.getMatchingRules()) + .as("Expected the enum ordering matching rule to be removed at the same time as the enum syntax") + .hasSize(coreSchema.getMatchingRules().size()); + } + + @Test + public void attributeTypesUseNewlyBuiltSyntaxes() throws Exception { + final Schema coreSchema = Schema.getCoreSchema(); + final Schema schema = new SchemaBuilder(coreSchema) + .addAttributeType("( 1.2.3.4.5.7 NAME 'associateoid' " + + "EQUALITY 2.5.13.2 ORDERING 2.5.13.3 SUBSTR 2.5.13.4 " + + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 USAGE userApplications " + + "X-APPROX '1.3.6.1.4.1.26027.1.4.1' )", false) + .toSchema(); + + Syntax dnSyntax = schema.getAttributeType("distinguishedName").getSyntax(); + assertThat(dnSyntax).isSameAs(schema.getSyntax("1.3.6.1.4.1.1466.115.121.1.12")); + + LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder(); + boolean isValid = dnSyntax.valueIsAcceptable(ByteString.valueOfUtf8("associateoid=test"), invalidReason); + assertThat(isValid) + .as("Value should have been valid, but it is not: " + invalidReason.toString()) + .isTrue(); + } + + @DataProvider + private Object[][] schemasWithEnumerationSyntaxes() { + final Schema coreSchema = Schema.getCoreSchema(); + + final Schema usingAddEnumerationSyntax = new SchemaBuilder("usingAddEnumerationSyntax") + .addSchema(coreSchema, true) + .addEnumerationSyntax("3.3.3", "Primary colors", true, "red", "green", "blue") + .toSchema(); + + final Schema usingAddSyntaxString = new SchemaBuilder("usingAddSyntaxString") + .addSchema(coreSchema, true) + .addSyntax("( 3.3.3 DESC 'Primary colors' X-ENUM ( 'red' 'green' 'blue' ))", true) + .toSchema(); + + final Schema usingBuildSyntaxCopy = new SchemaBuilder("usingBuildSyntaxCopy") + .addSchema(coreSchema, true) + .buildSyntax(usingAddEnumerationSyntax.getSyntax("3.3.3")).addToSchema() + .toSchema(); + + final Schema usingBuildSyntaxIncremental = new SchemaBuilder("usingBuildSyntaxIncremental") + .addSchema(coreSchema, true) + .buildSyntax("3.3.3") + .description("Primary colors") + .extraProperties("X-ENUM", "red", "green", "blue") + .addToSchema() + .toSchema(); + + final Schema usingCopyOfSchema = new SchemaBuilder("usingCopyOfSchema") + .addSchema(usingAddEnumerationSyntax, true) + .toSchema(); + + return new Object[][] { + { usingAddEnumerationSyntax }, + { usingAddSyntaxString }, + { usingBuildSyntaxCopy }, + { usingBuildSyntaxIncremental }, + { usingCopyOfSchema } + }; + } + + @Test(dataProvider = "schemasWithEnumerationSyntaxes") + public void enumerationSyntaxesCanBeCreatedUsingDifferentApproaches(Schema schema) { + assertThat(schema.getWarnings()).isEmpty(); + assertThat(schema.getMatchingRules()) + .as("Expected an enum ordering matching rule to be added for the enum syntax") + .hasSize(Schema.getCoreSchema().getMatchingRules().size() + 1); + + LocalizableMessageBuilder msgBuilder = new LocalizableMessageBuilder(); + Syntax primaryColors = schema.getSyntax("3.3.3"); + assertThat(primaryColors.valueIsAcceptable(ByteString.valueOfUtf8("red"), msgBuilder)).isTrue(); + assertThat(primaryColors.valueIsAcceptable(ByteString.valueOfUtf8("yellow"), msgBuilder)).isFalse(); + + MatchingRule matchingRule = schema.getMatchingRule(OMR_OID_GENERIC_ENUM + "." + "3.3.3"); + assertThat(matchingRule).isNotNull(); + assertThat(matchingRule).isSameAs(primaryColors.getOrderingMatchingRule()); + } + + @DataProvider + private Object[][] schemasWithSubstitutionSyntaxes() { + final Schema coreSchema = Schema.getCoreSchema(); + + final Schema usingAddSubstitutionSyntax = new SchemaBuilder("usingAddSubstitutionSyntax") + .addSchema(coreSchema, true) + .addSubstitutionSyntax("3.3.3", "Long Integer", "1.3.6.1.4.1.1466.115.121.1.27", true) + .toSchema(); + + final Schema usingAddSyntaxString = new SchemaBuilder("usingAddSyntaxString") + .addSchema(coreSchema, true) + .addSyntax("( 3.3.3 DESC 'Long Integer' X-SUBST '1.3.6.1.4.1.1466.115.121.1.27' )", true) + .toSchema(); + + final Schema usingBuildSyntaxCopy = new SchemaBuilder("usingBuildSyntaxCopy") + .addSchema(coreSchema, true) + .buildSyntax(usingAddSubstitutionSyntax.getSyntax("3.3.3")).addToSchema() + .toSchema(); + + final Schema usingBuildSyntaxIncremental = new SchemaBuilder("usingBuildSyntaxIncremental") + .addSchema(coreSchema, true) + .buildSyntax("3.3.3") + .description("Long Integer") + .extraProperties("X-SUBST", "1.3.6.1.4.1.1466.115.121.1.27") + .addToSchema() + .toSchema(); + + final Schema usingCopyOfSchema = new SchemaBuilder("usingCopyOfSchema") + .addSchema(usingAddSubstitutionSyntax, true) + .toSchema(); + + return new Object[][] { + { usingAddSubstitutionSyntax }, + { usingAddSyntaxString }, + { usingBuildSyntaxCopy }, + { usingBuildSyntaxIncremental }, + { usingCopyOfSchema } + }; + } + + @Test(dataProvider = "schemasWithSubstitutionSyntaxes") + public void substitutionSyntaxesCanBeCreatedUsingDifferentApproaches(Schema schema) { + assertThat(schema.getWarnings()).isEmpty(); + + LocalizableMessageBuilder msgBuilder = new LocalizableMessageBuilder(); + Syntax longInteger = schema.getSyntax("3.3.3"); + assertThat(longInteger.valueIsAcceptable(ByteString.valueOfUtf8("12345"), msgBuilder)).isTrue(); + assertThat(longInteger.valueIsAcceptable(ByteString.valueOfUtf8("NaN"), msgBuilder)).isFalse(); + + MatchingRule matchingRule = schema.getMatchingRule("integerOrderingMatch"); + assertThat(matchingRule).isNotNull(); + assertThat(matchingRule).isSameAs(longInteger.getOrderingMatchingRule()); + } + + @DataProvider + private Object[][] schemasWithPatternSyntaxes() { + final Schema coreSchema = Schema.getCoreSchema(); + + final Schema usingAddPatternSyntax = new SchemaBuilder("usingAddSubstitutionSyntax") + .addSchema(coreSchema, true) + .addPatternSyntax("3.3.3", "Host and Port", Pattern.compile("[^:]+:\\d+"), true) + .toSchema(); + + final Schema usingAddSyntaxString = new SchemaBuilder("usingAddSyntaxString") + .addSchema(coreSchema, true) + .addSyntax("( 3.3.3 DESC 'Host and Port' X-PATTERN '[^:]+:\\d+' )", true) + .toSchema(); + + final Schema usingBuildSyntaxCopy = new SchemaBuilder("usingBuildSyntaxCopy") + .addSchema(coreSchema, true) + .buildSyntax(usingAddPatternSyntax.getSyntax("3.3.3")).addToSchema() + .toSchema(); + + final Schema usingBuildSyntaxIncremental = new SchemaBuilder("usingBuildSyntaxIncremental") + .addSchema(coreSchema, true) + .buildSyntax("3.3.3") + .description("Host and Port") + .extraProperties("X-PATTERN", "[^:]+:\\d+") + .addToSchema() + .toSchema(); + + final Schema usingCopyOfSchema = new SchemaBuilder("usingCopyOfSchema") + .addSchema(usingAddPatternSyntax, true) + .toSchema(); + + return new Object[][] { + { usingAddPatternSyntax }, + { usingAddSyntaxString }, + { usingBuildSyntaxCopy }, + { usingBuildSyntaxIncremental }, + { usingCopyOfSchema } + }; + } + + @Test(dataProvider = "schemasWithPatternSyntaxes") + public void patternSyntaxesCanBeCreatedUsingDifferentApproaches(Schema schema) { + assertThat(schema.getWarnings()).isEmpty(); + + LocalizableMessageBuilder msgBuilder = new LocalizableMessageBuilder(); + Syntax longInteger = schema.getSyntax("3.3.3"); + assertThat(longInteger.valueIsAcceptable(ByteString.valueOfUtf8("localhost:389"), msgBuilder)).isTrue(); + assertThat(longInteger.valueIsAcceptable(ByteString.valueOfUtf8("bad"), msgBuilder)).isFalse(); + + MatchingRule matchingRule = schema.getMatchingRule("caseIgnoreOrderingMatch"); + assertThat(matchingRule).isNotNull(); + assertThat(matchingRule).isSameAs(longInteger.getOrderingMatchingRule()); + } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java similarity index 93% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java index b86b813ba..5ab1e6c1d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaCompatTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011 ForgeRock AS. + * Copyright 2011 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaOptionsTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaOptionsTestCase.java similarity index 72% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaOptionsTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaOptionsTestCase.java index 87b9e95c0..b36e7afe0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaOptionsTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaOptionsTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java similarity index 68% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java index 56a9e1471..5a399469a 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,9 +28,7 @@ import static org.mockito.Matchers.*; import static org.mockito.Mockito.*; -/** - * Tests the Schema class. - */ +/** Tests the Schema class. */ @SuppressWarnings("javadoc") public class SchemaTestCase extends AbstractSchemaTestCase { @Test(description = "Unit test for OPENDJ-1477") @@ -107,4 +95,20 @@ public final void testReadSchemaAsyncMethodsMockConnection() throws Exception { connection.close(); } + @Test + public void getAttributeTypeWithDifferentNamesReturnSame() throws Exception { + Schema schema = CoreSchema.getInstance(); + AttributeType cnAttrType = schema.getAttributeType("cn"); + assertThat(cnAttrType).isSameAs(schema.getAttributeType("commonname")); + assertThat(cnAttrType).isSameAs(schema.getAttributeType("commonName")); + assertThat(cnAttrType).isSameAs(schema.getAttributeType("CN")); + } + + @Test + public void getAttributeTypeWithDifferentPlaceholderNames() throws Exception { + Schema schema = CoreSchema.getInstance().asNonStrictSchema(); + AttributeType placeHolderAttrType = schema.getAttributeType("placeholder"); + assertThat(placeHolderAttrType).isEqualTo(schema.getAttributeType("PLACEHOLDER")); + assertThat(placeHolderAttrType).isNotEqualTo(schema.getAttributeType("another_placeholder")); + } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java similarity index 92% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java index 109ea67f8..217222beb 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SchemaUtilsTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java similarity index 78% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java index 8d166f7fc..7a5bf7b9f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstitutionSyntaxTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -32,12 +22,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Substitution syntax tests. - */ +/** Substitution syntax tests. */ @SuppressWarnings("javadoc") public class SubstitutionSyntaxTestCase extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -105,7 +92,6 @@ public void testUndefinedSubstitute2() { Assert.assertFalse(builder.toSchema().getWarnings().isEmpty()); } - /** {@inheritDoc} */ @Override protected Syntax getRule() { // Use IA5String syntax as our substitute. diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java similarity index 89% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java index 376da7eb5..cee7db719 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SubstringMatchingRuleTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions Copyright 2015 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java similarity index 66% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java index 54fee40f3..f402050d1 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/SyntaxTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2014-2016 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.ldap.schema; @@ -40,34 +30,32 @@ public class SyntaxTestCase extends AbstractSchemaTestCase { @Test - public final void testCreatesANewSyntax() { + public final void testBuilderCreatesCustomSyntax() { // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new DirectoryStringSyntaxImpl()) - .addToSchema() + .description("Security Label") + .extraProperties("X-TEST", "1", "2", "3") + .implementation(new DirectoryStringSyntaxImpl()) + .addToSchema() .toSchema(); // @formatter:on assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); assertThat(syntax.getDescription()).isEqualTo("Security Label"); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); + assertThat(syntax.getExtraProperties().get("X-TEST")).hasSize(3); assertThat(syntax.getApproximateMatchingRule().getNameOrOID()).isEqualTo("ds-mr-double-metaphone-approx"); assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreMatch"); assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreOrderingMatch"); assertThat(syntax.getSubstringMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreSubstringsMatch"); - assertThat(syntax.toString()).isEqualTo( - "( 1.9.1.2.3 DESC 'Security Label' X-ENUM ( 'top-secret' 'secret' 'confidential' ) )"); + assertThat(syntax.toString()).isEqualTo("( 1.9.1.2.3 DESC 'Security Label' X-TEST ( '1' '2' '3' ) )"); assertThat(syntax.isHumanReadable()).isTrue(); assertThat(syntax.isBEREncodingRequired()).isFalse(); } /** - * Tests that unrecognized syntaxes are automatically substituted with the - * default syntax during building. + * Tests that unrecognized syntaxes are automatically substituted with the default syntax during building. */ @Test public final void testBuilderSubstitutesUnknownSyntaxWithDefaultSyntax() { @@ -80,14 +68,12 @@ public final void testBuilderSubstitutesUnknownSyntaxWithDefaultSyntax() { assertThat(syntax.getDescription()).isEmpty(); assertThat(syntax.getApproximateMatchingRule()).isNull(); assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo( - "octetStringOrderingMatch"); + assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); assertThat(syntax.getSubstringMatchingRule()).isNull(); } /** - * Tests that unrecognized syntaxes are automatically substituted with the - * default syntax and matching rule. + * Tests that unrecognized syntaxes are automatically substituted with the default syntax and matching rule. */ @Test public final void testDefaultSyntaxSubstitution() { @@ -95,12 +81,10 @@ public final void testDefaultSyntaxSubstitution() { assertThat(syntax).isNotNull(); assertThat(syntax.getDescription()).isEmpty(); // Dynamically created syntaxes include the X-SUBST extension. - assertThat(syntax.getExtraProperties().get("X-SUBST").get(0)).isEqualTo( - "1.3.6.1.4.1.1466.115.121.1.40"); + assertThat(syntax.getExtraProperties().get("X-SUBST").get(0)).isEqualTo("1.3.6.1.4.1.1466.115.121.1.40"); assertThat(syntax.getApproximateMatchingRule()).isNull(); assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo( - "octetStringOrderingMatch"); + assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); assertThat(syntax.getSubstringMatchingRule()).isNull(); } @@ -109,14 +93,7 @@ public final void testDefaultSyntaxSubstitution() { */ @Test(expectedExceptions = IllegalArgumentException.class) public final void testBuilderDoesNotAllowEmptyOid() { - // @formatter:off - new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new DirectoryStringSyntaxImpl()) - .addToSchema(); - // @formatter:on + new SchemaBuilder(Schema.getCoreSchema()).buildSyntax("").addToSchema(); } /** @@ -124,14 +101,7 @@ public final void testBuilderDoesNotAllowEmptyOid() { */ @Test(expectedExceptions = IllegalArgumentException.class) public final void testBuilderDoesNotAllowNullOid() { - // @formatter:off - new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax((String) null) - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new DirectoryStringSyntaxImpl()) - .addToSchema(); - // @formatter:on + new SchemaBuilder(Schema.getCoreSchema()).buildSyntax((String) null).addToSchema(); } /** @@ -139,28 +109,19 @@ public final void testBuilderDoesNotAllowNullOid() { */ @Test public final void testBuilderAllowsNullSyntax() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(null) - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3").implementation(null).addToSchema() + .toSchema(); assertThat(schema.getWarnings()).isNotEmpty(); assertThat(schema.getWarnings().toString()).contains("It will be substituted by the default syntax"); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); - assertThat(syntax.toString()).isEqualTo( - "( 1.9.1.2.3 DESC 'Security Label' X-ENUM ( 'top-secret' 'secret' 'confidential' ) )"); + assertThat(syntax.toString()).isEqualTo("( 1.9.1.2.3 )"); } /** @@ -168,27 +129,19 @@ public final void testBuilderAllowsNullSyntax() { */ @Test public final void testBuilderAllowsNoSyntax() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3").addToSchema() + .toSchema(); assertThat(schema.getWarnings()).isNotEmpty(); assertThat(schema.getWarnings().toString()).contains("It will be substituted by the default syntax"); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); - assertThat(syntax.toString()).isEqualTo( - "( 1.9.1.2.3 DESC 'Security Label' X-ENUM ( 'top-secret' 'secret' 'confidential' ) )"); + assertThat(syntax.toString()).isEqualTo("( 1.9.1.2.3 )"); } /** @@ -197,28 +150,20 @@ public final void testBuilderAllowsNoSyntax() { */ @Test public final void testBuilderAllowsNoSyntaxCaseWhereDefaultSyntaxIsChanged() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .setOption(DEFAULT_SYNTAX_OID, "1.3.6.1.4.1.1466.115.121.1.15") - .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .addToSchema() - .toSchema(); - // @formatter:on + .setOption(DEFAULT_SYNTAX_OID, "1.3.6.1.4.1.1466.115.121.1.15") + .buildSyntax("1.9.1.2.3").addToSchema() + .toSchema(); assertThat(schema.getWarnings()).isNotEmpty(); assertThat(schema.getWarnings().toString()).contains("It will be substituted by the default syntax"); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); assertThat(syntax.getApproximateMatchingRule().getNameOrOID()).isEqualTo("ds-mr-double-metaphone-approx"); assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreMatch"); assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreOrderingMatch"); assertThat(syntax.getSubstringMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreSubstringsMatch"); - assertThat(syntax.toString()).isEqualTo( - "( 1.9.1.2.3 DESC 'Security Label' X-ENUM ( 'top-secret' 'secret' 'confidential' ) )"); + assertThat(syntax.toString()).isEqualTo("( 1.9.1.2.3 )"); } /** @@ -226,24 +171,13 @@ public final void testBuilderAllowsNoSyntaxCaseWhereDefaultSyntaxIsChanged() { */ @Test public final void testBuilderAllowsNoDescription() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new OctetStringSyntaxImpl()) - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3").addToSchema() + .toSchema(); - assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); assertThat(syntax.getDescription()).isEqualTo(""); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); - assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); - assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); - assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); } /** @@ -251,25 +185,13 @@ public final void testBuilderAllowsNoDescription() { */ @Test public final void testBuilderAllowsNullDescription() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description(null) - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new OctetStringSyntaxImpl()) - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3").description(null).addToSchema() + .toSchema(); - assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); assertThat(syntax.getDescription()).isEqualTo(""); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); - assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); - assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); - assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); } /** @@ -277,25 +199,13 @@ public final void testBuilderAllowsNullDescription() { */ @Test public final void testBuilderAllowsEmptyDescription() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description("") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new OctetStringSyntaxImpl()) - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3").description("").addToSchema() + .toSchema(); - assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); assertThat(syntax.getDescription()).isEqualTo(""); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); - assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); - assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); - assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); } /** @@ -303,24 +213,13 @@ public final void testBuilderAllowsEmptyDescription() { */ @Test public final void testBuilderAllowsNoExtraProperties() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description("Security Label") - .implementation(new OctetStringSyntaxImpl()) - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3").addToSchema() + .toSchema(); - assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); assertThat(syntax.getExtraProperties().isEmpty()).isTrue(); - assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); - assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); - assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); } /** @@ -328,15 +227,7 @@ public final void testBuilderAllowsNoExtraProperties() { */ @Test(expectedExceptions = NullPointerException.class) public final void testBuilderDoesNotAllowNullExtraProperties() { - // @formatter:off - new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties(null) - .implementation(new OctetStringSyntaxImpl()) - .addToSchema() - .toSchema(); - // @formatter:on + new SchemaBuilder(Schema.getCoreSchema()).buildSyntax("1.9.1.2.3").extraProperties(null); } /** @@ -344,26 +235,14 @@ public final void testBuilderDoesNotAllowNullExtraProperties() { */ @Test public final void testBuilderRemoveExtraProperties() { - // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) - .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new OctetStringSyntaxImpl()) - .removeAllExtraProperties() - .addToSchema() - .toSchema(); - // @formatter:on + .buildSyntax("1.9.1.2.3") + .extraProperties("X-ENUM", "1", "2", "3").removeAllExtraProperties().addToSchema() + .toSchema(); - assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); assertThat(syntax.getExtraProperties().isEmpty()).isTrue(); - assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); - assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); - assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); } /** @@ -374,29 +253,20 @@ public final void testBuilderRemoveSpecifiedExtraProperties() { // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .buildSyntax("1.9.1.2.3") - .description("Security Label") .extraProperties("X-ENUM", "top-secret", "secret", "confidential") .extraProperties("X-ORIGIN", "Sam Carter") - .implementation(new OctetStringSyntaxImpl()) .removeExtraProperty("X-ENUM", "top-secret") .addToSchema() .toSchema(); // @formatter:on - assertThat(schema.getWarnings()).isEmpty(); final Syntax syntax = schema.getSyntax("1.9.1.2.3"); assertThat(syntax).isNotNull(); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); assertThat(syntax.getExtraProperties().isEmpty()).isFalse(); assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(2); assertThat(syntax.getExtraProperties().get("X-ORIGIN").size()).isEqualTo(1); - assertThat(syntax.getApproximateMatchingRule()).isEqualTo(null); - assertThat(syntax.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); - assertThat(syntax.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); - assertThat(syntax.getSubstringMatchingRule()).isEqualTo(null); } - /** * Sets a syntax using a string definition. */ @@ -480,41 +350,20 @@ public final void testAddingUnknownSyntaxDefinitionString() { */ @Test public final void testBuilderDuplicatesExistingSyntax() { - final SchemaBuilder sb = new SchemaBuilder(); - sb.addSchema(Schema.getCoreSchema(), false); + final Schema schema1 = new SchemaBuilder(Schema.getCoreSchema()) + .buildSyntax("1.2.3.4.5.6").description("v1").addToSchema() + .toSchema(); - // @formatter:off - final Syntax.Builder syntaxBuilder = new Syntax.Builder("1.9.1.2.3", sb); - syntaxBuilder.description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new DirectoryStringSyntaxImpl()) - .addToSchema(); - // @formatter:on + final Syntax syntax1 = schema1.getSyntax("1.2.3.4.5.6"); + assertThat(syntax1.getDescription()).isEqualTo("v1"); - Schema schema = sb.toSchema(); - assertThat(schema.getWarnings()).isEmpty(); - final Syntax syntax = schema.getSyntax("1.9.1.2.3"); - assertThat(syntax.getDescription()).isEqualTo("Security Label"); - assertThat(syntax.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); - - // @formatter:off - sb.buildSyntax(syntax) - .description("Security Label II") - .extraProperties("X-ENUM", "private") - .addToSchemaOverwrite(); - // @formatter:on + final Schema schema2 = new SchemaBuilder(Schema.getCoreSchema()) + .buildSyntax(syntax1).description("v2").addToSchema() + .toSchema(); - schema = sb.toSchema(); - assertThat(schema.getWarnings()).isEmpty(); - final Syntax dolly = schema.getSyntax("1.9.1.2.3"); - assertThat(dolly.getDescription()).isEqualTo("Security Label II"); - assertThat(dolly.getExtraProperties().get("X-ENUM").size()).isEqualTo(4); - assertThat(dolly.getApproximateMatchingRule().getNameOrOID()).isEqualTo("ds-mr-double-metaphone-approx"); - assertThat(dolly.getEqualityMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreMatch"); - assertThat(dolly.getOrderingMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreOrderingMatch"); - assertThat(dolly.getSubstringMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreSubstringsMatch"); - assertThat(dolly.toString()).isEqualTo( - "( 1.9.1.2.3 DESC 'Security Label II' X-ENUM ( 'top-secret' 'secret' 'confidential' 'private' ) )"); + final Syntax syntax2 = schema2.getSyntax("1.2.3.4.5.6"); + assertThat(syntax2.getDescription()).isEqualTo("v2"); + assertThat(syntax2.toString()).isEqualTo("( 1.2.3.4.5.6 DESC 'v2' )"); } /** @@ -683,24 +532,24 @@ public final void testBuilderCreatesSyntaxesUsingChainingMethods() { // @formatter:off final Schema schema = new SchemaBuilder(Schema.getCoreSchema()) .buildSyntax("1.9.1.2.3") - .description("Security Label") - .extraProperties("X-ENUM", "top-secret", "secret", "confidential") - .implementation(new DirectoryStringSyntaxImpl()) - .addToSchema() + .description("Security Label") + .extraProperties("X-TEST", "1", "2", "3") + .implementation(new DirectoryStringSyntaxImpl()) + .addToSchema() .buildSyntax("1.9.1.2.4") - .description("Security Label II") - .extraProperties("X-ENUM", "private") - .addToSchema() + .description("Security Label II") + .extraProperties("X-TEST", "private") + .addToSchema() .buildSyntax("non-implemented-syntax-oid") - .description("Not Implemented in OpenDJ") - .extraProperties("X-SUBST", "1.3.6.1.4.1.1466.115.121.1.15") - .implementation(null) - .addToSchema() + .description("Not Implemented in OpenDJ") + .extraProperties("X-SUBST", "1.3.6.1.4.1.1466.115.121.1.15") + .implementation(null) + .addToSchema() .buildSyntax("1.3.6.1.4.1.4203.1.1.2") - .description("Authentication Password Syntax") - .extraProperties("X-ORIGIN", "RFC 4512") - .implementation(new OctetStringSyntaxImpl()) - .addToSchemaOverwrite() + .description("Authentication Password Syntax") + .extraProperties("X-ORIGIN", "RFC 4512") + .implementation(new OctetStringSyntaxImpl()) + .addToSchemaOverwrite() .toSchema(); // @formatter:on @@ -716,12 +565,12 @@ public final void testBuilderCreatesSyntaxesUsingChainingMethods() { assertThat(s1.getEqualityMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreMatch"); assertThat(s1.getOrderingMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreOrderingMatch"); assertThat(s1.getSubstringMatchingRule().getNameOrOID()).isEqualTo("caseIgnoreSubstringsMatch"); - assertThat(s1.getExtraProperties().get("X-ENUM").size()).isEqualTo(3); + assertThat(s1.getExtraProperties().get("X-TEST")).hasSize(3); // Second final Syntax s2 = schema.getSyntax("1.9.1.2.4"); assertThat(s2.getDescription()).isEqualTo("Security Label II"); - assertThat(s2.getExtraProperties().get("X-ENUM").size()).isEqualTo(1); + assertThat(s2.getExtraProperties().get("X-TEST")).hasSize(1); assertThat(s2.getApproximateMatchingRule()).isEqualTo(null); assertThat(s2.getEqualityMatchingRule().getNameOrOID()).isEqualTo("octetStringMatch"); assertThat(s2.getOrderingMatchingRule().getNameOrOID()).isEqualTo("octetStringOrderingMatch"); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxTest.java similarity index 53% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxTest.java index 7054fa075..0da8a74fd 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/TelephoneNumberSyntaxTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2015 ForgeRock AS. + * Copyright 2015-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -32,13 +22,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Telephone number syntax tests. - */ +/** Telephone number syntax tests. */ @Test public class TelephoneNumberSyntaxTest extends AbstractSyntaxTestCase { - - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -53,12 +39,10 @@ public Object[][] createAcceptableValues() { { "", false } }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { SchemaBuilder builder = new SchemaBuilder(getCoreSchema()).setOption(ALLOW_NON_STANDARD_TELEPHONE_NUMBERS, false); return builder.toSchema().getSyntax(SYNTAX_TELEPHONE_OID); } - } diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java new file mode 100644 index 000000000..9bb0495b1 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/TelexSyntaxTest.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.SYNTAX_TELEX_OID; + +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +/** Telex syntax tests. */ +@Test +public class TelexSyntaxTest extends AbstractSyntaxTestCase { + @Override + @DataProvider(name = "acceptableValues") + public Object[][] createAcceptableValues() { + return new Object[][] { + { "123$france$456", true }, + { "abcdefghijk$lmnopqr$stuvwxyz", true }, + { "12345$67890$()+,-./:? ", true }, }; + } + + @Override + protected Syntax getRule() { + return Schema.getCoreSchema().getSyntax(SYNTAX_TELEX_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java similarity index 86% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java index aac77d57a..d2da45ca7 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UTCTimeSyntaxTest.java @@ -1,29 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2012-2014 ForgeRock AS + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -38,9 +27,7 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * UTC time syntax tests. - */ +/** UTC time syntax tests. */ public class UTCTimeSyntaxTest extends AbstractSyntaxTestCase { @Override @DataProvider(name = "acceptableValues") @@ -178,7 +165,6 @@ public void testCreate00to49() throws Exception { } } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_UTC_TIME_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java similarity index 58% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java index b54cc0f69..d36d388d0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the UUIDEqualityMatchingRule. - */ +/** Test the UUIDEqualityMatchingRule. */ public class UUIDEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -47,7 +33,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -61,10 +46,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_UUID_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java similarity index 57% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java index 12e7a832c..3ccf5907d 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDOrderingMatchingRuleTest.java @@ -1,27 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. + * Copyright 2009 Sun Microsystems, Inc. + * Portions Copyright 2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -29,12 +20,8 @@ import org.testng.annotations.DataProvider; -/** - * Test the UUIDOrderingMatchingRule. - */ +/** Test the UUIDOrderingMatchingRule. */ public class UUIDOrderingMatchingRuleTest extends OrderingMatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "OrderingMatchingRuleInvalidValues") public Object[][] createOrderingMatchingRuleInvalidValues() { @@ -46,7 +33,6 @@ public Object[][] createOrderingMatchingRuleInvalidValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "Orderingmatchingrules") public Object[][] createOrderingMatchingRuleTestData() { @@ -58,7 +44,6 @@ public Object[][] createOrderingMatchingRuleTestData() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(OMR_UUID_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java similarity index 56% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java index fe8e47626..8d2aa2713 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UUIDSyntaxTest.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009 Sun Microsystems, Inc. - * Portions copyright 2014 ForgeRock AS. + * Copyright 2009 Sun Microsystems, Inc. + * Portions copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,12 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * UUID syntax tests. - */ +/** UUID syntax tests. */ @Test public class UUIDSyntaxTest extends AbstractSyntaxTestCase { - /** {@inheritDoc} */ @Override @DataProvider(name = "acceptableValues") public Object[][] createAcceptableValues() { @@ -54,7 +41,6 @@ public Object[][] createAcceptableValues() { { "12345678-9abc-def0-1234-1234567890a", false }, }; } - /** {@inheritDoc} */ @Override protected Syntax getRule() { return Schema.getCoreSchema().getSyntax(SYNTAX_UUID_OID); diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java similarity index 58% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java index 4b376158c..6c26461db 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UniqueMemberEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -31,13 +21,9 @@ import org.testng.annotations.DataProvider; import org.testng.annotations.Test; -/** - * Test the UniqueMemberEqualityMatchingRule. - */ +/** Test the UniqueMemberEqualityMatchingRule. */ @Test public class UniqueMemberEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -46,7 +32,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -61,10 +46,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_UNIQUE_MEMBER_OID); } - } diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java new file mode 100644 index 000000000..b0f9a0569 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/UserPasswordExactEqualityMatchingRuleTest.java @@ -0,0 +1,44 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2014-2016 ForgeRock AS. + */ +package org.forgerock.opendj.ldap.schema; + +import static org.forgerock.opendj.ldap.schema.SchemaConstants.EMR_USER_PASSWORD_EXACT_OID; + +import org.testng.annotations.DataProvider; + +/** Test the UserPasswordExactEqualityMatchingRule. */ +public class UserPasswordExactEqualityMatchingRuleTest extends MatchingRuleTest { + @Override + @DataProvider(name = "matchingRuleInvalidAttributeValues") + public Object[][] createMatchingRuleInvalidAttributeValues() { + return new Object[][] { + + }; + } + + @Override + @DataProvider(name = "matchingrules") + public Object[][] createMatchingRuleTest() { + return new Object[][] { + + }; + } + + @Override + protected MatchingRule getRule() { + return Schema.getCoreSchema().getMatchingRule(EMR_USER_PASSWORD_EXACT_OID); + } +} diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java similarity index 61% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java index 9e67dcd6a..98540f5c0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/schema/WordEqualityMatchingRuleTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2014 ForgeRock AS + * Copyright 2014-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.schema; @@ -30,12 +20,8 @@ import org.forgerock.opendj.ldap.ConditionResult; import org.testng.annotations.DataProvider; -/** - * Test the WordEqualityMatchingRule. - */ +/** Test the WordEqualityMatchingRule. */ public class WordEqualityMatchingRuleTest extends MatchingRuleTest { - - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingRuleInvalidAttributeValues") public Object[][] createMatchingRuleInvalidAttributeValues() { @@ -44,7 +30,6 @@ public Object[][] createMatchingRuleInvalidAttributeValues() { }; } - /** {@inheritDoc} */ @Override @DataProvider(name = "matchingrules") public Object[][] createMatchingRuleTest() { @@ -65,10 +50,8 @@ public Object[][] createMatchingRuleTest() { }; } - /** {@inheritDoc} */ @Override protected MatchingRule getRule() { return Schema.getCoreSchema().getMatchingRule(EMR_WORD_OID); } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java similarity index 59% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java index ed038ae51..9de0e0c5e 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPConnectionFactory.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPListener.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPListener.java similarity index 67% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPListener.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPListener.java index 6281bc1af..5c0c305fe 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPListener.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicLDAPListener.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicTransportProvider.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicTransportProvider.java similarity index 58% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicTransportProvider.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicTransportProvider.java index 223d31252..1e5518dd7 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicTransportProvider.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/BasicTransportProvider.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; @@ -59,10 +49,8 @@ public LDAPListenerImpl getLDAPListener( return new BasicLDAPListener(address, factory, options); } - /** {@inheritDoc} */ @Override public String getName() { return "Basic"; } - } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java similarity index 92% rename from opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java index 52e76a225..fcff907b0 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/ConnectionStateTest.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2014 ForgeRock AS. + * Copyright 2013-2016 ForgeRock AS. */ package org.forgerock.opendj.ldap.spi; @@ -260,6 +250,7 @@ public void testReentrantClose() { final ConnectionState state = new ConnectionState(); final ConnectionEventListener listener1 = mock(ConnectionEventListener.class); doAnswer(new Answer() { + @Override public Void answer(InvocationOnMock invocation) { state.notifyConnectionClosed(); return null; diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/LDAPTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/LDAPTestCase.java new file mode 100644 index 000000000..6e5f8194b --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldap/spi/LDAPTestCase.java @@ -0,0 +1,30 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ + +package org.forgerock.opendj.ldap.spi; + +import org.forgerock.testng.ForgeRockTestCase; +import org.testng.annotations.Test; + +/** + * An abstract class that all ldap unit tests should extend. Ldap represents the + * classes found directly under the package com.forgerock.opendj.ldap.ldap. + */ + +@Test(groups = { "precommit", "ldap", "sdk" }) +public abstract class LDAPTestCase extends ForgeRockTestCase { +} diff --git a/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/AbstractLDIFTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/AbstractLDIFTestCase.java new file mode 100644 index 000000000..6bd4903b8 --- /dev/null +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/AbstractLDIFTestCase.java @@ -0,0 +1,33 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012 ForgeRock AS. + */ +package org.forgerock.opendj.ldif; + +import org.forgerock.opendj.ldap.SdkTestCase; +import org.testng.annotations.Test; + +/** + * An abstract class that all LDIF unit tests should extend. LDIF represents the + * classes found directly under the package org.forgerock.opendj.ldif. + */ + +@Test(groups = { "precommit", "types", "sdk" }) +public abstract class AbstractLDIFTestCase extends SdkTestCase { +} + + + + diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java similarity index 74% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java index 914111cda..0dc42a54f 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionChangeRecordWriterTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -88,14 +78,9 @@ public final String[] getStandardLDIFChangeRecord() { @Test public final void testWriteChangeRecordAddRequest() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord(Requests.newAddRequest(getStandardLDIFChangeRecord())); verify(connection, times(1)).add(any(AddRequest.class)); - } finally { - writer.close(); } } @@ -107,12 +92,8 @@ public final void testWriteChangeRecordAddRequest() throws Exception { @Test(expectedExceptions = NullPointerException.class) public final void testWriteChangeRecordAddRequestDoesntAllowNull() throws Exception { final Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord((AddRequest) null); - } finally { - writer.close(); } } @@ -125,15 +106,10 @@ public final void testWriteChangeRecordAddRequestDoesntAllowNull() throws Except @Test public final void testWriteChangeRecordContainingAddRequest() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord(Requests.newChangeRecord(getStandardLDIFChangeRecord())); Assert.assertTrue(Requests.newChangeRecord(getStandardLDIFChangeRecord()) instanceof AddRequest); verify(connection, times(1)).add(any(AddRequest.class)); - } finally { - writer.close(); } } @@ -146,10 +122,7 @@ public final void testWriteChangeRecordContainingAddRequest() throws Exception { @Test public final void testWriteChangeRecordContainingDeleteRequest() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { // @formatter:off ChangeRecord cr = Requests.newChangeRecord( "dn: dc=example,dc=com", @@ -159,8 +132,6 @@ public final void testWriteChangeRecordContainingDeleteRequest() throws Exceptio // @formatter:on Assert.assertTrue(cr instanceof DeleteRequest); verify(connection, times(1)).delete(any(DeleteRequest.class)); - } finally { - writer.close(); } } @@ -172,10 +143,7 @@ public final void testWriteChangeRecordContainingDeleteRequest() throws Exceptio @Test(expectedExceptions = LocalizedIllegalArgumentException.class) public final void testWriteChangeRecordDoesntAllowMultipleLDIF() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { // @formatter:off writer.writeChangeRecord(Requests.newChangeRecord( "dn: uid=scarter,ou=People,dc=example,dc=com", @@ -189,9 +157,6 @@ public final void testWriteChangeRecordDoesntAllowMultipleLDIF() throws Exceptio "sn: Amarr") ); // @formatter:on - - } finally { - writer.close(); } } @@ -205,7 +170,6 @@ public final void testWriteChangeRecordDoesntAllowMultipleLDIF() throws Exceptio @Test(expectedExceptions = RuntimeException.class) public final void testWriteChangeRecordChangeAcceptSendIOException() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; ChangeRecord cr = mock(ChangeRecord.class); when(cr.accept(any(ChangeRecordVisitor.class), any(ConnectionChangeRecordWriter.class))) @@ -222,11 +186,8 @@ public IOException answer(final InvocationOnMock invocation) throws Throwable { } }); - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord(cr); - } finally { - writer.close(); } } @@ -240,7 +201,6 @@ public IOException answer(final InvocationOnMock invocation) throws Throwable { @Test(expectedExceptions = LdapException.class) public final void testWriteChangeRecordChangeAcceptSendLdapException() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; ChangeRecord cr = mock(ChangeRecord.class); when(cr.accept(any(ChangeRecordVisitor.class), any(ConnectionChangeRecordWriter.class))) @@ -257,11 +217,8 @@ public LdapException answer(final InvocationOnMock invocation) throws Throwable } }); - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord(cr); - } finally { - writer.close(); } } @@ -273,12 +230,8 @@ public LdapException answer(final InvocationOnMock invocation) throws Throwable @Test(expectedExceptions = NullPointerException.class) public final void testWriteChangeRecordChangeRecordDoesntAllowNull() throws Exception { final Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord((ChangeRecord) null); - } finally { - writer.close(); } } @@ -290,15 +243,11 @@ public final void testWriteChangeRecordChangeRecordDoesntAllowNull() throws Exce @Test public final void testWriteChangeRecordDeleteRequest() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { ChangeRecord cr = Requests.newDeleteRequest(DN.valueOf("cn=scarter,dc=example,dc=com")); - writer = new ConnectionChangeRecordWriter(connection); writer.writeChangeRecord(cr); verify(connection, times(1)).delete(any(DeleteRequest.class)); - } finally { - writer.close(); } } @@ -310,12 +259,8 @@ public final void testWriteChangeRecordDeleteRequest() throws Exception { @Test(expectedExceptions = NullPointerException.class) public final void testWriteChangeRecordDeleteRequestDoesntAllowNull() throws Exception { final Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord((DeleteRequest) null); - } finally { - writer.close(); } } @@ -327,19 +272,15 @@ public final void testWriteChangeRecordDeleteRequestDoesntAllowNull() throws Exc @Test public final void testWriteChangeRecordModifyDNRequest() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { // @formatter:off ChangeRecord cr = Requests.newModifyDNRequest( "cn=scarter,dc=example,dc=com", "cn=Susan Jacobs"); //@formatter:on - writer = new ConnectionChangeRecordWriter(connection); writer.writeChangeRecord(cr); verify(connection, times(1)).modifyDN(any(ModifyDNRequest.class)); - } finally { - writer.close(); } } @@ -351,12 +292,8 @@ public final void testWriteChangeRecordModifyDNRequest() throws Exception { @Test(expectedExceptions = NullPointerException.class) public final void testWriteChangeRecordModifyDNRequestDoesntAllowNull() throws Exception { final Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord((ModifyDNRequest) null); - } finally { - writer.close(); } } @@ -368,10 +305,7 @@ public final void testWriteChangeRecordModifyDNRequestDoesntAllowNull() throws E @Test public final void testWriteChangeRecordModifyRequest() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { // @formatter:off ChangeRecord cr = Requests.newModifyRequest( "dn: cn=Fiona Jensen, ou=Marketing, dc=airius, dc=com", @@ -382,8 +316,6 @@ public final void testWriteChangeRecordModifyRequest() throws Exception { writer.writeChangeRecord(cr); // @formatter:on verify(connection, times(1)).modify(any(ModifyRequest.class)); - } finally { - writer.close(); } } @@ -395,12 +327,8 @@ public final void testWriteChangeRecordModifyRequest() throws Exception { @Test(expectedExceptions = NullPointerException.class) public final void testWriteChangeRecordModifyRequestDoesntAllowNull() throws Exception { final Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeChangeRecord((ModifyRequest) null); - } finally { - writer.close(); } } @@ -413,17 +341,12 @@ public final void testWriteChangeRecordModifyRequestDoesntAllowNull() throws Exc @Test public final void testWriteCommentDoNotSupportComment() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeComment("# A new comment"); verify(connection, Mockito.never()).add(any(String.class)); verify(connection, Mockito.never()).delete(any(String.class)); verify(connection, Mockito.never()).modify(any(String.class)); verify(connection, Mockito.never()).modifyDN(any(String.class), any(String.class)); - } finally { - writer.close(); } } @@ -435,12 +358,8 @@ public final void testWriteCommentDoNotSupportComment() throws Exception { @Test(expectedExceptions = NullPointerException.class) public final void testWriteCommentDoesntAllowNull() throws Exception { final Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); + try (ConnectionChangeRecordWriter writer = new ConnectionChangeRecordWriter(connection)) { writer.writeComment(null); - } finally { - writer.close(); } } @@ -451,12 +370,7 @@ public final void testWriteCommentDoesntAllowNull() throws Exception { */ @Test(expectedExceptions = NullPointerException.class) public final void testConnectionChangeRecordWriterDoesntAllowNull() throws Exception { - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(null); - } finally { - writer.close(); - } + new ConnectionChangeRecordWriter(null); } /** @@ -468,12 +382,7 @@ public final void testConnectionChangeRecordWriterDoesntAllowNull() throws Excep @Test public final void testConnectionChangeRecordWriterClose() throws Exception { Connection connection = mock(Connection.class); - ConnectionChangeRecordWriter writer = null; - try { - writer = new ConnectionChangeRecordWriter(connection); - } finally { - writer.close(); - verify(connection, times(1)).close(); - } + new ConnectionChangeRecordWriter(connection).close(); + verify(connection, times(1)).close(); } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java index ec26ad827..733d3b512 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryReaderTestCase.java @@ -1,29 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2014 ForgeRock AS + * Copyright 2011-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import java.util.NoSuchElementException; @@ -253,8 +242,7 @@ public LdapPromise answer(final InvocationOnMock invocation) throws Thro // Execute handler and return future. final SearchResultHandler handler = (SearchResultHandler) invocation.getArguments()[1]; if (handler != null) { - for (int i = 0; i < responses.length; i++) { - final Object response = responses[i]; + for (final Object response : responses) { if (response instanceof SearchResultEntry) { handler.handleEntry((SearchResultEntry) response); } else if (response instanceof SearchResultReference) { diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryWriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryWriterTestCase.java similarity index 66% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryWriterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryWriterTestCase.java index 691fd7bcd..f0502a5da 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryWriterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/ConnectionEntryWriterTestCase.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011 ForgeRock AS - * Portions copyright 2012 ForgeRock AS. + * Copyright 2011 ForgeRock AS. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import org.forgerock.opendj.ldap.Connection; @@ -56,7 +45,6 @@ public class ConnectionEntryWriterTestCase extends AbstractLDIFTestCase { @Test public final void testConnectionEntryWriterWritesEntry() throws Exception { Connection connection = mock(Connection.class); - ConnectionEntryWriter writer = null; final Entry entry = new LinkedHashMapEntry("cn=scarter,dc=example,dc=com").addAttribute("objectclass", @@ -78,13 +66,10 @@ public Result answer(final InvocationOnMock invocation) throws Throwable { } }); - try { - writer = new ConnectionEntryWriter(connection); + try (ConnectionEntryWriter writer = new ConnectionEntryWriter(connection)) { writer.writeComment("This is a test for the ConnectionEntryWriter"); writer.writeEntry(entry); verify(connection, times(1)).add(any(Entry.class)); - } finally { - writer.close(); } } @@ -95,12 +80,8 @@ public Result answer(final InvocationOnMock invocation) throws Throwable { */ @Test(expectedExceptions = NullPointerException.class) public final void testConnectionEntryWriterDoesntAllowNullComment() throws Exception { - ConnectionEntryWriter writer = null; - try { - writer = new ConnectionEntryWriter(null); + try (ConnectionEntryWriter writer = new ConnectionEntryWriter(null)) { writer.writeComment(null); - } finally { - writer.close(); } } @@ -111,12 +92,7 @@ public final void testConnectionEntryWriterDoesntAllowNullComment() throws Excep */ @Test(expectedExceptions = NullPointerException.class) public final void testConnectionEntryWriterDoesntAllowNull() throws Exception { - ConnectionEntryWriter writer = null; - try { - writer = new ConnectionEntryWriter(null); - } finally { - writer.close(); - } + new ConnectionEntryWriter(null); } /** @@ -128,12 +104,7 @@ public final void testConnectionEntryWriterDoesntAllowNull() throws Exception { @Test public final void testConnectionEntryWriterClose() throws Exception { Connection connection = mock(Connection.class); - ConnectionEntryWriter writer = null; - try { - writer = new ConnectionEntryWriter(connection); - } finally { - writer.close(); - verify(connection, times(1)).close(); - } + new ConnectionEntryWriter(connection).close(); + verify(connection, times(1)).close(); } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/EntryGeneratorTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/EntryGeneratorTestCase.java similarity index 90% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/EntryGeneratorTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/EntryGeneratorTestCase.java index 504cade5c..aa0f54b54 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/EntryGeneratorTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/EntryGeneratorTestCase.java @@ -1,33 +1,24 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldif; import static com.forgerock.opendj.ldap.CoreMessages.*; + import static org.fest.assertions.Assertions.*; -import static org.forgerock.opendj.ldap.TestCaseUtils.getTestFilePath; +import static org.forgerock.opendj.ldap.TestCaseUtils.*; import static org.forgerock.opendj.ldap.schema.CoreSchema.*; import java.io.File; @@ -74,52 +65,35 @@ public void setUp() throws Exception { @Test(enabled = false) public void printEntriesToStdOut() throws Exception { String path = SUBTEMPLATES_TEMPLATE_PATH; - EntryGenerator generator = null; - try { - generator = new EntryGenerator(getTestFilePath(path)).setResourcePath(resourcePath); + try (EntryGenerator generator = new EntryGenerator(getTestFilePath(path)).setResourcePath(resourcePath)) { while (generator.hasNext()) { System.out.println(generator.readEntry()); } - } finally { - Utils.closeSilently(generator); } - } @Test public void testCreateWithDefaultTemplateFile() throws Exception { - EntryGenerator generator = null; - try { - generator = new EntryGenerator(); + try (EntryGenerator generator = new EntryGenerator()) { assertThat(generator.hasNext()).isTrue(); - } finally { - Utils.closeSilently(generator); } } @Test(expectedExceptions = DecodeException.class, expectedExceptionsMessageRegExp = ".*Could not find template file unknown.*") public void testCreateWithMissingTemplateFile() throws Exception { - EntryGenerator generator = null; - try { - generator = new EntryGenerator("unknown/path"); + try (EntryGenerator generator = new EntryGenerator("unknown/path")) { generator.hasNext(); - } finally { - Utils.closeSilently(generator); } } @Test public void testCreateWithSetConstants() throws Exception { - EntryGenerator generator = null; - try { - generator = new EntryGenerator().setConstant("numusers", 1); + try (EntryGenerator generator = new EntryGenerator().setConstant("numusers", 1)) { generator.readEntry(); generator.readEntry(); assertThat(generator.readEntry().getName().toString()).isEqualTo("uid=user.0,ou=People,dc=example,dc=com"); assertThat(generator.hasNext()).as("should have no more entries").isFalse(); - } finally { - Utils.closeSilently(generator); } } @@ -272,15 +246,15 @@ private void checkEntryObjectClasses(Entry entry, String...objectClasses) { Attribute ocAttribute = entry.getAttribute(getObjectClassAttributeType().getNameOrOID()); assertThat(ocAttribute).isNotNull(); Iterator it = ocAttribute.iterator(); - for (int i = 0; i < objectClasses.length; i++) { - assertThat(it.next().toString()).isEqualTo(objectClasses[i]); + for (String objectClass : objectClasses) { + assertThat(it.next().toString()).isEqualTo(objectClass); } assertThat(it.hasNext()).isFalse(); } private void checkPresenceOfAttributes(Entry entry, String... attributes) { - for (int i = 0; i < attributes.length; i++) { - assertThat(entry.getAttribute(attributes[i])).isNotNull(); + for (String attribute : attributes) { + assertThat(entry.getAttribute(attribute)).isNotNull(); } } @@ -576,17 +550,13 @@ public Object[][] createTemplatesToTestSpecialChars() { @Test(dataProvider = "templatesToTestEscapeChars", dependsOnMethods = { "testParsingEscapeCharInTemplate" }) public void testEscapeCharsFromTemplate(String testName, String[] lines, String attrName, String expectedValue) throws Exception { - EntryGenerator generator = null; - try { - generator = new EntryGenerator(lines).setResourcePath(resourcePath); + try (EntryGenerator generator = new EntryGenerator(lines).setResourcePath(resourcePath)) { Entry topEntry = generator.readEntry(); Entry entry = generator.readEntry(); assertThat(topEntry).isNotNull(); assertThat(entry).isNotNull(); assertThat(entry.getAttribute(attrName).firstValueAsString()).isEqualTo(expectedValue); - } finally { - Utils.closeSilently(generator); } } @@ -609,17 +579,13 @@ public void testCombineEscapeCharInTemplate() throws Exception { // from [A-Z]. "cn: Foo \\<\\>\\{1\\}{sn}", "" }; - EntryGenerator generator = null; - try { - generator = new EntryGenerator(lines).setResourcePath(resourcePath); + try (EntryGenerator generator = new EntryGenerator(lines).setResourcePath(resourcePath)) { Entry topEntry = generator.readEntry(); Entry entry = generator.readEntry(); assertThat(topEntry).isNotNull(); assertThat(entry).isNotNull(); assertThat(entry.getAttribute("cn").firstValueAsString()).matches("Foo <[A-Z]>\\{1\\}Bar"); - } finally { - Utils.closeSilently(generator); } } } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java similarity index 97% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java index 1096fdf70..f6b75c09a 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordReaderTestCase.java @@ -1,29 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011 ForgeRock AS - * Portions copyright 2012 ForgeRock AS. - * Portions Copyright 2014 Manuel Gaupp + * Copyright 2011-2016 ForgeRock AS. + * Portions Copyright 2014 Manuel Gaupp */ package org.forgerock.opendj.ldif; @@ -1132,8 +1121,7 @@ public void testParseChangeRecordEntryWithDeleteControl() throws Exception { // Read the record ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(DeleteRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.2.840.113556.1.4.805"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("cn"); @@ -1164,8 +1152,7 @@ public void testParseChangeRecordEntryWithAddControl() throws Exception { // Read the record ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.1"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("cn"); @@ -1223,8 +1210,7 @@ public void testParseChangeRecordEntryWithAddControlWithoutSpacesBetweenCritical // Read the record ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.1"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("cn"); @@ -1255,8 +1241,7 @@ public void testParseChangeRecordEntryWithAddControlContainingWhiteSpaces() thro // Read the record ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.1"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("sn"); @@ -1399,8 +1384,7 @@ public void testParseChangeRecordEntryWithAddControlWithoutValue() throws Except // Read the record ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.1"); assertThat(record.getControls().get(0).getValue()).isNull(); @@ -1431,8 +1415,7 @@ public void testParseChangeRecordEntryWithAddControlWithoutCriticality() throws // Read the record ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.1"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("description"); @@ -1510,24 +1493,21 @@ public void testParseChangeRecordEntryWithMultipleControls() throws Exception { reader.setSchemaValidationPolicy(SchemaValidationPolicy.defaultPolicy()); // 1st ChangeRecord record = reader.readChangeRecord(); - assertThat(record.getName().toString()).isEqualTo( - "ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.1"); assertThat(record.getControls().get(0).getValue()).isNull(); //2nd record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "cn=Paul Jensen, ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("cn=Paul Jensen,ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.13"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("cn"); //3rd record = reader.readChangeRecord(); assertThat(record).isInstanceOf(AddRequest.class); - assertThat(record.getName().toString()).isEqualTo( - "cn=Paula Jensen, ou=Product Development, dc=airius, dc=com"); + assertThat(record.getName().toString()).isEqualTo("cn=Paula Jensen,ou=Product Development,dc=airius,dc=com"); assertThat(record.getControls()).isNotEmpty(); assertThat(record.getControls().get(0).getOID()).isEqualTo("1.3.6.1.1.13.13.16"); assertThat(record.getControls().get(0).getValue().toString()).isEqualTo("sn"); @@ -1535,13 +1515,10 @@ record = reader.readChangeRecord(); } /** - * Test to read an record containing an invalid control. (pair.value is - * null) Must throw a DecodeException. - * - * @throws Exception + * Tests that change records containing an empty control are rejected. */ @Test(expectedExceptions = DecodeException.class) - public void testParseChangeRecordEntryWithAddControlPairKeyNull() throws Exception { + public void testParseChangeRecordEntryRejectedWhenControlIsEmpty() throws Exception { // @formatter:off final LDIFChangeRecordReader reader = new LDIFChangeRecordReader( @@ -1983,7 +1960,7 @@ public void testParseModifyDNChangeRecordEntryRecordBase64NewRDN() throws Except LDIFChangeRecordReader reader = new LDIFChangeRecordReader( "dn::ZGM9cGVvcGxlLGRjPWV4YW1wbGUsZGM9b3Jn", "changetype: modrdn", - "newrdn::ZGM9cGVvcGxlLGRjPWV4YW1wbGUsZGM9Y29t", + "newrdn::ZGM9cGVvcGxl", "deleteoldrdn: 1" ); // @formatter:on @@ -1992,10 +1969,8 @@ public void testParseModifyDNChangeRecordEntryRecordBase64NewRDN() throws Except ChangeRecord record = reader.readChangeRecord(); assertThat(record).isInstanceOf(ModifyDNRequest.class); ModifyDNRequest modifyDNRequest = (ModifyDNRequest) record; - assertThat((Object) modifyDNRequest.getName()).isEqualTo( - DN.valueOf("dc=people,dc=example,dc=org")); - assertThat((Object) modifyDNRequest.getNewRDN()).isEqualTo( - RDN.valueOf("dc=people,dc=example,dc=com")); + assertThat((Object) modifyDNRequest.getName()).isEqualTo(DN.valueOf("dc=people,dc=example,dc=org")); + assertThat((Object) modifyDNRequest.getNewRDN()).isEqualTo(RDN.valueOf("dc=people")); assertThat(modifyDNRequest.isDeleteOldRDN()).isTrue(); reader.close(); } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java similarity index 97% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java index 360fd4ec2..96e6642ec 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFChangeRecordWriterTestCase.java @@ -1,28 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2011-2015 ForgeRock AS - * Portions copyright 2012 ForgeRock AS. + * Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -833,8 +822,7 @@ public void testWriteDeleteRequest() throws Exception { writer.writeChangeRecord(changeRequest); writer.close(); - assertThat(actual.get(0)) - .isEqualTo("dn: cn=Robert Jensen, ou=Marketing, dc=airius, dc=com"); + assertThat(actual.get(0)).isEqualTo("dn: cn=Robert Jensen,ou=Marketing,dc=airius,dc=com"); assertThat(actual.get(1)).isEqualTo("changetype: delete"); } diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java similarity index 97% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java index c9ee50b74..1fdbcf539 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryReaderTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.ldif; @@ -1115,33 +1105,27 @@ public void testLDIFEntryReaderFullEntry() throws Exception { // @formatter:on final String path = TestCaseUtils.createTempFile(strEntry); final FileInputStream in = new FileInputStream(path); - final LDIFEntryReader reader = new LDIFEntryReader(in); - Entry entry = null; - try { + try (LDIFEntryReader reader = new LDIFEntryReader(in)) { assertThat(reader.hasNext()); // 1st entry - entry = reader.readEntry(); - assertThat(entry.getName().toString()).isEqualTo( - "cn=Barbara Jensen, ou=Product Development, dc=airius, dc=com"); + Entry entry = reader.readEntry(); + assertThat(entry.getName() + .toString()).isEqualTo("cn=Barbara Jensen,ou=Product Development,dc=airius,dc=com"); assertThat(entry.getAttributeCount()).isEqualTo(6); // 2nd entry = reader.readEntry(); - assertThat(entry.getName().toString()).isEqualTo( - "cn=Bjorn Jensen, ou=Accounting, dc=airius, dc=com"); + assertThat(entry.getName().toString()).isEqualTo("cn=Bjorn Jensen,ou=Accounting,dc=airius,dc=com"); assertThat(entry.getAttributeCount()).isEqualTo(4); assertThat(reader.hasNext()).isFalse(); - } finally { - reader.close(); } } /** - * Tries to read an entry composed by multi-valued attributes. The - * multi-valued attributes contains an interesting case where two of them - * represents the same value, one in uppercase and the other in lower case. + * Tries to read an entry composed by multi-valued attributes. The multi-valued attributes contains an interesting + * case where two of them represents the same value, one in uppercase and the other in lower case. * * @throws Exception */ diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java similarity index 96% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java index 63d9e2795..633e5828b 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFEntryWriterTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2015 ForgeRock AS. */ package org.forgerock.opendj.ldif; diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java similarity index 98% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java index 0472f2c43..b8d8a943b 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/LDIFTestCase.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.ldif; import java.io.File; @@ -684,13 +673,8 @@ public final void testLdifNewEntryCollectionReader() throws Exception { */ @Test(expectedExceptions = NullPointerException.class) public final void testLdifNewEntryCollectionDoesntAllowNull() throws Exception { - - EntryReader resultReader = null; - try { - resultReader = LDIF.newEntryCollectionReader(null); + try (EntryReader resultReader = LDIF.newEntryCollectionReader(null)) { resultReader.readEntry(); - } finally { - resultReader.close(); } } @@ -739,13 +723,8 @@ public final void testLdifNewEntryIteratorReader() throws Exception { */ @Test(expectedExceptions = NullPointerException.class) public final void testLdifNewEntryIteratorReaderDoesntAllowsNull() throws Exception { - - EntryReader resultReader = null; - try { - resultReader = LDIF.newEntryIteratorReader(null); + try (EntryReader resultReader = LDIF.newEntryIteratorReader(null)) { resultReader.readEntry(); - } finally { - resultReader.close(); } } @@ -1937,7 +1916,7 @@ public final void testLdifPatchModifyDnEntryBranch() throws Exception { final LDIFChangeRecordReader patch = new LDIFChangeRecordReader( "dn: ou=People,dc=example,dc=com", "changetype: modrdn", - "newrdn: ou=Human Resources,dc=example,dc=com", + "newrdn: ou=Human Resources", "deleteoldrdn: 1" ); // @formatter:on @@ -2033,7 +2012,7 @@ public final void testLdifPatchModifyDnEntryBranchKeepsOldRdn() throws Exception final LDIFChangeRecordReader patch = new LDIFChangeRecordReader( "dn: ou=People,dc=example,dc=com", "changetype: modrdn", - "newrdn: ou=Human Resources,dc=example,dc=com", + "newrdn: ou=Human Resources", "deleteoldrdn: 0" ); // @formatter:on @@ -2603,7 +2582,7 @@ public final void testOverwritePatchOnModifyDNRequestSucceedsEvenWithWrongDN() t final LDIFChangeRecordReader patch = new LDIFChangeRecordReader( "dn: ou=WRONGscarter, dc=example,dc=com", "changetype: modrdn", - "newrdn: ou=Human Resources,dc=example,dc=com", + "newrdn: ou=Human Resources", "deleteoldrdn: 1" ); // @formatter:on @@ -2705,7 +2684,7 @@ public final void testOverwritePatchOnModifyDNRequestSucceedsEvenWithDuplicateEn final LDIFChangeRecordReader patch = new LDIFChangeRecordReader( "dn: uid=scarter,ou=People,dc=example,dc=com", "changetype: moddn", - "newrdn: uid=user.2,ou=People,dc=example,dc=com", + "newrdn: uid=user.2", "deleteoldrdn: 0" ); // @formatter:on diff --git a/opendj-core/src/test/java/org/forgerock/opendj/ldif/TemplateTagTestcase.java b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/TemplateTagTestcase.java similarity index 92% rename from opendj-core/src/test/java/org/forgerock/opendj/ldif/TemplateTagTestcase.java rename to opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/TemplateTagTestcase.java index e47e2a44e..a475dfc7a 100644 --- a/opendj-core/src/test/java/org/forgerock/opendj/ldif/TemplateTagTestcase.java +++ b/opendj-sdk-core/src/test/java/org/forgerock/opendj/ldif/TemplateTagTestcase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.ldif; diff --git a/opendj-sdk-core/src/test/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider b/opendj-sdk-core/src/test/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider new file mode 100644 index 000000000..052a548e8 --- /dev/null +++ b/opendj-sdk-core/src/test/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider @@ -0,0 +1,15 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2013 ForgeRock AS. +org.forgerock.opendj.ldap.spi.BasicTransportProvider diff --git a/opendj-grizzly/pom.xml b/opendj-sdk-grizzly/pom.xml similarity index 77% rename from opendj-grizzly/pom.xml rename to opendj-sdk-grizzly/pom.xml index 07c05b4a6..c8a76a434 100644 --- a/opendj-grizzly/pom.xml +++ b/opendj-sdk-grizzly/pom.xml @@ -1,28 +1,18 @@ 4.0.0 @@ -30,12 +20,11 @@ opendj-sdk-parent org.forgerock.opendj - 3.0.0-SNAPSHOT - ../opendj-sdk-parent/pom.xml + 4.0.0-SNAPSHOT - opendj-grizzly - OpenDJ Grizzly Transport Provider + opendj-sdk-grizzly + OpenDJ SDK Grizzly Transport Provider This module includes a Grizzly based network transport provider for OpenDJ. bundle @@ -49,12 +38,12 @@ org.forgerock.opendj - opendj-core + opendj-sdk-core org.forgerock.opendj - opendj-core + opendj-sdk-core test-jar test diff --git a/opendj-grizzly/src/main/java/com/forgerock/opendj/grizzly/GrizzlyTransportProvider.java b/opendj-sdk-grizzly/src/main/java/com/forgerock/opendj/grizzly/GrizzlyTransportProvider.java similarity index 58% rename from opendj-grizzly/src/main/java/com/forgerock/opendj/grizzly/GrizzlyTransportProvider.java rename to opendj-sdk-grizzly/src/main/java/com/forgerock/opendj/grizzly/GrizzlyTransportProvider.java index 3050a07d4..bde6ddc17 100644 --- a/opendj-grizzly/src/main/java/com/forgerock/opendj/grizzly/GrizzlyTransportProvider.java +++ b/opendj-sdk-grizzly/src/main/java/com/forgerock/opendj/grizzly/GrizzlyTransportProvider.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2014 ForgeRock AS. + * Copyright 2013-2014 ForgeRock AS. */ package com.forgerock.opendj.grizzly; diff --git a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt b/opendj-sdk-grizzly/src/main/java/com/forgerock/opendj/grizzly/package-info.java similarity index 76% rename from opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt rename to opendj-sdk-grizzly/src/main/java/com/forgerock/opendj/grizzly/package-info.java index e8020b892..a7883497a 100644 --- a/opendj-copyright-maven-plugin/src/test/resources/files/openam-copyrights/openam-bad-copyright-2.txt +++ b/opendj-sdk-grizzly/src/main/java/com/forgerock/opendj/grizzly/package-info.java @@ -9,11 +9,13 @@ * When distributing Covered Software, include this CDDL Header Notice in each file and include * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL * Header, with the fields enclosed by brackets [] replaced by your own identifying - * information: "Portions copyright [year] [name of copyright owner]". + * information: "Portions Copyright [year] [name of copyright owner]". * - * Copyright 2010 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ - -MUST BE REMOVED: Copyright 2010 ForgeRock AS. -EXPECTED OUTPUT: Copyright 2010-YEAR ForgeRock AS. - \ No newline at end of file + +/** + * Classes implementing Grizzly transport provider. + */ +package com.forgerock.opendj.grizzly; + diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java similarity index 93% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java index 4cefd970a..1226bdeeb 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferReader.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.grizzly; @@ -51,6 +41,7 @@ private final class ChildSequenceLimiter implements SequenceLimiter { 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(); @@ -60,6 +51,7 @@ public void checkLimit(final int readSize) throws IOException { bytesRead += readSize; } + @Override public SequenceLimiter endSequence() throws IOException { parent.checkLimit(remaining()); if (remaining() > 0) { @@ -72,10 +64,12 @@ public SequenceLimiter endSequence() throws IOException { return parent; } + @Override public int remaining() { return readLimit - bytesRead; } + @Override public ChildSequenceLimiter startSequence(final int readLimit) { if (child == null) { child = new ChildSequenceLimiter(); @@ -90,6 +84,7 @@ public ChildSequenceLimiter startSequence(final int readLimit) { 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(); @@ -97,15 +92,18 @@ public void checkLimit(final int readSize) throws IOException { } } + @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(); @@ -162,6 +160,7 @@ private interface SequenceLimiter { * @throws IOException * if an I/O error occurs */ + @Override public void close() throws IOException { buffer.dispose(); } @@ -175,6 +174,7 @@ public void close() throws IOException { * @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)) @@ -192,11 +192,12 @@ public boolean elementAvailable() throws IOException { * @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(); @@ -212,7 +213,7 @@ public int peekLength() throws IOException { return peekLength; } - /** {@inheritDoc} */ + @Override public byte peekType() throws IOException { if (state == ASN1.ELEMENT_READ_STATE_NEED_TYPE) { needTypeState(false); @@ -221,7 +222,7 @@ public byte peekType() throws IOException { return peekType; } - /** {@inheritDoc} */ + @Override public boolean readBoolean() throws IOException { // Read the header if haven't done so already peekLength(); @@ -240,7 +241,7 @@ public boolean readBoolean() throws IOException { return readByte != 0x00; } - /** {@inheritDoc} */ + @Override public void readEndSequence() throws IOException { readLimiter = readLimiter.endSequence(); @@ -250,20 +251,19 @@ public void readEndSequence() throws IOException { 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(); @@ -278,7 +278,7 @@ public int readEnumerated() throws IOException { return (int) readInteger(); } - /** {@inheritDoc} */ + @Override public long readInteger() throws IOException { // Read the header if haven't done so already peekLength(); @@ -318,7 +318,7 @@ public long readInteger() throws IOException { } } - /** {@inheritDoc} */ + @Override public void readNull() throws IOException { // Read the header if haven't done so already peekLength(); @@ -334,7 +334,7 @@ public void readNull() throws IOException { state = ASN1.ELEMENT_READ_STATE_NEED_TYPE; } - /** {@inheritDoc} */ + @Override public ByteString readOctetString() throws IOException { // Read the header if haven't done so already peekLength(); @@ -355,7 +355,7 @@ public ByteString readOctetString() throws IOException { return ByteString.wrap(value); } - /** {@inheritDoc} */ + @Override public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws IOException { // Read the header if haven't done so already peekLength(); @@ -378,7 +378,7 @@ public ByteStringBuilder readOctetString(final ByteStringBuilder builder) throws return builder; } - /** {@inheritDoc} */ + @Override public String readOctetStringAsString() throws IOException { // Read the header if haven't done so already peekLength(); @@ -415,7 +415,7 @@ public String readOctetStringAsString() throws IOException { return str; } - /** {@inheritDoc} */ + @Override public void readStartSequence() throws IOException { // Read the header if haven't done so already peekLength(); @@ -428,20 +428,19 @@ public void readStartSequence() throws IOException { 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(); diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferWriter.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferWriter.java similarity index 91% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferWriter.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferWriter.java index 740e24f6f..c50e864f4 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferWriter.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ASN1BufferWriter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.grizzly; @@ -51,6 +41,7 @@ private class ChildSequenceBuffer implements SequenceBuffer { 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()); @@ -59,6 +50,7 @@ public SequenceBuffer endSequence() throws IOException { return parent; } + @Override public SequenceBuffer startSequence(final byte type) throws IOException { if (child == null) { child = new ChildSequenceBuffer(); @@ -69,10 +61,12 @@ public SequenceBuffer startSequence(final byte type) throws IOException { 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); } @@ -112,11 +106,13 @@ public void ensureAdditionalCapacity(final int size) { 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(); @@ -128,11 +124,13 @@ public SequenceBuffer startSequence(final byte type) throws IOException { 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); @@ -152,19 +150,12 @@ private interface SequenceBuffer { 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. @@ -177,9 +168,7 @@ void reset() { 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(); @@ -192,6 +181,7 @@ void reset() { * @throws IOException * if an error occurs while closing the stream. */ + @Override public void close() throws IOException { outBuffer = null; } @@ -202,19 +192,19 @@ public void close() throws IOException { * @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); @@ -224,24 +214,24 @@ public ASN1Writer writeBoolean(final byte type, final boolean booleanValue) thro 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)) @@ -273,7 +263,7 @@ public ASN1Writer writeInteger(final byte type, final int intValue) throws IOExc return this; } - /** {@inheritDoc} */ + @Override public ASN1Writer writeInteger(final byte type, final long longValue) throws IOException { sequenceBuffer.writeByte(type); if (((longValue < 0) && ((longValue & 0xFFFFFFFFFFFFFF80L) == 0xFFFFFFFFFFFFFF80L)) @@ -347,7 +337,7 @@ public ASN1Writer writeInteger(final byte type, final long longValue) throws IOE return this; } - /** {@inheritDoc} */ + @Override public ASN1Writer writeNull(final byte type) throws IOException { sequenceBuffer.writeByte(type); writeLength(sequenceBuffer, 0); @@ -356,7 +346,7 @@ public ASN1Writer writeNull(final byte type) throws IOException { return this; } - /** {@inheritDoc} */ + @Override public ASN1Writer writeOctetString(final byte type, final byte[] value, final int offset, final int length) throws IOException { sequenceBuffer.writeByte(type); @@ -367,7 +357,7 @@ public ASN1Writer writeOctetString(final byte type, final byte[] value, final in return this; } - /** {@inheritDoc} */ + @Override public ASN1Writer writeOctetString(final byte type, final ByteSequence value) throws IOException { sequenceBuffer.writeByte(type); @@ -381,7 +371,7 @@ public ASN1Writer writeOctetString(final byte type, final ByteSequence value) return this; } - /** {@inheritDoc} */ + @Override public ASN1Writer writeOctetString(final byte type, final String value) throws IOException { sequenceBuffer.writeByte(type); @@ -398,7 +388,7 @@ public ASN1Writer writeOctetString(final byte type, final String value) throws I return this; } - /** {@inheritDoc} */ + @Override public ASN1Writer writeStartSequence(final byte type) throws IOException { // Get a child sequence buffer sequenceBuffer = sequenceBuffer.startSequence(type); @@ -407,7 +397,7 @@ public ASN1Writer writeStartSequence(final byte type) throws IOException { 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. diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java similarity index 81% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java index f7270503f..2f273c7a6 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/ConnectionSecurityLayerFilter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2009-2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2014 ForgeRock AS. + * Copyright 2009-2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.grizzly; @@ -55,10 +45,12 @@ public Decoder(final ConnectionSecurityLayer layer, final MemoryManager memor setMemoryManager(memoryManager); } + @Override public String getName() { return getClass().getName(); } + @Override public boolean hasInputRemaining(final AttributeStorage storage, final Buffer input) { return input != null && input.hasRemaining(); } @@ -94,10 +86,12 @@ private Encoder(final ConnectionSecurityLayer layer, final MemoryManager memo setMemoryManager(memoryManager); } + @Override public String getName() { return getClass().getName(); } + @Override public boolean hasInputRemaining(final AttributeStorage storage, final Buffer input) { return input != null && input.hasRemaining(); } diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java similarity index 84% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java index 24ac74312..beb4102e0 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransport.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2014 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2014 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java similarity index 96% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java index 0c3168926..a58423206 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnection.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.grizzly; @@ -276,7 +266,7 @@ public LdapPromise bindAsync(final BindRequest request, } final BindResultLdapPromiseImpl promise = - newBindLdapPromise(messageID, request, context, intermediateResponseHandler, this); + newBindLdapPromise(messageID, request, context, intermediateResponseHandler); try { synchronized (stateLock) { @@ -521,7 +511,6 @@ public void removeConnectionEventListener(final ConnectionEventListener listener } } - /** {@inheritDoc} */ @Override public LdapPromise searchAsync(final SearchRequest request, final IntermediateResponseHandler intermediateResponseHandler, final SearchResultHandler entryHandler) { @@ -554,13 +543,8 @@ public LdapPromise searchAsync(final SearchRequest request, @Override public String toString() { - final StringBuilder builder = new StringBuilder(); - builder.append("LDAPConnection("); - builder.append(connection.getLocalAddress()); - builder.append(','); - builder.append(connection.getPeerAddress()); - builder.append(')'); - return builder.toString(); + return getClass().getSimpleName() + "(" + connection.getLocalAddress() + + ',' + connection.getPeerAddress() + ')'; } @Override diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java similarity index 90% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java index 912c1bfb6..be856b225 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactory.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListener.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListener.java similarity index 85% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListener.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListener.java index 8af1e2175..caaf57180 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListener.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListener.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyUtils.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyUtils.java similarity index 90% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyUtils.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyUtils.java index 27a451dcd..2881ab243 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyUtils.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/GrizzlyUtils.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPBaseFilter.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPBaseFilter.java similarity index 79% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPBaseFilter.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPBaseFilter.java index 22ce6f775..3f35af3ef 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPBaseFilter.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPBaseFilter.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java similarity index 96% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java index ce328effa..b5b308c67 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPClientFilter.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ package org.forgerock.opendj.grizzly; @@ -110,6 +100,7 @@ void setFilterChainContext(FilterChainContext context) { * * @return the reader to read incoming LDAP messages */ + @Override public LDAPReader getReader() { return this.reader; } diff --git a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java similarity index 96% rename from opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java rename to opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java index a502f1187..faa4cbbbf 100644 --- a/opendj-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/LDAPServerFilter.java @@ -1,30 +1,19 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2012-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2012-2016 ForgeRock AS. */ - package org.forgerock.opendj.grizzly; import java.io.IOException; @@ -94,17 +83,13 @@ */ final class LDAPServerFilter extends LDAPBaseFilter { - /** - * Provides an arbitrary write operation on a LDAP writer. - */ + /** Provides an arbitrary write operation on a LDAP writer. */ private interface LDAPWrite { void perform(LDAPWriter writer, int messageID, T message) throws IOException; } - /** - * Write operation for intermediate responses. - */ + /** Write operation for intermediate responses. */ private static final LDAPWrite INTERMEDIATE = new LDAPWrite() { @Override @@ -343,7 +328,6 @@ public void sendUnsolicitedNotification(final ExtendedResult notification) { } } - /** {@inheritDoc} */ @Override public String toString() { final StringBuilder builder = new StringBuilder(); @@ -473,7 +457,6 @@ public void handleException(final LdapException error) { protected void writeResult(LDAPWriter writer, CompareResult result) throws IOException { writer.writeCompareResult(messageID, result); - } } @@ -638,9 +621,7 @@ protected void writeResult(LDAPWriter writer, Result result) }; // @formatter:on - /** - * Default maximum request size for incoming requests. - */ + /** Default maximum request size for incoming requests. */ private static final int DEFAULT_MAX_REQUEST_SIZE = 5 * 1024 * 1024; private static final Attribute LDAP_CONNECTION_ATTR = @@ -672,7 +653,6 @@ protected void writeResult(LDAPWriter writer, Result result) private static final class ServerRequestHandler extends AbstractLDAPMessageHandler implements LDAPBaseHandler { - private final Connection connection; private final LDAPReader reader; diff --git a/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/package-info.java b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/package-info.java new file mode 100644 index 000000000..6437c04f9 --- /dev/null +++ b/opendj-sdk-grizzly/src/main/java/org/forgerock/opendj/grizzly/package-info.java @@ -0,0 +1,38 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2013 ForgeRock AS. + */ + +/** + * Provides an implementation of a transport provider using Grizzly as + * transport. This provider is named "Grizzly". + *

    + * To be used, this implementation must be declared in the + * provider-configuration file + * {@code META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider} + * with this single line: + * + *

    + * com.forgerock.opendj.ldap.GrizzlyTransportProvider
    + * 
    + * + * To require that this implementation is used, you must set the transport + * provider to "Grizzly" using {@code LDAPOptions#setTransportProvider()} + * method if requesting a {@code LDAPConnectionFactory} or + * {@code LDAPListenerOptions#setTransportProvider()} method if requesting a + * {@code LDAPListener}. Otherwise there is no guarantee that this + * implementation will be used. + */ +package org.forgerock.opendj.grizzly; + diff --git a/opendj-sdk-grizzly/src/main/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider b/opendj-sdk-grizzly/src/main/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider new file mode 100644 index 000000000..f16ebea99 --- /dev/null +++ b/opendj-sdk-grizzly/src/main/resources/META-INF/services/org.forgerock.opendj.ldap.spi.TransportProvider @@ -0,0 +1,15 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2013 ForgeRock AS. +com.forgerock.opendj.grizzly.GrizzlyTransportProvider diff --git a/opendj-sdk-grizzly/src/main/resources/com/forgerock/opendj/grizzly/grizzly.properties b/opendj-sdk-grizzly/src/main/resources/com/forgerock/opendj/grizzly/grizzly.properties new file mode 100644 index 000000000..912064866 --- /dev/null +++ b/opendj-sdk-grizzly/src/main/resources/com/forgerock/opendj/grizzly/grizzly.properties @@ -0,0 +1,24 @@ +# +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions Copyright [year] [name of copyright owner]". +# +# Copyright 2013-2014 ForgeRock AS. +LDAP_CONNECTION_REQUEST_TIMEOUT=The request has failed because no response \ + was received from the server within the %d ms timeout +LDAP_CONNECTION_CONNECT_TIMEOUT=The connection attempt to server %s has failed \ + because the connection timeout period of %d ms was exceeded +LDAP_CONNECTION_BIND_OR_START_TLS_REQUEST_TIMEOUT=The bind or StartTLS request \ + has failed because no response was received from the server within the %d ms \ + timeout. The LDAP connection is now in an invalid state and can no longer be used +LDAP_CONNECTION_BIND_OR_START_TLS_CONNECTION_TIMEOUT=The LDAP connection has \ + failed because no bind or StartTLS response was received from the server \ + within the %d ms timeout diff --git a/opendj-grizzly/src/site/xdoc/index.xml.vm b/opendj-sdk-grizzly/src/site/xdoc/index.xml.vm similarity index 76% rename from opendj-grizzly/src/site/xdoc/index.xml.vm rename to opendj-sdk-grizzly/src/site/xdoc/index.xml.vm index 49225621d..b210923ad 100644 --- a/opendj-grizzly/src/site/xdoc/index.xml.vm +++ b/opendj-sdk-grizzly/src/site/xdoc/index.xml.vm @@ -1,28 +1,18 @@ diff --git a/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferReaderTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferReaderTestCase.java new file mode 100644 index 000000000..c5cd7af30 --- /dev/null +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferReaderTestCase.java @@ -0,0 +1,40 @@ +/* + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. + * + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. + * + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". + * + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. + */ + +package org.forgerock.opendj.grizzly; + +import java.io.IOException; +import java.nio.ByteBuffer; + +import org.forgerock.opendj.io.ASN1Reader; +import org.forgerock.opendj.io.ASN1ReaderTestCase; +import org.glassfish.grizzly.memory.ByteBufferWrapper; +import org.glassfish.grizzly.memory.MemoryManager; + +/** + * This class provides test cases for ASN1BufferReader. + */ +public class ASN1BufferReaderTestCase extends ASN1ReaderTestCase { + @Override + protected ASN1Reader getReader(final byte[] b, final int maxElementSize) throws IOException { + final ByteBufferWrapper buffer = new ByteBufferWrapper(ByteBuffer.wrap(b)); + final ASN1BufferReader reader = + new ASN1BufferReader(maxElementSize, MemoryManager.DEFAULT_MEMORY_MANAGER); + reader.appendBytesRead(buffer); + return reader; + } +} diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferWriterTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferWriterTestCase.java similarity index 60% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferWriterTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferWriterTestCase.java index 532b27e01..bedc9f48d 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferWriterTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ASN1BufferWriterTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2011-2013 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2011-2013 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java similarity index 97% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java index a38122f41..a7ac5eda7 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/ConnectionFactoryTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransportTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransportTestCase.java similarity index 64% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransportTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransportTestCase.java index dc5487521..605f748e6 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransportTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/DefaultTCPNIOTransportTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions copyright 2012-2013 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions copyright 2012-2013 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java similarity index 95% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java index fc15db1cf..349e2cafc 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionFactoryTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java similarity index 83% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java index cb591398e..9e44e6808 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPConnectionTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java similarity index 94% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java index 8cb84b618..cd22bc373 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPListenerTestCase.java @@ -1,28 +1,18 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2010 Sun Microsystems, Inc. - * Portions Copyright 2011-2015 ForgeRock AS. + * Copyright 2010 Sun Microsystems, Inc. + * Portions Copyright 2011-2016 ForgeRock AS. */ package org.forgerock.opendj.grizzly; @@ -82,9 +72,7 @@ import static org.forgerock.util.Options.defaultOptions; import static org.mockito.Mockito.*; -/** - * Tests the LDAPListener class. - */ +/** Tests the LDAPListener class. */ @SuppressWarnings("javadoc") public class GrizzlyLDAPListenerTestCase extends SdkTestCase { @@ -97,14 +85,12 @@ private static class MockServerConnection implements ServerConnection { // Do nothing. } - /** {@inheritDoc} */ @Override public void handleAbandon(final Integer requestContext, final AbandonRequest request) throws UnsupportedOperationException { // Do nothing. } - /** {@inheritDoc} */ @Override public void handleAdd(final Integer requestContext, final AddRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -112,7 +98,6 @@ public void handleAdd(final Integer requestContext, final AddRequest request, resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS)); } - /** {@inheritDoc} */ @Override public void handleBind(final Integer requestContext, final int version, final BindRequest request, @@ -121,7 +106,6 @@ public void handleBind(final Integer requestContext, final int version, resultHandler.handleResult(Responses.newBindResult(ResultCode.SUCCESS)); } - /** {@inheritDoc} */ @Override public void handleCompare(final Integer requestContext, final CompareRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -130,25 +114,21 @@ public void handleCompare(final Integer requestContext, final CompareRequest req resultHandler.handleResult(Responses.newCompareResult(ResultCode.SUCCESS)); } - /** {@inheritDoc} */ @Override public void handleConnectionClosed(final Integer requestContext, final UnbindRequest request) { isClosed.countDown(); } - /** {@inheritDoc} */ @Override public void handleConnectionDisconnected(final ResultCode resultCode, final String message) { // Do nothing. } - /** {@inheritDoc} */ @Override public void handleConnectionError(final Throwable error) { connectionError.handleResult(error); } - /** {@inheritDoc} */ @Override public void handleDelete(final Integer requestContext, final DeleteRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -156,7 +136,6 @@ public void handleDelete(final Integer requestContext, final DeleteRequest reque resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS)); } - /** {@inheritDoc} */ @Override public void handleExtendedRequest(final Integer requestContext, final ExtendedRequest request, @@ -167,7 +146,6 @@ public void handleExtendedRequest(final Integer reque "Extended operation " + request.getOID() + " not supported"))); } - /** {@inheritDoc} */ @Override public void handleModify(final Integer requestContext, final ModifyRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -175,7 +153,6 @@ public void handleModify(final Integer requestContext, final ModifyRequest reque resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS)); } - /** {@inheritDoc} */ @Override public void handleModifyDN(final Integer requestContext, final ModifyDNRequest request, final IntermediateResponseHandler intermediateResponseHandler, @@ -183,26 +160,22 @@ public void handleModifyDN(final Integer requestContext, final ModifyDNRequest r resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS)); } - /** {@inheritDoc} */ @Override public void handleSearch(final Integer requestContext, final SearchRequest request, final IntermediateResponseHandler intermediateResponseHandler, final SearchResultHandler entryHandler, final LdapResultHandler resultHandler) throws UnsupportedOperationException { resultHandler.handleResult(Responses.newResult(ResultCode.SUCCESS)); } - } private static class MockServerConnectionFactory implements ServerConnectionFactory { - private final MockServerConnection serverConnection; private MockServerConnectionFactory(final MockServerConnection serverConnection) { this.serverConnection = serverConnection; } - /** {@inheritDoc} */ @Override public ServerConnection handleAccept(final LDAPClientContext clientContext) throws LdapException { serverConnection.context.handleResult(clientContext); @@ -210,25 +183,19 @@ public ServerConnection handleAccept(final LDAPClientContext clientCont } } - /** - * Disables logging before the tests. - */ + /** Disables logging before the tests. */ @BeforeClass public void disableLogging() { TestCaseUtils.setDefaultLogLevel(Level.SEVERE); } - /** - * Re-enable logging after the tests. - */ + /** Re-enable logging after the tests. */ @AfterClass public void enableLogging() { TestCaseUtils.setDefaultLogLevel(Level.INFO); } - /** - * Test creation of LDAP listener with default transport provider. - */ + /** Test creation of LDAP listener with default transport provider. */ @SuppressWarnings("unchecked") @Test public void testCreateLDAPListener() throws Exception { @@ -238,9 +205,7 @@ public void testCreateLDAPListener() throws Exception { listener.close(); } - /** - * Test creation of LDAP listener with default transport provider and custom class loader. - */ + /** Test creation of LDAP listener with default transport provider and custom class loader. */ @SuppressWarnings("unchecked") @Test public void testCreateLDAPListenerWithCustomClassLoader() throws Exception { @@ -252,11 +217,9 @@ public void testCreateLDAPListenerWithCustomClassLoader() throws Exception { listener.close(); } - /** - * Test creation of LDAP listener with unknown transport provider. - */ + /** Test creation of LDAP listener with unknown transport provider. */ @SuppressWarnings({ "unchecked" }) - @Test(expectedExceptions = { ProviderNotFoundException.class }, + @Test(expectedExceptions = ProviderNotFoundException.class, expectedExceptionsMessageRegExp = "^The requested provider 'unknown' .*") public void testCreateLDAPListenerFailureProviderNotFound() throws Exception { Options options = defaultOptions().set(TRANSPORT_PROVIDER, "unknown"); @@ -413,7 +376,6 @@ public void testLDAPListenerLoadBalanceDuringHandleBind() throws Exception { final MockServerConnection proxyServerConnection = new MockServerConnection() { - /** {@inheritDoc} */ @Override public void handleBind(final Integer requestContext, final int version, final BindRequest request, @@ -565,7 +527,6 @@ public void testLDAPListenerProxyDuringHandleBind() throws Exception { try { final MockServerConnection proxyServerConnection = new MockServerConnection() { - /** {@inheritDoc} */ @Override public void handleBind(final Integer requestContext, final int version, final BindRequest request, diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPReaderWriterTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPReaderWriterTestCase.java similarity index 61% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPReaderWriterTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPReaderWriterTestCase.java index 549cb58c7..73c7baec3 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPReaderWriterTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyLDAPReaderWriterTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013-2015 ForgeRock AS. + * Copyright 2013-2015 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyUtilsTestCase.java b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyUtilsTestCase.java similarity index 80% rename from opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyUtilsTestCase.java rename to opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyUtilsTestCase.java index b08217b05..c25eb8ccc 100644 --- a/opendj-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyUtilsTestCase.java +++ b/opendj-sdk-grizzly/src/test/java/org/forgerock/opendj/grizzly/GrizzlyUtilsTestCase.java @@ -1,27 +1,17 @@ /* - * CDDL HEADER START + * The contents of this file are subject to the terms of the Common Development and + * Distribution License (the License). You may not use this file except in compliance with the + * License. * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the + * specific language governing permission and limitations under the License. * - * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt - * or http://forgerock.org/license/CDDLv1.0.html. - * See the License for the specific language governing permissions - * and limitations under the License. + * When distributing Covered Software, include this CDDL Header Notice in each file and include + * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL + * Header, with the fields enclosed by brackets [] replaced by your own identifying + * information: "Portions Copyright [year] [name of copyright owner]". * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at legal-notices/CDDLv1_0.txt. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: - * Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - * - * - * Copyright 2013 ForgeRock AS. + * Copyright 2013 ForgeRock AS. */ package org.forgerock.opendj.grizzly; diff --git a/opendj-sdk-parent/pom.xml b/opendj-sdk-parent/pom.xml deleted file mode 100644 index ab7774c96..000000000 --- a/opendj-sdk-parent/pom.xml +++ /dev/null @@ -1,400 +0,0 @@ - - - - 4.0.0 - - - org.forgerock.opendj - opendj-sdk-bom - 3.0.0-SNAPSHOT - - - org.forgerock.opendj - opendj-sdk-parent - - pom - - OpenDJ SDK Parent - - This group module provides a complete LDAP SDK for developing LDAP Directory client and server applications. - - - - - ../opendj-copyright-maven-plugin - ../opendj-doc-maven-plugin - ../opendj-core - ../opendj-grizzly - ../opendj-cli - ../opendj-ldap-toolkit - ../opendj-ldap-sdk-examples - ../opendj-rest2ldap - - - - 1.0.2 - 3.1.0 - 2.3.23 - - - - - - ${opendj.osgi.import.additional}, - * - - - org/forgerock/checkstyle/opendj-java-header - - - - - - - org.forgerock - forgerock-build-tools - ${forgerock-build-tools.version} - test - - - - - org.forgerock.opendj - opendj-core - test-jar - ${project.version} - test - - - - - - - - org.easytesting - fest-assert - test - - - - org.assertj - assertj-core - test - - - - org.mockito - mockito-all - test - - - - org.testng - testng - test - - - - org.slf4j - slf4j-jdk14 - test - - - - - - - - org.forgerock.maven.plugins - javadoc-updater-maven-plugin - 1.0.0 - - - site - - fixjavadoc - - - ${project.reporting.outputDirectory} - - - - - - - - - - org.forgerock.opendj - opendj-copyright-maven-plugin - ${project.version} - - - - README - **/README - README.txt - **/README.txt - **/THIRDPARTYREADME.txt - legal-notices/CDDLv1_0.txt - **/tests/unit-tests-testng/resource/config-changes.ldif - - - - - - org.forgerock.opendj - opendj-doc-maven-plugin - ${project.version} - - - - true - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - org.apache.maven.plugins - maven-surefire-plugin - - -server - - - usedefaultlisteners - false - - - listener - org.forgerock.testng.ForgeRockTestListener - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - <_removeheaders> - Bnd-LastModified,Built-By,Private-Package,Tool,Created-By,Build-Jdk,Include-Resource, - Ignore-Package,Private-Package,Bundle-DocURL - - ${opendj.osgi.import} - - - false - true - ${project.build.outputDirectory}/META-INF/MANIFEST.MF - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - http://commons.forgerock.org/i18n-framework/i18n-core/apidocs - - - - - - org.apache.maven.plugins - maven-source-plugin - - - - jar - - - - - - - org.apache.maven.plugins - maven-site-plugin - - en - - - - - org.forgerock.commons - i18n-maven-plugin - ${i18n-framework.version} - - - - org.codehaus.mojo - cobertura-maven-plugin - - - - **/*Messages.class - - - - - - - - org.apache.maven.plugins - maven-plugin-plugin - 3.2 - - true - - - - mojo-descriptor - process-classes - - descriptor - - - - - - - - org.forgerock.commons - forgerock-doc-maven-plugin - ${forgerock-doc-plugin.version} - - OpenDJ - ${project.version} - ${project.version} - UA-23412190-8 - - - - - - - - - - - org.apache.maven.plugins - maven-project-info-reports-plugin - 2.4 - - - - index - mailing-list - issue-tracking - license - scm - cim - distribution-management - - - - - - - - - - - precommit - - - - org.forgerock.opendj - opendj-copyright-maven-plugin - - - check-copyright - - check-copyright - - - - - - - - - - update-copyrights - - - - org.forgerock.opendj - opendj-copyright-maven-plugin - - - check-copyright - none - - check-copyright - - - - update-copyright - - update-copyright - - - - - (CDDL HEADER END|\"Portions Copyright \[year\] \[name of copyright owner\]\") - - - - - - - - - - diff --git a/pom.xml b/pom.xml index c8b17e4a0..043132d6f 100644 --- a/pom.xml +++ b/pom.xml @@ -1,49 +1,37 @@ - - org.forgerock - forgerock-parent - 2.0.3 - - 4.0.0 - org.forgerock.opendj - opendj-sdk-bom - 3.0.0-SNAPSHOT + + org.forgerock.opendj + opendj-sdk-bom + 4.0.0-SNAPSHOT + opendj-sdk-bom/pom.xml + + opendj-sdk-parent pom - OpenDJ SDK BOM - OpenDJ BOM. - Provides a list of OpenDJ dependencies - which are known to be compatible with each other. + OpenDJ SDK Parent + + This group module provides a complete LDAP SDK for developing LDAP Directory client and server applications. + 2011 http://opendj.forgerock.org @@ -74,7 +62,7 @@ https://stash.forgerock.org/projects/OPENDJ/repos/opendj-sdk/browse scm:git:ssh://git@stash.forgerock.org:7999/opendj/opendj-sdk.git scm:git:ssh://git@stash.forgerock.org:7999/opendj/opendj-sdk.git - release/3.0.0 + HEAD @@ -112,39 +100,46 @@ - - - forgerock-staging-repository - ForgeRock Release Repository - http://maven.forgerock.org/repo/releases - - false - - - - - forgerock-snapshots-repository - ForgeRock Snapshot Repository - http://maven.forgerock.org/repo/snapshots - - false - - - - - jvnet-nexus-snapshots - https://maven.java.net/content/repositories/snapshots - - false - - - true - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - opendj-sdk-parent + opendj-sdk-bom + opendj-doc-maven-plugin + opendj-sdk-core + opendj-sdk-grizzly + opendj-cli + opendj-ldap-toolkit + opendj-ldap-sdk-examples + opendj-rest2ldap @@ -152,61 +147,334 @@ scp://community.internal.forgerock.com/var/www/vhosts/opendj.forgerock.org/httpdocs - 3.0.0-SNAPSHOT - 1.4.2 + 1.0.3 + 3.1.0 + 2.3.23 + 3.1.2 + + + + + + ${opendj.osgi.import.additional}, + * + + 1.0.0 - + - org.forgerock.commons - forgerock-bom - 4.1.0 - import - pom + io.dropwizard.metrics + metrics-core + ${metrics-core.version} - + - org.forgerock.commons - i18n-core - ${i18n-framework.version} + org.forgerock + forgerock-build-tools + ${forgerock-build-tools.version} + test - - org.forgerock.commons - i18n-slf4j - ${i18n-framework.version} - - - org.forgerock.opendj - opendj-core - ${opendj.sdk.version} + opendj-sdk-core + test-jar + ${project.version} + test + + - - org.forgerock.opendj - opendj-cli - ${opendj.sdk.version} - - - org.forgerock.opendj - opendj-grizzly - ${opendj.sdk.version} - + + + org.easytesting + fest-assert + test + - - org.forgerock.opendj - opendj-rest2ldap - ${opendj.sdk.version} - - - + + org.assertj + assertj-core + test + + + + org.mockito + mockito-all + test + + + + org.testng + testng + test + + + + org.slf4j + slf4j-jdk14 + test + +
    + + + + + + org.forgerock.maven.plugins + javadoc-updater-maven-plugin + 1.0.0 + + + site + + fixjavadoc + + + ${project.reporting.outputDirectory} + + + + + + + + + + org.forgerock.opendj + opendj-doc-maven-plugin + ${project.version} + + + + true + org.apache.maven.plugins + maven-compiler-plugin + + 1.7 + 1.7 + + + + + org.apache.maven.plugins + maven-surefire-plugin + + -server + + + usedefaultlisteners + false + + + listener + org.forgerock.testng.ForgeRockTestListener + + + + + + + + org.codehaus.mojo + buildnumber-maven-plugin + 1.4 + + + generate-buildnumber + + create + + + buildRevision + -1 + + + + + + + org.apache.felix + maven-bundle-plugin + 2.3.7 + true + + + + <_removeheaders> + Bnd-LastModified,Built-By,Private-Package,Tool,Created-By,Build-Jdk,Include-Resource, + Ignore-Package,Private-Package,Bundle-DocURL + + ${opendj.osgi.import} + + + false + true + ${project.build.outputDirectory}/META-INF/MANIFEST.MF + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + + + http://commons.forgerock.org/i18n-framework/i18n-core/apidocs + + + + + + org.apache.maven.plugins + maven-source-plugin + + + + jar + + + + + + + org.apache.maven.plugins + maven-site-plugin + + en + + + + + org.forgerock.commons + i18n-maven-plugin + ${i18n-framework.version} + + + + org.codehaus.mojo + cobertura-maven-plugin + + + + **/*Messages.class + + + + + + + + org.apache.maven.plugins + maven-plugin-plugin + 3.2 + + true + + + + mojo-descriptor + process-classes + + descriptor + + + + + + + org.forgerock.opendj + opendj-copyright-maven-plugin + ${opendj-copyright-maven-plugin.version} + + + + README + **/README + README.txt + **/README.txt + **/THIRDPARTYREADME.txt + legal-notices/CDDLv1_0.txt + **/tests/unit-tests-testng/resource/config-changes.ldif + + + + + + + org.forgerock.commons + forgerock-doc-maven-plugin + ${forgerock-doc-plugin.version} + + OpenDJ + ${project.version} + ${project.version} + UA-23412190-8 + + + + + + + + + precommit + + + + org.forgerock.opendj + opendj-copyright-maven-plugin + + + check-copyright + + check-copyright + + + + + + + + + + update-copyrights + + + + org.forgerock.opendj + opendj-copyright-maven-plugin + + + check-copyright + none + + check-copyright + + + + update-copyright + + update-copyright + + + + + + + + diff --git a/src/site/fml/faq.fml b/src/site/fml/faq.fml index ba39dd39a..e25559367 100644 --- a/src/site/fml/faq.fml +++ b/src/site/fml/faq.fml @@ -1,28 +1,18 @@ ,ou=People,dc=example,dc=com # and one big group, cn=Static,ou=Groups,dc=example,dc=com, including all users. diff --git a/src/site/resources/images/FR_plogo_org_FC_openDJ-302x86.png b/src/site/resources/images/FR_plogo_org_FC_openDJ-302x86.png new file mode 100644 index 000000000..289011723 Binary files /dev/null and b/src/site/resources/images/FR_plogo_org_FC_openDJ-302x86.png differ diff --git a/src/site/site.xml b/src/site/site.xml index 3c2c291d3..dbf9801b5 100644 --- a/src/site/site.xml +++ b/src/site/site.xml @@ -1,28 +1,18 @@ org.forgerock.commons forgerock-community-skin - 1.0.0 + 1.1.0-SNAPSHOT @@ -41,8 +31,8 @@ - - + + @@ -79,8 +69,9 @@ - - + + + @@ -115,7 +106,7 @@ UA-23412190-8 http://opendj.org/ - ./images/opendj-tagline-179x65.png + ./images/FR_plogo_org_FC_openDJ-302x86.png OpenDJ forgerock.org diff --git a/src/site/xdoc/404.xml b/src/site/xdoc/404.xml index 38b8c6889..551614ba7 100644 --- a/src/site/xdoc/404.xml +++ b/src/site/xdoc/404.xml @@ -1,28 +1,18 @@ This core documentation is in progress as part of the OpenDJ project.

    For completed, released documentation, see docs.forgerock.org.

    + href="https://backstage.forgerock.com/#!/docs/opendj" + >ForgeRock BackStage.

    Release Notes
    @@ -92,5 +82,32 @@
    HTML
    + +
    +

    + A snapshot of the OpenDJ LDAP Toolkit 3 documentation + is available for reference. + This documentation corresponds to the 3.0.0 Maven release, + which is available through the ForgeRock Maven repository. +

    + +

    + This documentation has been through the initial part of the review cycle, + but has not been through validation (QA) review. +

    + +
    +
    Release Notes
    +
    HTML (with link to PDF inside)
    + +
    SDK Developer Guide, with Tools Reference
    +
    HTML (with link to PDF inside)
    + +
    Javadoc
    +
    HTML
    +
    +
    diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml index cf2614386..954442f01 100644 --- a/src/site/xdoc/index.xml +++ b/src/site/xdoc/index.xml @@ -1,28 +1,18 @@ July 04, 2013. OpenDJ 2.6.0 is now available! OpenDJ 2.6.0 is an important release of ForgeRock's directory services product, with many key fixes and new features. See the Release + href="https://backstage.forgerock.com/#!/docs/opendj/2.6.0/release-notes">Release Notes for more. You can get the binaries from the ForgeRock OpenDJ download page.

    @@ -57,7 +47,7 @@ OpenDJ passwords, 30 additional new features and enhancements, and 150 bug fixes. Get OpenDJ 2.5.0 Xpress from the ForgeRock download page. Be sure to - read the Release Notes for additional information.

    February 27, 2012. OpenDJ 2.4.5 is now available. OpenDJ 2.4.5 is an