From d03839909ce214be705a1abfa9a7cec9bc293e07 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 04 Dec 2009 17:04:27 +0000
Subject: [PATCH] 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.
---
opendj-sdk/sdk/src/org/opends/sdk/AbstractAttribute.java | 25 ----
opendj-sdk/sdk/src/org/opends/sdk/CancelledException.java | 2
opendj-sdk/sdk/src/com/sun/opends/sdk/util/StaticUtils.java | 16 --
opendj-sdk/sdk/src/org/opends/sdk/ConnectionException.java | 10 +
opendj-sdk/sdk/src/org/opends/sdk/Types.java | 36 ------
opendj-sdk/sdk/src/org/opends/sdk/OperationTimeoutException.java | 2
opendj-sdk/sdk/src/com/sun/opends/sdk/util/MessageDescriptor.java | 120 ++++---------------
opendj-sdk/sdk/src/org/opends/sdk/Attribute.java | 53 --------
opendj-sdk/sdk/src/com/sun/opends/sdk/util/SubstringReader.java | 37 +++++-
9 files changed, 69 insertions(+), 232 deletions(-)
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/MessageDescriptor.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/util/MessageDescriptor.java
index 7dc9270..1863f96 100755
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/MessageDescriptor.java
+++ b/opendj-sdk/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;
}
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StaticUtils.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StaticUtils.java
index 818389e..eff368a 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/StaticUtils.java
+++ b/opendj-sdk/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)
{
diff --git a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/SubstringReader.java b/opendj-sdk/sdk/src/com/sun/opends/sdk/util/SubstringReader.java
index 20d2a26..8dec1fd 100644
--- a/opendj-sdk/sdk/src/com/sun/opends/sdk/util/SubstringReader.java
+++ b/opendj-sdk/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
{
@@ -22,7 +45,7 @@
/**
* Attemps to read a substring of the specified length.
- *
+ *
* @param length The number of characters to read.
* @return The substring.
*/
@@ -68,7 +91,7 @@
*/
public void reset()
{
- pos = mark;
+ pos = mark;
}
public int skipWhitespaces()
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/AbstractAttribute.java b/opendj-sdk/sdk/src/org/opends/sdk/AbstractAttribute.java
index f903c3e..47f1a1f 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/AbstractAttribute.java
+++ b/opendj-sdk/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();
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/Attribute.java b/opendj-sdk/sdk/src/org/opends/sdk/Attribute.java
index df27016..b070f70 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/Attribute.java
+++ b/opendj-sdk/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.
*
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/CancelledException.java b/opendj-sdk/sdk/src/org/opends/sdk/CancelledException.java
index e3c1618..0119704 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/CancelledException.java
+++ b/opendj-sdk/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);
}
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/ConnectionException.java b/opendj-sdk/sdk/src/org/opends/sdk/ConnectionException.java
index 20e8ec9..8f7e5d9 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/ConnectionException.java
+++ b/opendj-sdk/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);
}
}
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/OperationTimeoutException.java b/opendj-sdk/sdk/src/org/opends/sdk/OperationTimeoutException.java
index ac9bee2..cff5dc9 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/OperationTimeoutException.java
+++ b/opendj-sdk/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);
}
diff --git a/opendj-sdk/sdk/src/org/opends/sdk/Types.java b/opendj-sdk/sdk/src/org/opends/sdk/Types.java
index a2ee3fa..81c65a6 100644
--- a/opendj-sdk/sdk/src/org/opends/sdk/Types.java
+++ b/opendj-sdk/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();
--
Gitblit v1.10.0