You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2006/08/27 20:26:28 UTC
svn commit: r437433 [5/17] - in
/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src:
main/java/javax/naming/ main/java/javax/naming/directory/
main/java/javax/naming/event/ main/java/javax/naming/ldap/
main/java/javax/naming/spi/ main/java/org/...
Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java?rev=437433&r1=437432&r2=437433&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java Sun Aug 27 11:26:20 2006
@@ -1,379 +1,379 @@
-/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
- *
- * 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.
- */
-
-
-package javax.naming;
-
-import java.io.PrintStream;
-import java.io.PrintWriter;
-
-/**
- * A <code>NamingException</code> is the basic exception thrown by the naming
- * classes. There are numerous subclasses of it which are used to further
- * describe the type of error encountered.
- * <p>
- * A <code>NamingException</code> can hold information relating to an error
- * encountered when trying to resolve a <code>Name</code>. It holds the two
- * parts of the original name, firstly the part of the name which was
- * successfully resolved, secondly the part of the name which could not be
- * resolved.</p>
- * <p>
- * For example:<br />
- * ------------<br />
- * The resolved name could be something like http://www.apache.org where jndi has
- * successfully resolved the DNS name.
- * The part of the name which could not be resolved could be something like
- * java/classes.index.html where jndi could not resolve the file name.</p>
- * <p>
- * It can also refer to the object that is associated with the resolved name.</p>
- * <p>
- * Additionaly it can refer to another exception, which may be the root cause
- * of this exception.</p>
- * <p>
- * Multithreaded access to a <code>NamingException</code> instance is only
- * safe when client code locks the object first.</p>
- *
- */
-public class NamingException extends Exception {
-
- /*
- * This constant is used during deserialization to check the J2SE version
- * which created the serialized object.
- */
- private static final long serialVersionUID = -1299181962103167177L;
-
- /*
- * -------------------------------------------------------------------
- * Instance variables
- * -------------------------------------------------------------------
- */
-
- /**
- * The resolved name. This may be null.
- */
- protected Name resolvedName = null;
-
- /**
- * The remaining name. This may be null.
- */
- protected Name remainingName = null;
-
- /**
- * The resolved object. This may be null.
- */
- protected Object resolvedObj = null;
-
- /**
- * The exception that caused this NamingException to be raised. This may be null.
- */
- protected Throwable rootException = null;
-
- /*
- * -------------------------------------------------------------------
- * Constructors
- * -------------------------------------------------------------------
- */
-
- /**
- * Constructs a <code>NamingException</code> instance
- * with all data initialized to null.
- */
- public NamingException() {
- super();
- }
-
- /**
- * Constructs a <code>NamingException</code> instance
- * with the specified message. All other fields are initialized to null.
- *
- * @param s The detail message for the exception. It may be null.
- */
- public NamingException(String s) {
- super(s);
- }
-
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
- /**
- * Returns the message passed in as a param to the constructor.
- * This may be null.
- *
- * @return the message passed in as a param to the constructor.
- */
- public String getExplanation() {
- return super.getMessage();
- }
-
- /**
- * Appends the supplied string to the <code>Name</code> held as the
- * remaining name. The string may be null.
- *
- * @param s the string to append to the remaining Name.
- * @throws IllegalArgumentException if appending the supplied
- * String s causes the name to become invalid.
- */
- public void appendRemainingComponent(String s) {
- if (null != s) {
- try {
- if (null == remainingName) {
- remainingName = new CompositeName(""); //$NON-NLS-1$
- }
- remainingName = remainingName.add(s);
- } catch (InvalidNameException e) {
- throw new IllegalArgumentException("Found invalid name, reason: " + e); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Returns the remaining name. This may be null.
- *
- * @return the remaining name. This may be null.
- */
- public Name getRemainingName() {
- return remainingName;
- }
-
- /**
- * Returns the resolved name. This may be null.
- *
- * @return the resolved name. This may be null.
- */
- public Name getResolvedName() {
- return resolvedName;
- }
-
- /**
- * Returns the resolved object. This may be null.
- *
- * @return the resolved object. This may be null.
- */
- public Object getResolvedObj() {
- return resolvedObj;
- }
-
- /**
- * Sets the resolved name to the specified name. This may be null.
- * The resolved name details must not change even if the original
- * <code>Name</code> itself changes.
- *
- * @param name the resolved name to set.
- */
- public void setResolvedName(Name name) {
- resolvedName = null == name ? null : (Name) name.clone();
- }
-
- /**
- * Sets the remaining name to the specified n. This may be null.
- * The remaining name details must not change even if the original
- * <code>Name</code> itself changes.
- *
- * @param name the remaining name to set.
- */
- public void setRemainingName(Name name) {
- remainingName = null == name ? null : (Name) name.clone();
- }
-
- /**
- * Sets the resolved object to the specified o. This may be null.
- *
- * @param o the resolved object to set.
- */
- public void setResolvedObj(Object o) {
- resolvedObj = o;
- }
-
- /**
- * Appends the elements of the supplied <code>Name</code> n to the
- * <code>Name</code> held as the remaining name. The <code>Name</code> n
- * may be null or may be empty.
- *
- * @param n the name to append to the remaining name.
- * @throws IllegalArgumentException if appending the supplied
- * <code>Name</code> n causes the name to become invalid.
- */
- public void appendRemainingName(Name n) {
- if (null != n) {
- try {
- if (null == remainingName) {
- remainingName = new CompositeName(""); //$NON-NLS-1$
- }
- remainingName = remainingName.addAll(n);
- } catch (InvalidNameException e) {
- throw new IllegalArgumentException("Found invalid name, reason: " + e); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Returns the exception which caused this <code>NamingException</code>
- * which may be null.
- *
- * @return the exception which caused this <code>NamingException</code>
- * which may be null.
- */
- public Throwable getRootCause() {
- return rootException;
- }
-
- /**
- * Sets the exception that caused this <code>NamingException</code>.
- * It may be null.
- * Ignore the supplied parameter if it is actually this exception.
- *
- * @param t the exception that caused this <code>NamingException</code>.
- */
- public void setRootCause(Throwable t) {
- if (t != this) {
- rootException = t;
- }
- }
-
- /**
- * Returns the same details as the <code>toString()</code> method except
- * that, if the <code>flag</code> is set to true, then details of the
- * resolved object are also appended to the string.
- * The actual format can be decided by the implementor.
- *
- * @param flag Indicates if the resolved object need to be returned.
- *
- * @return the string representation of this <code>NamingException</code>.
- */
- public String toString(boolean flag) {
- return toStringImpl(flag);
- }
-
- /*
- * -------------------------------------------------------------------
- * Methods override parent class Exception
- * -------------------------------------------------------------------
- */
-
- /**
- * If there is a root exception associated with this
- * <code>NamingException</code> then first print the class name and message
- * of this <code>NamingException</code>, followed by the text
- * ". The stack trace of the root exception is: ", followed by the stack
- * trace of the exception which caused this exception.
- * <p>
- * If there is no root exception associated with this
- * <code>NamingException</code> then print the stack trace of this
- * <code>NamingException</code>.</p>
- * <p>
- * The output from this goes to <code>System.err</code>.</p>
- */
- public void printStackTrace() {
- if (null != rootException) {
- System.err.print(super.toString());
- System.err.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
- rootException.printStackTrace();
- } else {
- super.printStackTrace();
- }
- }
-
- /**
- * Performs the same as <code>printStackTrace()</code> except the output
- * goes to the specified <code>PrintStream</code> p.
- *
- * @param p the <code>PrintStream</code> to which the stack trace is
- * printed.
- */
- public void printStackTrace(PrintStream p) {
- if (null != rootException) {
- p.print(super.toString());
- p.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
- rootException.printStackTrace(p);
- } else {
- super.printStackTrace(p);
- }
- }
-
- /**
- * Performs the same as <code>printStackTrace()</code> except the output
- * goes to the specified <code>PrintWriter</code> p.
- *
- * @param p the <code>PrintWrite</code> to which the stack trace is
- * printed.
- */
- public void printStackTrace(PrintWriter p) {
- if (null != rootException) {
- p.print(super.toString());
- p.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
- rootException.printStackTrace(p);
- } else {
- super.printStackTrace(p);
- }
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Throwable#getCause()
- */
- public Throwable getCause() {
- return super.getCause();
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Throwable#initCause(Throwable)
- */
- public Throwable initCause(Throwable cause) {
- return super.initCause(cause);
- }
-
- /*
- * -------------------------------------------------------------------
- * Methods override parent class Object
- * -------------------------------------------------------------------
- */
-
- /**
- * Returns the string representation of this <code>NamingException</code>.
- * The string contains the string representation of this exception together
- * with details of the exception which caused this and any remaining
- * portion of the <code>Name</code>.
- * <p>
- * The actual format can be decided by the implementor.</p>
- *
- * @return the string
- */
- public String toString() {
- return this.toStringImpl(false);
- }
-
- private String toStringImpl(boolean flag) {
- StringBuffer sb = new StringBuffer();
- sb.append(super.toString());
- if (null != rootException) {
- sb.append(" [Root exception is ").append(rootException.toString()).append( //$NON-NLS-1$
- "]"); //$NON-NLS-1$
- }
- if (null != remainingName) {
- sb.append("; Remaining name: '").append(remainingName.toString()).append("'"); //$NON-NLS-1$//$NON-NLS-2$
- }
- if (flag && null != resolvedObj) {
- sb.append("; Resolved object: '").append(resolvedObj.toString()).append("'"); //$NON-NLS-1$ //$NON-NLS-2$
- }
- return sb.toString();
- }
-
-}
-
-
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+
+package javax.naming;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+
+/**
+ * A <code>NamingException</code> is the basic exception thrown by the naming
+ * classes. There are numerous subclasses of it which are used to further
+ * describe the type of error encountered.
+ * <p>
+ * A <code>NamingException</code> can hold information relating to an error
+ * encountered when trying to resolve a <code>Name</code>. It holds the two
+ * parts of the original name, firstly the part of the name which was
+ * successfully resolved, secondly the part of the name which could not be
+ * resolved.</p>
+ * <p>
+ * For example:<br />
+ * ------------<br />
+ * The resolved name could be something like http://www.apache.org where jndi has
+ * successfully resolved the DNS name.
+ * The part of the name which could not be resolved could be something like
+ * java/classes.index.html where jndi could not resolve the file name.</p>
+ * <p>
+ * It can also refer to the object that is associated with the resolved name.</p>
+ * <p>
+ * Additionaly it can refer to another exception, which may be the root cause
+ * of this exception.</p>
+ * <p>
+ * Multithreaded access to a <code>NamingException</code> instance is only
+ * safe when client code locks the object first.</p>
+ *
+ */
+public class NamingException extends Exception {
+
+ /*
+ * This constant is used during deserialization to check the J2SE version
+ * which created the serialized object.
+ */
+ private static final long serialVersionUID = -1299181962103167177L;
+
+ /*
+ * -------------------------------------------------------------------
+ * Instance variables
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * The resolved name. This may be null.
+ */
+ protected Name resolvedName = null;
+
+ /**
+ * The remaining name. This may be null.
+ */
+ protected Name remainingName = null;
+
+ /**
+ * The resolved object. This may be null.
+ */
+ protected Object resolvedObj = null;
+
+ /**
+ * The exception that caused this NamingException to be raised. This may be null.
+ */
+ protected Throwable rootException = null;
+
+ /*
+ * -------------------------------------------------------------------
+ * Constructors
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Constructs a <code>NamingException</code> instance
+ * with all data initialized to null.
+ */
+ public NamingException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>NamingException</code> instance
+ * with the specified message. All other fields are initialized to null.
+ *
+ * @param s The detail message for the exception. It may be null.
+ */
+ public NamingException(String s) {
+ super(s);
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the message passed in as a param to the constructor.
+ * This may be null.
+ *
+ * @return the message passed in as a param to the constructor.
+ */
+ public String getExplanation() {
+ return super.getMessage();
+ }
+
+ /**
+ * Appends the supplied string to the <code>Name</code> held as the
+ * remaining name. The string may be null.
+ *
+ * @param s the string to append to the remaining Name.
+ * @throws IllegalArgumentException if appending the supplied
+ * String s causes the name to become invalid.
+ */
+ public void appendRemainingComponent(String s) {
+ if (null != s) {
+ try {
+ if (null == remainingName) {
+ remainingName = new CompositeName(""); //$NON-NLS-1$
+ }
+ remainingName = remainingName.add(s);
+ } catch (InvalidNameException e) {
+ throw new IllegalArgumentException("Found invalid name, reason: " + e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Returns the remaining name. This may be null.
+ *
+ * @return the remaining name. This may be null.
+ */
+ public Name getRemainingName() {
+ return remainingName;
+ }
+
+ /**
+ * Returns the resolved name. This may be null.
+ *
+ * @return the resolved name. This may be null.
+ */
+ public Name getResolvedName() {
+ return resolvedName;
+ }
+
+ /**
+ * Returns the resolved object. This may be null.
+ *
+ * @return the resolved object. This may be null.
+ */
+ public Object getResolvedObj() {
+ return resolvedObj;
+ }
+
+ /**
+ * Sets the resolved name to the specified name. This may be null.
+ * The resolved name details must not change even if the original
+ * <code>Name</code> itself changes.
+ *
+ * @param name the resolved name to set.
+ */
+ public void setResolvedName(Name name) {
+ resolvedName = null == name ? null : (Name) name.clone();
+ }
+
+ /**
+ * Sets the remaining name to the specified n. This may be null.
+ * The remaining name details must not change even if the original
+ * <code>Name</code> itself changes.
+ *
+ * @param name the remaining name to set.
+ */
+ public void setRemainingName(Name name) {
+ remainingName = null == name ? null : (Name) name.clone();
+ }
+
+ /**
+ * Sets the resolved object to the specified o. This may be null.
+ *
+ * @param o the resolved object to set.
+ */
+ public void setResolvedObj(Object o) {
+ resolvedObj = o;
+ }
+
+ /**
+ * Appends the elements of the supplied <code>Name</code> n to the
+ * <code>Name</code> held as the remaining name. The <code>Name</code> n
+ * may be null or may be empty.
+ *
+ * @param n the name to append to the remaining name.
+ * @throws IllegalArgumentException if appending the supplied
+ * <code>Name</code> n causes the name to become invalid.
+ */
+ public void appendRemainingName(Name n) {
+ if (null != n) {
+ try {
+ if (null == remainingName) {
+ remainingName = new CompositeName(""); //$NON-NLS-1$
+ }
+ remainingName = remainingName.addAll(n);
+ } catch (InvalidNameException e) {
+ throw new IllegalArgumentException("Found invalid name, reason: " + e); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ * Returns the exception which caused this <code>NamingException</code>
+ * which may be null.
+ *
+ * @return the exception which caused this <code>NamingException</code>
+ * which may be null.
+ */
+ public Throwable getRootCause() {
+ return rootException;
+ }
+
+ /**
+ * Sets the exception that caused this <code>NamingException</code>.
+ * It may be null.
+ * Ignore the supplied parameter if it is actually this exception.
+ *
+ * @param t the exception that caused this <code>NamingException</code>.
+ */
+ public void setRootCause(Throwable t) {
+ if (t != this) {
+ rootException = t;
+ }
+ }
+
+ /**
+ * Returns the same details as the <code>toString()</code> method except
+ * that, if the <code>flag</code> is set to true, then details of the
+ * resolved object are also appended to the string.
+ * The actual format can be decided by the implementor.
+ *
+ * @param flag Indicates if the resolved object need to be returned.
+ *
+ * @return the string representation of this <code>NamingException</code>.
+ */
+ public String toString(boolean flag) {
+ return toStringImpl(flag);
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods override parent class Exception
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * If there is a root exception associated with this
+ * <code>NamingException</code> then first print the class name and message
+ * of this <code>NamingException</code>, followed by the text
+ * ". The stack trace of the root exception is: ", followed by the stack
+ * trace of the exception which caused this exception.
+ * <p>
+ * If there is no root exception associated with this
+ * <code>NamingException</code> then print the stack trace of this
+ * <code>NamingException</code>.</p>
+ * <p>
+ * The output from this goes to <code>System.err</code>.</p>
+ */
+ public void printStackTrace() {
+ if (null != rootException) {
+ System.err.print(super.toString());
+ System.err.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
+ rootException.printStackTrace();
+ } else {
+ super.printStackTrace();
+ }
+ }
+
+ /**
+ * Performs the same as <code>printStackTrace()</code> except the output
+ * goes to the specified <code>PrintStream</code> p.
+ *
+ * @param p the <code>PrintStream</code> to which the stack trace is
+ * printed.
+ */
+ public void printStackTrace(PrintStream p) {
+ if (null != rootException) {
+ p.print(super.toString());
+ p.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
+ rootException.printStackTrace(p);
+ } else {
+ super.printStackTrace(p);
+ }
+ }
+
+ /**
+ * Performs the same as <code>printStackTrace()</code> except the output
+ * goes to the specified <code>PrintWriter</code> p.
+ *
+ * @param p the <code>PrintWrite</code> to which the stack trace is
+ * printed.
+ */
+ public void printStackTrace(PrintWriter p) {
+ if (null != rootException) {
+ p.print(super.toString());
+ p.print(". The stack trace of the root exception is: "); //$NON-NLS-1$
+ rootException.printStackTrace(p);
+ } else {
+ super.printStackTrace(p);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Throwable#getCause()
+ */
+ public Throwable getCause() {
+ return super.getCause();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see java.lang.Throwable#initCause(Throwable)
+ */
+ public Throwable initCause(Throwable cause) {
+ return super.initCause(cause);
+ }
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods override parent class Object
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns the string representation of this <code>NamingException</code>.
+ * The string contains the string representation of this exception together
+ * with details of the exception which caused this and any remaining
+ * portion of the <code>Name</code>.
+ * <p>
+ * The actual format can be decided by the implementor.</p>
+ *
+ * @return the string
+ */
+ public String toString() {
+ return this.toStringImpl(false);
+ }
+
+ private String toStringImpl(boolean flag) {
+ StringBuffer sb = new StringBuffer();
+ sb.append(super.toString());
+ if (null != rootException) {
+ sb.append(" [Root exception is ").append(rootException.toString()).append( //$NON-NLS-1$
+ "]"); //$NON-NLS-1$
+ }
+ if (null != remainingName) {
+ sb.append("; Remaining name: '").append(remainingName.toString()).append("'"); //$NON-NLS-1$//$NON-NLS-2$
+ }
+ if (flag && null != resolvedObj) {
+ sb.append("; Resolved object: '").append(resolvedObj.toString()).append("'"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ return sb.toString();
+ }
+
+}
+
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NamingSecurityException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoInitialContextException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NoPermissionException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/NotContextException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/OperationNotSupportedException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/PartialResultException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/RefAddr.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Reference.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/Referenceable.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ReferralException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/ServiceUnavailableException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/SizeLimitExceededException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/StringRefAddr.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/TimeLimitExceededException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java?rev=437433&r1=437432&r2=437433&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java Sun Aug 27 11:26:20 2006
@@ -1,293 +1,293 @@
-/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
- *
- * 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.
- */
-
-
-package javax.naming.directory;
-
-import java.io.Serializable;
-import javax.naming.NamingEnumeration;
-import javax.naming.NamingException;
-import javax.naming.directory.DirContext;
-
-/**
- * This interface defines the valid operations on a particular attribute of a
- * directory entry.
- * <p>
- * An attribute can have zero or more values. The value may be null.</p>
- * <p>
- * When there are multiple values for a particular attribute, the collection of
- * values may be specifically ordered or unordered. This interface provides a
- * method for determining whether the order is maintained.</p>
- * <p>
- * If the values of an attribute are ordered, then duplicates are allowed. If
- * the values are unordered then duplicates are not allowed.</p>
- * <p>
- * If the values are unordered then the indexed operations work as if the values
- * added previously to the attribute had been done using ordered semantics. For
- * example, if the values "a", "b" and "c" were previously added to an unordered
- * attribute using "<code>add("a"); add("b"); add("c");</code>", it is
- * equivalent to adding the same objects to an ordered attribute using
- * "<code>add(0,"a"); add(1,"b"); add(2,"c");</code>". In this case, if we do
- * "<code>remove(1)</code>" on the unordered list, the value "b" is removed,
- * changing the index of "c" to 1.</p>
- * <p>
- * Multiple null values can be added to an attribute. It is not the same as
- * having no values on an attribute. If a null value is added to an unordered
- * attribute which already has a null value, the <code>add</code> method has no
- * effect.</p>
- * <p>
- * A directory may optionally provide information about the syntax of an
- * attribute's value via a schema. The methods <code>getAttributeDefinition</code>
- * and <code>getAttributeSyntaxDefinition</code> return the schema definitions
- * if they exist.</p>
- * <p>
- * Note that updates to the attribute via ths interface do not affect the
- * directory directly. The only mechanism for modifying the directory is
- * through the {@link DirContext}.</p>
- * <p>
- * Concrete implementations of this <code>Attribute</code> interface may be
- * either static or dynamic, and this interface does not make any distinction
- * between the two types. A static attribute implementation retrieves its value
- * from the directory once and stores it locally, a dynamic attribute
- * implementation will go back to the directory for each request.</p>
- *
- *
- */
-public interface Attribute extends Cloneable, Serializable {
-
- /*
- * -------------------------------------------------------------------
- * Constants
- * -------------------------------------------------------------------
- */
-
- /*
- * This constant is used during deserialization to check the J2SE version which
- * created the serialized object.
- */
- static final long serialVersionUID = 0x78d7ee3675a55244L; //J2SE 1.4.2
-
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
- /**
- * Adds a value at the specified index.
- * The index is only meaningful if the values are ordered. If there are
- * already values at this index and above, they are moved up one position.
- * <p>
- * It is permissible to use this method when the values are not ordered but
- * in this case, if a value equals to <code>val</code> already exists then
- * this method throws an <code>IllegalStateException</code> because
- * duplicates are not allowed.</p>
- * <p>
- * The permitted range for index is 0 <= index <= <code>size()</code>.
- * The range allows the list to grow by one. If the index is outside this
- * range this method throws an <code>IndexOutOfBoundsException</code>.</p>
- *
- * @param index the position index
- * @param val a new value to be added which may be null
- * @throws IllegalStateException
- * If the new value equals to an existing value in
- * an unordered <code>Attribute</code>.
- * @throws IndexOutOfBoundsException
- * If the index is invalid.
- */
- void add(int index, Object val);
-
- /**
- * Adds a value to this attribute.
- * For unordered attribute values this method adds the new value unless the
- * value is already present. If the new value is already present in
- * unordered attribute values, the method has no effect.
- * <p>
- * For ordered attribute values, the new value is added at the end of list
- * of values.</p>
- * <p>
- * This method returns true or false to indicate whether a value was added.</p>
- *
- * @param val a new value to be added which may be null
- * @return true if a value was added, otherwise false
- */
- boolean add(Object val);
-
- /**
- * Clears all values of this attribute.
- */
- void clear();
-
- /**
- * Returns a deep copy of the attribute containing all the same values.
- * The values are not cloned.
- *
- * @return a deep clone of this attribute
- */
- Object clone();
-
- /**
- * Inidicates whether the specified value is one of the attribute's values.
- *
- * @param val the value which may be null
- * @return true if this attribute contains the value,
- * otherwise false
- */
- boolean contains(Object val);
-
- /**
- * Gets a value of this attribute.
- * For unordered values, returns any of the values. For ordered values,
- * returns the first. <code>null</code> is a valid value.
- * <p>
- * If the attribute has no values this method throws
- * <code>NoSuchElementException</code>.</p>
-
- * @return a value of this attribute
- * @throws NamingException If the attribute has no value.
- */
- Object get() throws NamingException;
-
- /**
- * Returns the value at the specified index, even for unordered values.
- * This method throws <code>IndexOutOfBoundsException</code> if the index is
- * outside the valid range 0 <= index < <code>size()</code>.
- *
- * <p>
- * If the attribute has no values this method throws
- * <code>NoSuchElementException</code>.</p>
- *
- * @param index the position index
- * @return the value at the specified index
- * @throws IndexOutOfBoundsException
- * If the index is invalid.
- * @throws NamingException If the attribute has no value.
- */
- Object get(int index) throws NamingException;
-
- /**
- * Returns an enumeration of all the attribute's values.
- * The enumeration is ordered if the values are.
- * <p>
- * The effect on the returned enumeration of adding or removing values of
- * the attribute is not specified.</p>
- * <p>
- * This method will throw any <code>NamingException</code> that occurs.</p>
- *
- * @return an enumeration of all values of the attribute
- * @throws NamingException If any <code>NamingException</code> occurs.
- */
- NamingEnumeration<?> getAll() throws NamingException;
-
- /**
- * Returns the attribute's schema definition.
- * If this operation is not supported, an <code>
- * OperationNotSupportedException</code> is thrown. If the implementation
- * supports schemas but no schema is set, it is valid to return null.
- * <p>
- * This method will throw any <code>NamingException</code> that occurs.</p>
- *
- * @return the schema definitions if they exist
- * @throws NamingException If any <code>NamingException</code> occurs.
- */
- DirContext getAttributeDefinition() throws NamingException;
-
- /**
- * Returns the attribute's syntax definition.
- * If this operation is not supported, an <code>
- * OperationNotSupportedException</code> is thrown. If the implementation
- * supports syntax definitions but no syntax definition is set, it is valid
- * to return null.
- * <p>
- * This method will throw any <code>NamingException</code> that occurs.</p>
- *
- * @return the syntax definitions if they exist
- * @throws NamingException If any <code>NamingException</code> occurs.
- */
- DirContext getAttributeSyntaxDefinition() throws NamingException;
-
- /**
- * Returns the identity of this attribute.
- * This method is not expected to return null.
- *
- * @return the ID of this attribute
- */
- String getID();
-
- /**
- * Indicates whether the values of this attribute are ordered or not.
- *
- * @return true if the values of this attribute are
- * ordered, otherwise false
- */
- boolean isOrdered();
-
- /**
- * Removes the values at the specified index, even for unordered values.
- * Values at higher indexes move one position lower.
- * <p>
- * If the index is outside the valid range 0 <= index < <code>size()</code>
- * this method throws an <code>IndexOutOfBoundsException</code>.</p>
- *
- * @param index the position index
- * @return the removed value
- * @throws IndexOutOfBoundsException
- * If the index is invalid.
- */
- Object remove(int index);
-
- /**
- * Removes a value that is equal to the given value.
- * There may be more than one match in ordered value, in which case the
- * equal value with the lowest index is removed. After an ordered value is
- * removed, values at higher indexes move one position lower.
- * <p>
- * Returns true if a value is removed. If there is no value equal to <code>
- * val</code> this method simply returns false.</p>
- *
- * @param val the value to be removed
- * @return true if the value is removed, otherwise false
- */
- boolean remove(Object val);
-
- /**
- * Replaces the value at the specified index with the given value.
- * The old value (which may be null) is returned.
- * <p>
- * If the values are unordered and the given value is already present this
- * method throws an <code>IllegalStateException</code>.</p>
- * <p>
- * The valid range for the index is 0 <= index < <code>size()</code>.
- * This method throws an <code>IndexOutOfBoundsException</code> if the index
- * is outside this range.</p>
- *
- * @param index the position index
- * @param val the new value
- * @return the original value at the specified index
- * @throws IndexOutOfBoundsException
- * If the index is invalid.
- */
- Object set(int index, Object val);
-
- /**
- * Gets the count of the values in this attribute.
- *
- * @return the count of the values in this attribute
- */
- int size();
-
-}
-
-
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+
+package javax.naming.directory;
+
+import java.io.Serializable;
+import javax.naming.NamingEnumeration;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+
+/**
+ * This interface defines the valid operations on a particular attribute of a
+ * directory entry.
+ * <p>
+ * An attribute can have zero or more values. The value may be null.</p>
+ * <p>
+ * When there are multiple values for a particular attribute, the collection of
+ * values may be specifically ordered or unordered. This interface provides a
+ * method for determining whether the order is maintained.</p>
+ * <p>
+ * If the values of an attribute are ordered, then duplicates are allowed. If
+ * the values are unordered then duplicates are not allowed.</p>
+ * <p>
+ * If the values are unordered then the indexed operations work as if the values
+ * added previously to the attribute had been done using ordered semantics. For
+ * example, if the values "a", "b" and "c" were previously added to an unordered
+ * attribute using "<code>add("a"); add("b"); add("c");</code>", it is
+ * equivalent to adding the same objects to an ordered attribute using
+ * "<code>add(0,"a"); add(1,"b"); add(2,"c");</code>". In this case, if we do
+ * "<code>remove(1)</code>" on the unordered list, the value "b" is removed,
+ * changing the index of "c" to 1.</p>
+ * <p>
+ * Multiple null values can be added to an attribute. It is not the same as
+ * having no values on an attribute. If a null value is added to an unordered
+ * attribute which already has a null value, the <code>add</code> method has no
+ * effect.</p>
+ * <p>
+ * A directory may optionally provide information about the syntax of an
+ * attribute's value via a schema. The methods <code>getAttributeDefinition</code>
+ * and <code>getAttributeSyntaxDefinition</code> return the schema definitions
+ * if they exist.</p>
+ * <p>
+ * Note that updates to the attribute via ths interface do not affect the
+ * directory directly. The only mechanism for modifying the directory is
+ * through the {@link DirContext}.</p>
+ * <p>
+ * Concrete implementations of this <code>Attribute</code> interface may be
+ * either static or dynamic, and this interface does not make any distinction
+ * between the two types. A static attribute implementation retrieves its value
+ * from the directory once and stores it locally, a dynamic attribute
+ * implementation will go back to the directory for each request.</p>
+ *
+ *
+ */
+public interface Attribute extends Cloneable, Serializable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Constants
+ * -------------------------------------------------------------------
+ */
+
+ /*
+ * This constant is used during deserialization to check the J2SE version which
+ * created the serialized object.
+ */
+ static final long serialVersionUID = 0x78d7ee3675a55244L; //J2SE 1.4.2
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Adds a value at the specified index.
+ * The index is only meaningful if the values are ordered. If there are
+ * already values at this index and above, they are moved up one position.
+ * <p>
+ * It is permissible to use this method when the values are not ordered but
+ * in this case, if a value equals to <code>val</code> already exists then
+ * this method throws an <code>IllegalStateException</code> because
+ * duplicates are not allowed.</p>
+ * <p>
+ * The permitted range for index is 0 <= index <= <code>size()</code>.
+ * The range allows the list to grow by one. If the index is outside this
+ * range this method throws an <code>IndexOutOfBoundsException</code>.</p>
+ *
+ * @param index the position index
+ * @param val a new value to be added which may be null
+ * @throws IllegalStateException
+ * If the new value equals to an existing value in
+ * an unordered <code>Attribute</code>.
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ void add(int index, Object val);
+
+ /**
+ * Adds a value to this attribute.
+ * For unordered attribute values this method adds the new value unless the
+ * value is already present. If the new value is already present in
+ * unordered attribute values, the method has no effect.
+ * <p>
+ * For ordered attribute values, the new value is added at the end of list
+ * of values.</p>
+ * <p>
+ * This method returns true or false to indicate whether a value was added.</p>
+ *
+ * @param val a new value to be added which may be null
+ * @return true if a value was added, otherwise false
+ */
+ boolean add(Object val);
+
+ /**
+ * Clears all values of this attribute.
+ */
+ void clear();
+
+ /**
+ * Returns a deep copy of the attribute containing all the same values.
+ * The values are not cloned.
+ *
+ * @return a deep clone of this attribute
+ */
+ Object clone();
+
+ /**
+ * Inidicates whether the specified value is one of the attribute's values.
+ *
+ * @param val the value which may be null
+ * @return true if this attribute contains the value,
+ * otherwise false
+ */
+ boolean contains(Object val);
+
+ /**
+ * Gets a value of this attribute.
+ * For unordered values, returns any of the values. For ordered values,
+ * returns the first. <code>null</code> is a valid value.
+ * <p>
+ * If the attribute has no values this method throws
+ * <code>NoSuchElementException</code>.</p>
+
+ * @return a value of this attribute
+ * @throws NamingException If the attribute has no value.
+ */
+ Object get() throws NamingException;
+
+ /**
+ * Returns the value at the specified index, even for unordered values.
+ * This method throws <code>IndexOutOfBoundsException</code> if the index is
+ * outside the valid range 0 <= index < <code>size()</code>.
+ *
+ * <p>
+ * If the attribute has no values this method throws
+ * <code>NoSuchElementException</code>.</p>
+ *
+ * @param index the position index
+ * @return the value at the specified index
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ * @throws NamingException If the attribute has no value.
+ */
+ Object get(int index) throws NamingException;
+
+ /**
+ * Returns an enumeration of all the attribute's values.
+ * The enumeration is ordered if the values are.
+ * <p>
+ * The effect on the returned enumeration of adding or removing values of
+ * the attribute is not specified.</p>
+ * <p>
+ * This method will throw any <code>NamingException</code> that occurs.</p>
+ *
+ * @return an enumeration of all values of the attribute
+ * @throws NamingException If any <code>NamingException</code> occurs.
+ */
+ NamingEnumeration<?> getAll() throws NamingException;
+
+ /**
+ * Returns the attribute's schema definition.
+ * If this operation is not supported, an <code>
+ * OperationNotSupportedException</code> is thrown. If the implementation
+ * supports schemas but no schema is set, it is valid to return null.
+ * <p>
+ * This method will throw any <code>NamingException</code> that occurs.</p>
+ *
+ * @return the schema definitions if they exist
+ * @throws NamingException If any <code>NamingException</code> occurs.
+ */
+ DirContext getAttributeDefinition() throws NamingException;
+
+ /**
+ * Returns the attribute's syntax definition.
+ * If this operation is not supported, an <code>
+ * OperationNotSupportedException</code> is thrown. If the implementation
+ * supports syntax definitions but no syntax definition is set, it is valid
+ * to return null.
+ * <p>
+ * This method will throw any <code>NamingException</code> that occurs.</p>
+ *
+ * @return the syntax definitions if they exist
+ * @throws NamingException If any <code>NamingException</code> occurs.
+ */
+ DirContext getAttributeSyntaxDefinition() throws NamingException;
+
+ /**
+ * Returns the identity of this attribute.
+ * This method is not expected to return null.
+ *
+ * @return the ID of this attribute
+ */
+ String getID();
+
+ /**
+ * Indicates whether the values of this attribute are ordered or not.
+ *
+ * @return true if the values of this attribute are
+ * ordered, otherwise false
+ */
+ boolean isOrdered();
+
+ /**
+ * Removes the values at the specified index, even for unordered values.
+ * Values at higher indexes move one position lower.
+ * <p>
+ * If the index is outside the valid range 0 <= index < <code>size()</code>
+ * this method throws an <code>IndexOutOfBoundsException</code>.</p>
+ *
+ * @param index the position index
+ * @return the removed value
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ Object remove(int index);
+
+ /**
+ * Removes a value that is equal to the given value.
+ * There may be more than one match in ordered value, in which case the
+ * equal value with the lowest index is removed. After an ordered value is
+ * removed, values at higher indexes move one position lower.
+ * <p>
+ * Returns true if a value is removed. If there is no value equal to <code>
+ * val</code> this method simply returns false.</p>
+ *
+ * @param val the value to be removed
+ * @return true if the value is removed, otherwise false
+ */
+ boolean remove(Object val);
+
+ /**
+ * Replaces the value at the specified index with the given value.
+ * The old value (which may be null) is returned.
+ * <p>
+ * If the values are unordered and the given value is already present this
+ * method throws an <code>IllegalStateException</code>.</p>
+ * <p>
+ * The valid range for the index is 0 <= index < <code>size()</code>.
+ * This method throws an <code>IndexOutOfBoundsException</code> if the index
+ * is outside this range.</p>
+ *
+ * @param index the position index
+ * @param val the new value
+ * @return the original value at the specified index
+ * @throws IndexOutOfBoundsException
+ * If the index is invalid.
+ */
+ Object set(int index, Object val);
+
+ /**
+ * Gets the count of the values in this attribute.
+ *
+ * @return the count of the values in this attribute
+ */
+ int size();
+
+}
+
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attribute.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeInUseException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/AttributeModificationException.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java?rev=437433&r1=437432&r2=437433&view=diff
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java Sun Aug 27 11:26:20 2006
@@ -1,145 +1,145 @@
-/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
- *
- * 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.
- */
-
-
-package javax.naming.directory;
-
-import java.io.Serializable;
-import javax.naming.NamingEnumeration;
-
-/**
- * This is the interface to a collection of attributes associated with a directory
- * entry.
- * <p>
- * This interface defines the methods that are implemented by a collection of a
- * particular directory entry's attributes.</p>
- * <p>
- * A directory entry can have zero or more attributes comprising its attributes
- * collection. The attributes are unordered within the collection. The
- * attributes can be identified by name. The names of attributes are either
- * case sensitive or case insensitive as indicated by the <code>isCaseIgnored</code>
- * method. Method names refer to attribute ID (identity) rather than name,
- * for brevity.</p>
- * <p>
- * The attribute collection is created when the directory entry is created.</p>
- *
- *
- */
-public interface Attributes extends Cloneable, Serializable {
-
- /*
- * -------------------------------------------------------------------
- * Methods
- * -------------------------------------------------------------------
- */
-
- /**
- * Returns a deep copy of this <code>Attributes</code> instance.
- * The attribute objects are not cloned.
- *
- * @return a deep copy of this <code>Attributes</code> instance
- */
- Object clone();
-
- /**
- * Returns the attribute with the specified name (ID).
- * The name is case insensitive if <code>isCaseIgnored()</code> is true. The
- * return value is <code>null</code> if no match is found.
- *
- * @param id attribute name (ID)
- * @return the attribute with the specified name (ID)
- */
- Attribute get(String id);
-
- /**
- * Returns an enumeration containing the zero or more attributes in the
- * collection.
- * The behaviour of the enumeration is not specified if the attribute
- * collection is changed.
- *
- * @return an enumeration of all contained attributes
- *
- */
- NamingEnumeration<? extends javax.naming.directory.Attribute> getAll();
-
- /**
- * Returns an enumeration containing the zero or more names (IDs) of the
- * attributes in the collection.
- * The behaviour of the enumeration is not specified if the attribute
- * collection is changed.
- *
- * @return an enumeration of the IDs of all contained attributes
- */
- NamingEnumeration<String> getIDs();
-
- /**
- * Indicates whether case is ignored in the names of the attributes.
- *
- * @return true if case is ignored, otherwise false
- */
- boolean isCaseIgnored();
-
- /**
- * Places a non-null attribute in the attribute collection.
- * If there is already an attribute with the same ID as the new attribute,
- * the old one is removed from the collection and is returned by this
- * method. If there was no attribute with the same ID the return value is
- * <code>null</code>.
- *
- * @param attribute the attribute to be put
- * @return the old attribute with the same ID, if exists;
- * otherwise <code>null</code>
- */
- Attribute put(Attribute attribute);
-
- /**
- * Places a new attribuet with the supplied ID and value into the attribute
- * collection.
- * If there is already an attribute with the same ID, the old one is removed
- * from the collection and is returned by this method. If there was no
- * attribute with the same ID the return value is <code>null</code>. The
- * case of the ID is ignored if <code>isCaseIgnored()</code> is true.
- *
- * This method provides a mechanism to put an attribute with a <code>null</code>
- * value: the value of <code>obj</code> may be <code>null</code>.
- *
- * @param id the ID of the new attribute to be put
- * @param obj the value of the new attribute to be put
- * @return the old attribute with the same ID, if exists;
- * otherwise <code>null</code>
- */
- Attribute put(String id, Object obj);
-
- /**
- * Removes the attribute with the specified ID.
- * The removed attribute is returned by this method. If there is no
- * attribute with the specified ID, the return value is <code>null</code>.
- * The case of the ID is ignored if <code>isCaseIgnored()</code> is true.
- *
- * @param id the ID of the attribute to be removed
- * @return the removed attribute, if exists; otherwise <code>null</code>
- */
- Attribute remove(String id);
-
- /**
- * Returns the number of attributes.
- *
- * @return the number of attributes
- */
- int size();
-
-}
-
-
+/* Copyright 2004 The Apache Software Foundation or its licensors, as applicable
+ *
+ * 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.
+ */
+
+
+package javax.naming.directory;
+
+import java.io.Serializable;
+import javax.naming.NamingEnumeration;
+
+/**
+ * This is the interface to a collection of attributes associated with a directory
+ * entry.
+ * <p>
+ * This interface defines the methods that are implemented by a collection of a
+ * particular directory entry's attributes.</p>
+ * <p>
+ * A directory entry can have zero or more attributes comprising its attributes
+ * collection. The attributes are unordered within the collection. The
+ * attributes can be identified by name. The names of attributes are either
+ * case sensitive or case insensitive as indicated by the <code>isCaseIgnored</code>
+ * method. Method names refer to attribute ID (identity) rather than name,
+ * for brevity.</p>
+ * <p>
+ * The attribute collection is created when the directory entry is created.</p>
+ *
+ *
+ */
+public interface Attributes extends Cloneable, Serializable {
+
+ /*
+ * -------------------------------------------------------------------
+ * Methods
+ * -------------------------------------------------------------------
+ */
+
+ /**
+ * Returns a deep copy of this <code>Attributes</code> instance.
+ * The attribute objects are not cloned.
+ *
+ * @return a deep copy of this <code>Attributes</code> instance
+ */
+ Object clone();
+
+ /**
+ * Returns the attribute with the specified name (ID).
+ * The name is case insensitive if <code>isCaseIgnored()</code> is true. The
+ * return value is <code>null</code> if no match is found.
+ *
+ * @param id attribute name (ID)
+ * @return the attribute with the specified name (ID)
+ */
+ Attribute get(String id);
+
+ /**
+ * Returns an enumeration containing the zero or more attributes in the
+ * collection.
+ * The behaviour of the enumeration is not specified if the attribute
+ * collection is changed.
+ *
+ * @return an enumeration of all contained attributes
+ *
+ */
+ NamingEnumeration<? extends javax.naming.directory.Attribute> getAll();
+
+ /**
+ * Returns an enumeration containing the zero or more names (IDs) of the
+ * attributes in the collection.
+ * The behaviour of the enumeration is not specified if the attribute
+ * collection is changed.
+ *
+ * @return an enumeration of the IDs of all contained attributes
+ */
+ NamingEnumeration<String> getIDs();
+
+ /**
+ * Indicates whether case is ignored in the names of the attributes.
+ *
+ * @return true if case is ignored, otherwise false
+ */
+ boolean isCaseIgnored();
+
+ /**
+ * Places a non-null attribute in the attribute collection.
+ * If there is already an attribute with the same ID as the new attribute,
+ * the old one is removed from the collection and is returned by this
+ * method. If there was no attribute with the same ID the return value is
+ * <code>null</code>.
+ *
+ * @param attribute the attribute to be put
+ * @return the old attribute with the same ID, if exists;
+ * otherwise <code>null</code>
+ */
+ Attribute put(Attribute attribute);
+
+ /**
+ * Places a new attribuet with the supplied ID and value into the attribute
+ * collection.
+ * If there is already an attribute with the same ID, the old one is removed
+ * from the collection and is returned by this method. If there was no
+ * attribute with the same ID the return value is <code>null</code>. The
+ * case of the ID is ignored if <code>isCaseIgnored()</code> is true.
+ *
+ * This method provides a mechanism to put an attribute with a <code>null</code>
+ * value: the value of <code>obj</code> may be <code>null</code>.
+ *
+ * @param id the ID of the new attribute to be put
+ * @param obj the value of the new attribute to be put
+ * @return the old attribute with the same ID, if exists;
+ * otherwise <code>null</code>
+ */
+ Attribute put(String id, Object obj);
+
+ /**
+ * Removes the attribute with the specified ID.
+ * The removed attribute is returned by this method. If there is no
+ * attribute with the specified ID, the return value is <code>null</code>.
+ * The case of the ID is ignored if <code>isCaseIgnored()</code> is true.
+ *
+ * @param id the ID of the attribute to be removed
+ * @return the removed attribute, if exists; otherwise <code>null</code>
+ */
+ Attribute remove(String id);
+
+ /**
+ * Returns the number of attributes.
+ *
+ * @return the number of attributes
+ */
+ int size();
+
+}
+
+
Propchange: incubator/harmony/enhanced/classlib/trunk/modules/jndi/src/main/java/javax/naming/directory/Attributes.java
------------------------------------------------------------------------------
svn:eol-style = native