mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

matthew_swift
04.04.2009 4039d5a4652098e59a2eb14f6b2557235e993ab8
Remove API references to com.sun.opends.* classes from public API (except I18 related classes). Remove ordinals from messages as they are not needed in SDK. Make some exception constructors package private.
9 files modified
297 ■■■■ changed files
sdk/src/com/sun/opends/sdk/util/MessageDescriptor.java 120 ●●●● patch | view | raw | blame | history
sdk/src/com/sun/opends/sdk/util/StaticUtils.java 16 ●●●●● patch | view | raw | blame | history
sdk/src/com/sun/opends/sdk/util/SubstringReader.java 33 ●●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/AbstractAttribute.java 25 ●●●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/Attribute.java 53 ●●●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/CancelledException.java 2 ●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/ConnectionException.java 10 ●●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/OperationTimeoutException.java 2 ●●● patch | view | raw | blame | history
sdk/src/org/opends/sdk/Types.java 36 ●●●●● patch | view | raw | blame | history
sdk/src/com/sun/opends/sdk/util/MessageDescriptor.java
@@ -73,15 +73,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg0(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg0(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
      message = new Message(this);
      requiresFormat = containsArgumentLiterals(getFormatString());
    }
@@ -127,15 +124,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg1(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg1(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -186,15 +180,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg2(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg2(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -249,15 +240,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg3(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg3(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -317,15 +305,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg4(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg4(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -389,15 +374,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg5(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg5(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -465,15 +447,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg6(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg6(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -545,15 +524,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg7(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg7(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -629,15 +605,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg8(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg8(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -718,15 +691,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg9(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg9(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -811,15 +781,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg10(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg10(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -908,15 +875,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public Arg11(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public Arg11(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -987,15 +951,12 @@
     *          base of the backing resource bundle
     * @param key
     *          for accessing the format string from the resource bundle
     * @param ordinal
     *          of created messages
     * @param classLoader
     *          the class loader to be used to get the ResourceBundle
     */
    public ArgN(String rbBase, String key, int ordinal,
        ClassLoader classLoader)
    public ArgN(String rbBase, String key, ClassLoader classLoader)
    {
      super(rbBase, key, ordinal, classLoader);
      super(rbBase, key, classLoader);
    }
@@ -1051,7 +1012,7 @@
     */
    Raw(CharSequence formatString)
    {
      super(null, null, null, null);
      super(null, null, null);
      this.formatString = formatString != null ? formatString
          .toString() : "";
      this.requiresFormatter = this.formatString.matches(".*%.*");
@@ -1110,12 +1071,6 @@
  private final String key;
  /**
   * The value that makes a message unique among other messages having
   * the same severity and category. May be null for raw messages.
   */
  private final Integer ordinal;
  /**
   * The class loader to be used to retrieve the ResourceBundle. If null
   * the default class loader will be used.
   */
@@ -1126,22 +1081,6 @@
  /**
   * Obtains the ordinal value for this message which makes messages
   * unique among messages defined with the same category and severity.
   *
   * @return int ordinal value
   */
  public final int getOrdinal()
  {
    if (this.ordinal == null)
      return 0;
    else
      return this.ordinal;
  }
  /**
   * Returns the key for accessing the message template in a resource
   * bundle. May be null for raw messages.
   *
@@ -1255,17 +1194,14 @@
   *          string for accessing the underlying message bundle
   * @param key
   *          for accessing the format string from the message bundle
   * @param ordinal
   *          of any created message
   * @param classLoader
   *          the class loader to be used to get the ResourceBundle
   */
  private MessageDescriptor(String rbBase, String key, Integer ordinal,
  private MessageDescriptor(String rbBase, String key,
      ClassLoader classLoader)
  {
    this.rbBase = rbBase;
    this.key = key;
    this.ordinal = ordinal;
    this.classLoader = classLoader;
  }
sdk/src/com/sun/opends/sdk/util/StaticUtils.java
@@ -1006,21 +1006,7 @@
    if (t instanceof LocalizableException)
    {
      final LocalizableException ie = (LocalizableException) t;
      final StringBuilder message = new StringBuilder();
      message.append(ie.getMessageObject());
      message.append(" (id=");
      final Message ieMsg = ie.getMessageObject();
      if (ieMsg != null)
      {
        message.append(ieMsg.getDescriptor().getOrdinal());
      }
      else
      {
        message.append(MessageDescriptor.NULL_ID);
      }
      message.append(")");
      return Message.raw(message.toString());
      return ie.getMessageObject();
    }
    else if (t instanceof NullPointerException)
    {
sdk/src/com/sun/opends/sdk/util/SubstringReader.java
@@ -1,11 +1,34 @@
/*
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
 * 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
 * trunk/opends/resource/legal-notices/OpenDS.LICENSE.  If applicable,
 * add the following below this CDDL HEADER, 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 com.sun.opends.sdk.util;
/**
 * Created by IntelliJ IDEA.
 * User: boli
 * Date: Jul 13, 2009
 * Time: 3:11:50 PM
 * To change this template use File | Settings | File Templates.
 * A sub-string reader.
 */
public class SubstringReader
{
sdk/src/org/opends/sdk/AbstractAttribute.java
@@ -34,7 +34,6 @@
import org.opends.sdk.schema.AttributeType;
import org.opends.sdk.schema.MatchingRule;
import com.sun.opends.sdk.util.Function;
import com.sun.opends.sdk.util.Validator;
@@ -302,30 +301,6 @@
  /**
   * {@inheritDoc}
   */
  public <T> T firstValueAsObject(
      Function<? super ByteString, T, Void> type)
      throws NoSuchElementException
  {
    return type.apply(firstValue(), null);
  }
  /**
   * {@inheritDoc}
   */
  public <T, P> T firstValueAsObject(
      Function<? super ByteString, T, P> type, P p)
      throws NoSuchElementException
  {
    return type.apply(firstValue(), p);
  }
  /**
   * {@inheritDoc}
   */
  public String firstValueAsString() throws NoSuchElementException
  {
    return firstValue().toString();
sdk/src/org/opends/sdk/Attribute.java
@@ -34,8 +34,6 @@
import java.util.NoSuchElementException;
import java.util.Set;
import com.sun.opends.sdk.util.Function;
/**
@@ -240,57 +238,6 @@
  /**
   * Returns the first attribute value in this attribute converted to a
   * object of type {@code T} using the function {@code type}. Any
   * run-time exceptions thrown during the conversion will be passed
   * back to the caller (e.g. {@code IllegalArgumentException}).
   *
   * @param <T>
   *          The type of object to decode the first value as.
   * @param type
   *          The function to use for decoding the first attribute value
   *          as a type {@code T}.
   * @return The first attribute value in this attribute.
   * @throws NoSuchElementException
   *           If this attribute is empty.
   * @throws NullPointerException
   *           If {@code type} was {@code null}.
   */
  <T> T firstValueAsObject(Function<? super ByteString, T, Void> type)
      throws NoSuchElementException;
  /**
   * Returns the first attribute value in this attribute converted to a
   * object of type {@code T} using the function {@code type} and
   * passing parameter {@code p}. Any run-time exceptions thrown during
   * the conversion will be passed back to the caller (e.g. {@code
   * IllegalArgumentException}).
   *
   * @param <T>
   *          The type of object to decode the first value as.
   * @param <P>
   *          The type of the additional parameter to {@code type}'s
   *          {@code apply} method. Use {@link java.lang.Void} for
   *          functions that do not need an additional parameter.
   * @param type
   *          The function to use for decoding the first attribute value
   *          as a type {@code T}.
   * @param p
   *          The parameter to pass to {@code type}.
   * @return The first attribute value in this attribute.
   * @throws NoSuchElementException
   *           If this attribute is empty.
   * @throws NullPointerException
   *           If {@code type} was {@code null}.
   */
  <T, P> T firstValueAsObject(Function<? super ByteString, T, P> type,
      P p) throws NoSuchElementException;
  /**
   * Returns the first attribute value in this attribute decoded as a
   * UTF-8 string.
   *
sdk/src/org/opends/sdk/CancelledException.java
@@ -40,7 +40,7 @@
@SuppressWarnings("serial")
public class CancelledException extends ErrorResultException
{
  public CancelledException(Result result)
  CancelledException(Result result)
  {
    super(result);
  }
sdk/src/org/opends/sdk/ConnectionException.java
@@ -27,15 +27,21 @@
package org.opends.sdk;
import org.opends.sdk.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 ErrorResultException {
  public ConnectionException(Result result) {
public class ConnectionException extends ErrorResultException
{
  ConnectionException(Result result)
  {
    super(result);
  }
}
sdk/src/org/opends/sdk/OperationTimeoutException.java
@@ -41,7 +41,7 @@
@SuppressWarnings("serial")
public class OperationTimeoutException extends ErrorResultException
{
  public OperationTimeoutException(Result result)
  OperationTimeoutException(Result result)
  {
    super(result);
  }
sdk/src/org/opends/sdk/Types.java
@@ -214,24 +214,6 @@
    public <T> T firstValueAsObject(
        Function<? super ByteString, T, Void> type)
        throws NoSuchElementException
    {
      return attribute.firstValueAsObject(type);
    }
    public <T, P> T firstValueAsObject(
        Function<? super ByteString, T, P> type, P p)
        throws NoSuchElementException
    {
      return attribute.firstValueAsObject(type, p);
    }
    public String firstValueAsString() throws NoSuchElementException
    {
      return attribute.firstValueAsString();
@@ -433,24 +415,6 @@
    public <T> T firstValueAsObject(
        Function<? super ByteString, T, Void> type)
        throws NoSuchElementException
    {
      return attribute.firstValueAsObject(type);
    }
    public <T, P> T firstValueAsObject(
        Function<? super ByteString, T, P> type, P p)
        throws NoSuchElementException
    {
      return attribute.firstValueAsObject(type, p);
    }
    public String firstValueAsString() throws NoSuchElementException
    {
      return attribute.firstValueAsString();