|
From: <ls...@us...> - 2007-06-23 04:57:10
|
Revision: 3290
http://jnode.svn.sourceforge.net/jnode/?rev=3290&view=rev
Author: lsantha
Date: 2007-06-22 21:57:09 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
Openjdk integration.
Added Paths:
-----------
trunk/core/src/openjdk/javax/javax/naming/
trunk/core/src/openjdk/javax/javax/naming/AuthenticationException.java
trunk/core/src/openjdk/javax/javax/naming/AuthenticationNotSupportedException.java
trunk/core/src/openjdk/javax/javax/naming/BinaryRefAddr.java
trunk/core/src/openjdk/javax/javax/naming/Binding.java
trunk/core/src/openjdk/javax/javax/naming/CannotProceedException.java
trunk/core/src/openjdk/javax/javax/naming/CommunicationException.java
trunk/core/src/openjdk/javax/javax/naming/CompositeName.java
trunk/core/src/openjdk/javax/javax/naming/CompoundName.java
trunk/core/src/openjdk/javax/javax/naming/ConfigurationException.java
trunk/core/src/openjdk/javax/javax/naming/Context.java
trunk/core/src/openjdk/javax/javax/naming/ContextNotEmptyException.java
trunk/core/src/openjdk/javax/javax/naming/InitialContext.java
trunk/core/src/openjdk/javax/javax/naming/InsufficientResourcesException.java
trunk/core/src/openjdk/javax/javax/naming/InterruptedNamingException.java
trunk/core/src/openjdk/javax/javax/naming/InvalidNameException.java
trunk/core/src/openjdk/javax/javax/naming/LimitExceededException.java
trunk/core/src/openjdk/javax/javax/naming/LinkException.java
trunk/core/src/openjdk/javax/javax/naming/LinkLoopException.java
trunk/core/src/openjdk/javax/javax/naming/LinkRef.java
trunk/core/src/openjdk/javax/javax/naming/MalformedLinkException.java
trunk/core/src/openjdk/javax/javax/naming/Name.java
trunk/core/src/openjdk/javax/javax/naming/NameAlreadyBoundException.java
trunk/core/src/openjdk/javax/javax/naming/NameClassPair.java
trunk/core/src/openjdk/javax/javax/naming/NameImpl.java
trunk/core/src/openjdk/javax/javax/naming/NameNotFoundException.java
trunk/core/src/openjdk/javax/javax/naming/NameParser.java
trunk/core/src/openjdk/javax/javax/naming/NamingEnumeration.java
trunk/core/src/openjdk/javax/javax/naming/NamingException.java
trunk/core/src/openjdk/javax/javax/naming/NamingSecurityException.java
trunk/core/src/openjdk/javax/javax/naming/NoInitialContextException.java
trunk/core/src/openjdk/javax/javax/naming/NoPermissionException.java
trunk/core/src/openjdk/javax/javax/naming/NotContextException.java
trunk/core/src/openjdk/javax/javax/naming/OperationNotSupportedException.java
trunk/core/src/openjdk/javax/javax/naming/PartialResultException.java
trunk/core/src/openjdk/javax/javax/naming/RefAddr.java
trunk/core/src/openjdk/javax/javax/naming/Reference.java
trunk/core/src/openjdk/javax/javax/naming/Referenceable.java
trunk/core/src/openjdk/javax/javax/naming/ReferralException.java
trunk/core/src/openjdk/javax/javax/naming/ServiceUnavailableException.java
trunk/core/src/openjdk/javax/javax/naming/SizeLimitExceededException.java
trunk/core/src/openjdk/javax/javax/naming/StringRefAddr.java
trunk/core/src/openjdk/javax/javax/naming/TimeLimitExceededException.java
trunk/core/src/openjdk/javax/javax/naming/directory/
trunk/core/src/openjdk/javax/javax/naming/directory/Attribute.java
trunk/core/src/openjdk/javax/javax/naming/directory/AttributeInUseException.java
trunk/core/src/openjdk/javax/javax/naming/directory/AttributeModificationException.java
trunk/core/src/openjdk/javax/javax/naming/directory/Attributes.java
trunk/core/src/openjdk/javax/javax/naming/directory/BasicAttribute.java
trunk/core/src/openjdk/javax/javax/naming/directory/BasicAttributes.java
trunk/core/src/openjdk/javax/javax/naming/directory/DirContext.java
trunk/core/src/openjdk/javax/javax/naming/directory/InitialDirContext.java
trunk/core/src/openjdk/javax/javax/naming/directory/InvalidAttributeIdentifierException.java
trunk/core/src/openjdk/javax/javax/naming/directory/InvalidAttributeValueException.java
trunk/core/src/openjdk/javax/javax/naming/directory/InvalidAttributesException.java
trunk/core/src/openjdk/javax/javax/naming/directory/InvalidSearchControlsException.java
trunk/core/src/openjdk/javax/javax/naming/directory/InvalidSearchFilterException.java
trunk/core/src/openjdk/javax/javax/naming/directory/ModificationItem.java
trunk/core/src/openjdk/javax/javax/naming/directory/NoSuchAttributeException.java
trunk/core/src/openjdk/javax/javax/naming/directory/SchemaViolationException.java
trunk/core/src/openjdk/javax/javax/naming/directory/SearchControls.java
trunk/core/src/openjdk/javax/javax/naming/directory/SearchResult.java
trunk/core/src/openjdk/javax/javax/naming/directory/package.html
trunk/core/src/openjdk/javax/javax/naming/event/
trunk/core/src/openjdk/javax/javax/naming/event/EventContext.java
trunk/core/src/openjdk/javax/javax/naming/event/EventDirContext.java
trunk/core/src/openjdk/javax/javax/naming/event/NamespaceChangeListener.java
trunk/core/src/openjdk/javax/javax/naming/event/NamingEvent.java
trunk/core/src/openjdk/javax/javax/naming/event/NamingExceptionEvent.java
trunk/core/src/openjdk/javax/javax/naming/event/NamingListener.java
trunk/core/src/openjdk/javax/javax/naming/event/ObjectChangeListener.java
trunk/core/src/openjdk/javax/javax/naming/event/package.html
trunk/core/src/openjdk/javax/javax/naming/ldap/
trunk/core/src/openjdk/javax/javax/naming/ldap/BasicControl.java
trunk/core/src/openjdk/javax/javax/naming/ldap/Control.java
trunk/core/src/openjdk/javax/javax/naming/ldap/ControlFactory.java
trunk/core/src/openjdk/javax/javax/naming/ldap/ExtendedRequest.java
trunk/core/src/openjdk/javax/javax/naming/ldap/ExtendedResponse.java
trunk/core/src/openjdk/javax/javax/naming/ldap/HasControls.java
trunk/core/src/openjdk/javax/javax/naming/ldap/InitialLdapContext.java
trunk/core/src/openjdk/javax/javax/naming/ldap/LdapContext.java
trunk/core/src/openjdk/javax/javax/naming/ldap/LdapName.java
trunk/core/src/openjdk/javax/javax/naming/ldap/LdapReferralException.java
trunk/core/src/openjdk/javax/javax/naming/ldap/ManageReferralControl.java
trunk/core/src/openjdk/javax/javax/naming/ldap/PagedResultsControl.java
trunk/core/src/openjdk/javax/javax/naming/ldap/PagedResultsResponseControl.java
trunk/core/src/openjdk/javax/javax/naming/ldap/Rdn.java
trunk/core/src/openjdk/javax/javax/naming/ldap/Rfc2253Parser.java
trunk/core/src/openjdk/javax/javax/naming/ldap/SortControl.java
trunk/core/src/openjdk/javax/javax/naming/ldap/SortKey.java
trunk/core/src/openjdk/javax/javax/naming/ldap/SortResponseControl.java
trunk/core/src/openjdk/javax/javax/naming/ldap/StartTlsRequest.java
trunk/core/src/openjdk/javax/javax/naming/ldap/StartTlsResponse.java
trunk/core/src/openjdk/javax/javax/naming/ldap/UnsolicitedNotification.java
trunk/core/src/openjdk/javax/javax/naming/ldap/UnsolicitedNotificationEvent.java
trunk/core/src/openjdk/javax/javax/naming/ldap/UnsolicitedNotificationListener.java
trunk/core/src/openjdk/javax/javax/naming/ldap/package.html
trunk/core/src/openjdk/javax/javax/naming/package.html
trunk/core/src/openjdk/javax/javax/naming/spi/
trunk/core/src/openjdk/javax/javax/naming/spi/ContinuationContext.java
trunk/core/src/openjdk/javax/javax/naming/spi/ContinuationDirContext.java
trunk/core/src/openjdk/javax/javax/naming/spi/DirObjectFactory.java
trunk/core/src/openjdk/javax/javax/naming/spi/DirStateFactory.java
trunk/core/src/openjdk/javax/javax/naming/spi/DirectoryManager.java
trunk/core/src/openjdk/javax/javax/naming/spi/InitialContextFactory.java
trunk/core/src/openjdk/javax/javax/naming/spi/InitialContextFactoryBuilder.java
trunk/core/src/openjdk/javax/javax/naming/spi/NamingManager.java
trunk/core/src/openjdk/javax/javax/naming/spi/ObjectFactory.java
trunk/core/src/openjdk/javax/javax/naming/spi/ObjectFactoryBuilder.java
trunk/core/src/openjdk/javax/javax/naming/spi/ResolveResult.java
trunk/core/src/openjdk/javax/javax/naming/spi/Resolver.java
trunk/core/src/openjdk/javax/javax/naming/spi/StateFactory.java
trunk/core/src/openjdk/javax/javax/naming/spi/package.html
trunk/core/src/openjdk/javax/javax/rmi/
trunk/core/src/openjdk/javax/javax/rmi/CORBA/
trunk/core/src/openjdk/javax/javax/rmi/CORBA/ClassDesc.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/GetORBPropertiesFileAction.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/Stub.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/StubDelegate.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/Tie.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/Util.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/UtilDelegate.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/ValueHandler.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/ValueHandlerMultiFormat.java
trunk/core/src/openjdk/javax/javax/rmi/CORBA/package.html
trunk/core/src/openjdk/javax/javax/rmi/PortableRemoteObject.java
trunk/core/src/openjdk/javax/javax/rmi/package.html
trunk/core/src/openjdk/javax/javax/rmi/ssl/
trunk/core/src/openjdk/javax/javax/rmi/ssl/SslRMIClientSocketFactory.java
trunk/core/src/openjdk/javax/javax/rmi/ssl/SslRMIServerSocketFactory.java
trunk/core/src/openjdk/javax/javax/rmi/ssl/package.html
trunk/core/src/openjdk/javax/javax/security/
trunk/core/src/openjdk/javax/javax/security/auth/
trunk/core/src/openjdk/javax/javax/security/auth/login/
trunk/core/src/openjdk/javax/javax/security/auth/login/ConfigurationSpi.java
Added: trunk/core/src/openjdk/javax/javax/naming/AuthenticationException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/AuthenticationException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/AuthenticationException.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,76 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+/**
+ * This exception is thrown when an authentication error occurs while
+ * accessing the naming or directory service.
+ * An authentication error can happen, for example, when the credentials
+ * supplied by the user program is invalid or otherwise fails to
+ * authenticate the user to the naming/directory service.
+ *<p>
+ * If the program wants to handle this exception in particular, it
+ * should catch AuthenticationException explicitly before attempting to
+ * catch NamingException. After catching AuthenticationException, the
+ * program could reattempt the authentication by updating
+ * the resolved context's environment properties with the appropriate
+ * appropriate credentials.
+ * <p>
+ * Synchronization and serialization issues that apply to NamingException
+ * apply directly here.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.14 07/05/05
+ * @since 1.3
+ */
+
+public class AuthenticationException extends NamingSecurityException {
+ /**
+ * Constructs a new instance of AuthenticationException using the
+ * explanation supplied. All other fields default to null.
+ *
+ * @param explanation A possibly null string containing
+ * additional detail about this exception.
+ * @see java.lang.Throwable#getMessage
+ */
+ public AuthenticationException(String explanation) {
+ super(explanation);
+ }
+
+ /**
+ * Constructs a new instance of AuthenticationException.
+ * All fields are set to null.
+ */
+ public AuthenticationException() {
+ super();
+ }
+
+ /**
+ * Use serialVersionUID from JNDI 1.1.1 for interoperability
+ */
+ private static final long serialVersionUID = 3678497619904568096L;
+}
Added: trunk/core/src/openjdk/javax/javax/naming/AuthenticationNotSupportedException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/AuthenticationNotSupportedException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/AuthenticationNotSupportedException.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,81 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+/**
+ * This exception is thrown when
+ * the particular flavor of authentication requested is not supported.
+ * For example, if the program
+ * is attempting to use strong authentication but the directory/naming
+ * supports only simple authentication, this exception would be thrown.
+ * Identification of a particular flavor of authentication is
+ * provider- and server-specific. It may be specified using
+ * specific authentication schemes such
+ * those identified using SASL, or a generic authentication specifier
+ * (such as "simple" and "strong").
+ *<p>
+ * If the program wants to handle this exception in particular, it
+ * should catch AuthenticationNotSupportedException explicitly before
+ * attempting to catch NamingException. After catching
+ * <code>AuthenticationNotSupportedException</code>, the program could
+ * reattempt the authentication using a different authentication flavor
+ * by updating the resolved context's environment properties accordingly.
+ * <p>
+ * Synchronization and serialization issues that apply to NamingException
+ * apply directly here.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.14 07/05/05
+ * @since 1.3
+ */
+
+public class AuthenticationNotSupportedException extends NamingSecurityException {
+ /**
+ * Constructs a new instance of AuthenticationNotSupportedException using
+ * an explanation. All other fields default to null.
+ *
+ * @param explanation A possibly null string containing additional
+ * detail about this exception.
+ * @see java.lang.Throwable#getMessage
+ */
+ public AuthenticationNotSupportedException(String explanation) {
+ super(explanation);
+ }
+
+ /**
+ * Constructs a new instance of AuthenticationNotSupportedException
+ * all name resolution fields and explanation initialized to null.
+ */
+ public AuthenticationNotSupportedException() {
+ super();
+ }
+
+ /**
+ * Use serialVersionUID from JNDI 1.1.1 for interoperability
+ */
+ private static final long serialVersionUID = -7149033933259492300L;
+}
Added: trunk/core/src/openjdk/javax/javax/naming/BinaryRefAddr.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/BinaryRefAddr.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/BinaryRefAddr.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,184 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+/**
+ * This class represents the binary form of the address of
+ * a communications end-point.
+ *<p>
+ * A BinaryRefAddr consists of a type that describes the communication mechanism
+ * and an opaque buffer containing the address description
+ * specific to that communication mechanism. The format and interpretation of
+ * the address type and the contents of the opaque buffer are based on
+ * the agreement of three parties: the client that uses the address,
+ * the object/server that can be reached using the address,
+ * and the administrator or program that creates the address.
+ *<p>
+ * An example of a binary reference address is an BER X.500 presentation address.
+ * Another example of a binary reference address is a serialized form of
+ * a service's object handle.
+ *<p>
+ * A binary reference address is immutable in the sense that its fields
+ * once created, cannot be replaced. However, it is possible to access
+ * the byte array used to hold the opaque buffer. Programs are strongly
+ * recommended against changing this byte array. Changes to this
+ * byte array need to be explicitly synchronized.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.14 07/05/05
+ *
+ * @see RefAddr
+ * @see StringRefAddr
+ * @since 1.3
+ */
+
+ /*
+ * The serialized form of a BinaryRefAddr object consists of its type
+ * name String and a byte array containing its "contents".
+ */
+
+public class BinaryRefAddr extends RefAddr {
+ /**
+ * Contains the bytes of the address.
+ * This field is initialized by the constructor and returned
+ * using getAddressBytes() and getAddressContents().
+ * @serial
+ */
+ private byte[] buf = null;
+
+ /**
+ * Constructs a new instance of BinaryRefAddr using its address type and a byte
+ * array for contents.
+ *
+ * @param addrType A non-null string describing the type of the address.
+ * @param src The non-null contents of the address as a byte array.
+ * The contents of src is copied into the new BinaryRefAddr.
+ */
+ public BinaryRefAddr(String addrType, byte[] src) {
+ this(addrType, src, 0, src.length);
+ }
+
+ /**
+ * Constructs a new instance of BinaryRefAddr using its address type and
+ * a region of a byte array for contents.
+ *
+ * @param addrType A non-null string describing the type of the address.
+ * @param src The non-null contents of the address as a byte array.
+ * The contents of src is copied into the new BinaryRefAddr.
+ * @param offset The starting index in src to get the bytes.
+ * 0 <= offset <= src.length.
+ * @param count The number of bytes to extract from src.
+ * 0 <= count <= src.length-offset.
+ */
+ public BinaryRefAddr(String addrType, byte[] src, int offset, int count) {
+ super(addrType);
+ buf = new byte[count];
+ System.arraycopy(src, offset, buf, 0, count);
+ }
+
+ /**
+ * Retrieves the contents of this address as an Object.
+ * The result is a byte array.
+ * Changes to this array will affect this BinaryRefAddr's contents.
+ * Programs are recommended against changing this array's contents
+ * and to lock the buffer if they need to change it.
+ *
+ * @return The non-null buffer containing this address's contents.
+ */
+ public Object getContent() {
+ return buf;
+ }
+
+
+ /**
+ * Determines whether obj is equal to this address. It is equal if
+ * it contains the same address type and their contents are byte-wise
+ * equivalent.
+ * @param obj The possibly null object to check.
+ * @return true if the object is equal; false otherwise.
+ */
+ public boolean equals(Object obj) {
+ if ((obj != null) && (obj instanceof BinaryRefAddr)) {
+ BinaryRefAddr target = (BinaryRefAddr)obj;
+ if (addrType.compareTo(target.addrType) == 0) {
+ if (buf == null && target.buf == null)
+ return true;
+ if (buf == null || target.buf == null ||
+ buf.length != target.buf.length)
+ return false;
+ for (int i = 0; i < buf.length; i++)
+ if (buf[i] != target.buf[i])
+ return false;
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Computes the hash code of this address using its address type and contents.
+ * Two BinaryRefAddrs have the same hash code if they have
+ * the same address type and the same contents.
+ * It is also possible for different BinaryRefAddrs to have
+ * the same hash code.
+ *
+ * @return The hash code of this address as an int.
+ */
+ public int hashCode() {
+ int hash = addrType.hashCode();
+ for (int i = 0; i < buf.length; i++) {
+ hash += buf[i]; // %%% improve later
+ }
+ return hash;
+ }
+
+ /**
+ * Generates the string representation of this address.
+ * The string consists of the address's type and contents with labels.
+ * The first 32 bytes of contents are displayed (in hexadecimal).
+ * If there are more than 32 bytes, "..." is used to indicate more.
+ * This string is meant to used for debugging purposes and not
+ * meant to be interpreted programmatically.
+ * @return The non-null string representation of this address.
+ */
+ public String toString(){
+ StringBuffer str = new StringBuffer("Address Type: " + addrType + "\n");
+
+ str.append("AddressContents: ");
+ for (int i = 0; i<buf.length && i < 32; i++) {
+ str.append(Integer.toHexString(buf[i]) +" ");
+ }
+ if (buf.length >= 32)
+ str.append(" ...\n");
+ return (str.toString());
+ }
+
+ /**
+ * Use serialVersionUID from JNDI 1.1.1 for interoperability
+ */
+ private static final long serialVersionUID = -3415254970957330361L;
+}
Added: trunk/core/src/openjdk/javax/javax/naming/Binding.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/Binding.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/Binding.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,201 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+/**
+ * This class represents a name-to-object binding found in a context.
+ *<p>
+ * A context consists of name-to-object bindings.
+ * The Binding class represents such a binding. It consists
+ * of a name and an object. The <code>Context.listBindings()</code>
+ * method returns an enumeration of Binding.
+ *<p>
+ * Use subclassing for naming systems that generate contents of
+ * a binding dynamically.
+ *<p>
+ * A Binding instance is not synchronized against concurrent access by multiple
+ * threads. Threads that need to access a Binding concurrently should
+ * synchronize amongst themselves and provide the necessary locking.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.15 07/05/05
+ * @since 1.3
+ */
+
+public class Binding extends NameClassPair {
+ /**
+ * Contains this binding's object.
+ * It is initialized by the constuctor and can be updated using
+ * <tt>setObject</tt>.
+ * @serial
+ * @see #getObject
+ * @see #setObject
+ */
+ private Object boundObj;
+
+ /**
+ * Constructs an instance of a Binding given its name and object.
+ *<p>
+ * <tt>getClassName()</tt> will return
+ * the class name of <tt>obj</tt> (or null if <tt>obj</tt> is null)
+ * unless the class name has been explicitly set using <tt>setClassName()</tt>
+ *
+ * @param name The non-null name of the object. It is relative
+ * to the <em>target context</em> (which is
+ * named by the first parameter of the <code>listBindings()</code> method)
+ * @param obj The possibly null object bound to name.
+ * @see NameClassPair#setClassName
+ */
+ public Binding(String name, Object obj) {
+ super(name, null);
+ this.boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance of a Binding given its name, object, and whether
+ * the name is relative.
+ *<p>
+ * <tt>getClassName()</tt> will return the class name of <tt>obj</tt>
+ * (or null if <tt>obj</tt> is null) unless the class name has been
+ * explicitly set using <tt>setClassName()</tt>
+ *
+ * @param name The non-null string name of the object.
+ * @param obj The possibly null object bound to name.
+ * @param isRelative true if <code>name</code> is a name relative
+ * to the target context (which is named by
+ * the first parameter of the <code>listBindings()</code> method);
+ * false if <code>name</code> is a URL string.
+ * @see NameClassPair#isRelative
+ * @see NameClassPair#setRelative
+ * @see NameClassPair#setClassName
+ */
+ public Binding(String name, Object obj, boolean isRelative) {
+ super(name, null, isRelative);
+ this.boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance of a Binding given its name, class name, and object.
+ *
+ * @param name The non-null name of the object. It is relative
+ * to the <em>target context</em> (which is
+ * named by the first parameter of the <code>listBindings()</code> method)
+ * @param className The possibly null class name of the object
+ * bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
+ * returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also
+ * null, <tt>getClassName()</tt> will return null.
+ * @param obj The possibly null object bound to name.
+ * @see NameClassPair#setClassName
+ */
+ public Binding(String name, String className, Object obj) {
+ super(name, className);
+ this.boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance of a Binding given its
+ * name, class name, object, and whether the name is relative.
+ *
+ * @param name The non-null string name of the object.
+ * @param className The possibly null class name of the object
+ * bound to <tt>name</tt>. If null, the class name of <tt>obj</tt> is
+ * returned by <tt>getClassName()</tt>. If <tt>obj</tt> is also
+ * null, <tt>getClassName()</tt> will return null.
+ * @param obj The possibly null object bound to name.
+ * @param isRelative true if <code>name</code> is a name relative
+ * to the target context (which is named by
+ * the first parameter of the <code>listBindings()</code> method);
+ * false if <code>name</code> is a URL string.
+ * @see NameClassPair#isRelative
+ * @see NameClassPair#setRelative
+ * @see NameClassPair#setClassName
+ */
+ public Binding(String name, String className, Object obj, boolean isRelative) {
+ super(name, className, isRelative);
+ this.boundObj = obj;
+ }
+
+ /**
+ * Retrieves the class name of the object bound to the name of this binding.
+ * If the class name has been set explicitly, return it.
+ * Otherwise, if this binding contains a non-null object,
+ * that object's class name is used. Otherwise, null is returned.
+ *
+ * @return A possibly null string containing class name of object bound.
+ */
+ public String getClassName() {
+ String cname = super.getClassName();
+ if (cname != null) {
+ return cname;
+ }
+ if (boundObj != null)
+ return boundObj.getClass().getName();
+ else
+ return null;
+ }
+
+ /**
+ * Retrieves the object bound to the name of this binding.
+ *
+ * @return The object bound; null if this binding does not contain an object.
+ * @see #setObject
+ */
+
+ public Object getObject() {
+ return boundObj;
+ }
+
+ /**
+ * Sets the object associated with this binding.
+ * @param obj The possibly null object to use.
+ * @see #getObject
+ */
+ public void setObject(Object obj) {
+ boundObj = obj;
+ }
+
+ /**
+ * Generates the string representation of this binding.
+ * The string representation consists of the string representation
+ * of the name/class pair and the string representation of
+ * this binding's object, separated by ':'.
+ * The contents of this string is useful
+ * for debugging and is not meant to be interpreted programmatically.
+ *
+ * @return The non-null string representation of this binding.
+ */
+
+ public String toString() {
+ return super.toString() + ":" + getObject();
+ }
+
+ /**
+ * Use serialVersionUID from JNDI 1.1.1 for interoperability
+ */
+ private static final long serialVersionUID = 8839217842691845890L;
+};
+
Added: trunk/core/src/openjdk/javax/javax/naming/CannotProceedException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/CannotProceedException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/CannotProceedException.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,287 @@
+/*
+ * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+import java.util.Hashtable;
+
+/**
+ * This exception is thrown to indicate that the operation reached
+ * a point in the name where the operation cannot proceed any further.
+ * When performing an operation on a composite name, a naming service
+ * provider may reach a part of the name that does not belong to its
+ * namespace. At that point, it can construct a
+ * CannotProceedException and then invoke methods provided by
+ * javax.naming.spi.NamingManager (such as getContinuationContext())
+ * to locate another provider to continue the operation. If this is
+ * not possible, this exception is raised to the caller of the
+ * context operation.
+ *<p>
+ * If the program wants to handle this exception in particular, it
+ * should catch CannotProceedException explicitly before attempting to
+ * catch NamingException.
+ *<p>
+ * A CannotProceedException instance is not synchronized against concurrent
+ * multithreaded access. Multiple threads trying to access and modify
+ * CannotProceedException should lock the object.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.18 07/05/05
+ * @since 1.3
+ */
+
+/*
+ * The serialized form of a CannotProceedException object consists of
+ * the serialized fields of its NamingException superclass, the remaining new
+ * name (a Name object), the environment (a Hashtable), the altName field
+ * (a Name object), and the serialized form of the altNameCtx field.
+ */
+
+
+public class CannotProceedException extends NamingException {
+ /**
+ * Contains the remaining unresolved part of the second
+ * "name" argument to Context.rename().
+ * This information necessary for
+ * continuing the Context.rename() operation.
+ * <p>
+ * This field is initialized to null.
+ * It should not be manipulated directly: it should
+ * be accessed and updated using getRemainingName() and setRemainingName().
+ * @serial
+ *
+ * @see #getRemainingNewName
+ * @see #setRemainingNewName
+ */
+ protected Name remainingNewName = null;
+
+ /**
+ * Contains the environment
+ * relevant for the Context or DirContext method that cannot proceed.
+ * <p>
+ * This field is initialized to null.
+ * It should not be manipulated directly: it should be accessed
+ * and updated using getEnvironment() and setEnvironment().
+ * @serial
+ *
+ * @see #getEnvironment
+ * @see #setEnvironment
+ */
+ protected Hashtable<?,?> environment = null;
+
+ /**
+ * Contains the name of the resolved object, relative
+ * to the context <code>altNameCtx</code>. It is a composite name.
+ * If null, then no name is specified.
+ * See the <code>javax.naming.spi.ObjectFactory.getObjectInstance</code>
+ * method for details on how this is used.
+ * <p>
+ * This field is initialized to null.
+ * It should not be manipulated directly: it should
+ * be accessed and updated using getAltName() and setAltName().
+ * @serial
+ *
+ * @see #getAltName
+ * @see #setAltName
+ * @see #altNameCtx
+ * @see javax.naming.spi.ObjectFactory#getObjectInstance
+ */
+ protected Name altName = null;
+
+ /**
+ * Contains the context relative to which
+ * <code>altName</code> is specified. If null, then the default initial
+ * context is implied.
+ * See the <code>javax.naming.spi.ObjectFactory.getObjectInstance</code>
+ * method for details on how this is used.
+ * <p>
+ * This field is initialized to null.
+ * It should not be manipulated directly: it should
+ * be accessed and updated using getAltNameCtx() and setAltNameCtx().
+ * @serial
+ *
+ * @see #getAltNameCtx
+ * @see #setAltNameCtx
+ * @see #altName
+ * @see javax.naming.spi.ObjectFactory#getObjectInstance
+ */
+ protected Context altNameCtx = null;
+
+ /**
+ * Constructs a new instance of CannotProceedException using an
+ * explanation. All unspecified fields default to null.
+ *
+ * @param explanation A possibly null string containing additional
+ * detail about this exception.
+ * If null, this exception has no detail message.
+ * @see java.lang.Throwable#getMessage
+ */
+ public CannotProceedException(String explanation) {
+ super(explanation);
+ }
+
+ /**
+ * Constructs a new instance of CannotProceedException.
+ * All fields default to null.
+ */
+ public CannotProceedException() {
+ super();
+ }
+
+ /**
+ * Retrieves the environment that was in effect when this exception
+ * was created.
+ * @return Possibly null environment property set.
+ * null means no environment was recorded for this exception.
+ * @see #setEnvironment
+ */
+ public Hashtable<?,?> getEnvironment() {
+ return environment;
+ }
+
+ /**
+ * Sets the environment that will be returned when getEnvironment()
+ * is called.
+ * @param environment A possibly null environment property set.
+ * null means no environment is being recorded for
+ * this exception.
+ * @see #getEnvironment
+ */
+ public void setEnvironment(Hashtable<?,?> environment) {
+ this.environment = environment; // %%% clone it??
+ }
+
+ /**
+ * Retrieves the "remaining new name" field of this exception, which is
+ * used when this exception is thrown during a rename() operation.
+ *
+ * @return The possibly null part of the new name that has not been resolved.
+ * It is a composite name. It can be null, which means
+ * the remaining new name field has not been set.
+ *
+ * @see #setRemainingNewName
+ */
+ public Name getRemainingNewName() {
+ return remainingNewName;
+ }
+
+ /**
+ * Sets the "remaining new name" field of this exception.
+ * This is the value returned by <code>getRemainingNewName()</code>.
+ *<p>
+ * <tt>newName</tt> is a composite name. If the intent is to set
+ * this field using a compound name or string, you must
+ * "stringify" the compound name, and create a composite
+ * name with a single component using the string. You can then
+ * invoke this method using the resulting composite name.
+ *<p>
+ * A copy of <code>newName</code> is made and stored.
+ * Subsequent changes to <code>name</code> does not
+ * affect the copy in this NamingException and vice versa.
+ *
+ * @param newName The possibly null name to set the "remaining new name" to.
+ * If null, it sets the remaining name field to null.
+ *
+ * @see #getRemainingNewName
+ */
+ public void setRemainingNewName(Name newName) {
+ if (newName != null)
+ this.remainingNewName = (Name)(newName.clone());
+ else
+ this.remainingNewName = null;
+ }
+
+ /**
+ * Retrieves the <code>altName</code> field of this exception.
+ * This is the name of the resolved object, relative to the context
+ * <code>altNameCtx</code>. It will be used during a subsequent call to the
+ * <code>javax.naming.spi.ObjectFactory.getObjectInstance</code> method.
+ *
+ * @return The name of the resolved object, relative to
+ * <code>altNameCtx</code>.
+ * It is a composite name. If null, then no name is specified.
+ *
+ * @see #setAltName
+ * @see #getAltNameCtx
+ * @see javax.naming.spi.ObjectFactory#getObjectInstance
+ */
+ public Name getAltName() {
+ return altName;
+ }
+
+ /**
+ * Sets the <code>altName</code> field of this exception.
+ *
+ * @param altName The name of the resolved object, relative to
+ * <code>altNameCtx</code>.
+ * It is a composite name.
+ * If null, then no name is specified.
+ *
+ * @see #getAltName
+ * @see #setAltNameCtx
+ */
+ public void setAltName(Name altName) {
+ this.altName = altName;
+ }
+
+ /**
+ * Retrieves the <code>altNameCtx</code> field of this exception.
+ * This is the context relative to which <code>altName</code> is named.
+ * It will be used during a subsequent call to the
+ * <code>javax.naming.spi.ObjectFactory.getObjectInstance</code> method.
+ *
+ * @return The context relative to which <code>altName</code> is named.
+ * If null, then the default initial context is implied.
+ *
+ * @see #setAltNameCtx
+ * @see #getAltName
+ * @see javax.naming.spi.ObjectFactory#getObjectInstance
+ */
+ public Context getAltNameCtx() {
+ return altNameCtx;
+ }
+
+ /**
+ * Sets the <code>altNameCtx</code> field of this exception.
+ *
+ * @param altNameCtx
+ * The context relative to which <code>altName</code>
+ * is named. If null, then the default initial context
+ * is implied.
+ *
+ * @see #getAltNameCtx
+ * @see #setAltName
+ */
+ public void setAltNameCtx(Context altNameCtx) {
+ this.altNameCtx = altNameCtx;
+ }
+
+
+ /**
+ * Use serialVersionUID from JNDI 1.1.1 for interoperability
+ */
+ private static final long serialVersionUID = 1219724816191576813L;
+}
Added: trunk/core/src/openjdk/javax/javax/naming/CommunicationException.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/CommunicationException.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/CommunicationException.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,67 @@
+/*
+ * Copyright 1999 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+/**
+ * This exception is thrown when the client is
+ * unable to communicate with the directory or naming service.
+ * The inability to communicate with the service might be a result
+ * of many factors, such as network partitioning, hardware or interface problems,
+ * failures on either the client or server side.
+ * This exception is meant to be used to capture such communication problems.
+ * <p>
+ * Synchronization and serialization issues that apply to NamingException
+ * apply directly here.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.14 07/05/05
+ * @since 1.3
+ */
+public class CommunicationException extends NamingException {
+ /**
+ * Constructs a new instance of CommunicationException using the
+ * arguments supplied.
+ *
+ * @param explanation Additional detail about this exception.
+ * @see java.lang.Throwable#getMessage
+ */
+ public CommunicationException(String explanation) {
+ super(explanation);
+ }
+
+ /**
+ * Constructs a new instance of CommunicationException.
+ */
+ public CommunicationException() {
+ super();
+ }
+
+ /**
+ * Use serialVersionUID from JNDI 1.1.1 for interoperability
+ */
+ private static final long serialVersionUID = 3618507780299986611L;
+}
Added: trunk/core/src/openjdk/javax/javax/naming/CompositeName.java
===================================================================
--- trunk/core/src/openjdk/javax/javax/naming/CompositeName.java (rev 0)
+++ trunk/core/src/openjdk/javax/javax/naming/CompositeName.java 2007-06-23 04:57:09 UTC (rev 3290)
@@ -0,0 +1,631 @@
+/*
+ * Copyright 1999-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package javax.naming;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+/**
+ * This class represents a composite name -- a sequence of
+ * component names spanning multiple namespaces.
+ * Each component is a string name from the namespace of a
+ * naming system. If the component comes from a hierarchical
+ * namespace, that component can be further parsed into
+ * its atomic parts by using the CompoundName class.
+ *<p>
+ * The components of a composite name are numbered. The indexes of a
+ * composite name with N components range from 0 up to, but not including, N.
+ * This range may be written as [0,N).
+ * The most significant component is at index 0.
+ * An empty composite name has no components.
+ *<p>
+ * <h4>JNDI Composite Name Syntax</h4>
+ * JNDI defines a standard string representation for composite names. This
+ * representation is the concatenation of the components of a composite name
+ * from left to right using the component separator (a forward
+ * slash character (/)) to separate each component.
+ * The JNDI syntax defines the following meta characters:
+ * <ul>
+ * <li>escape (backward slash \),
+ * <li>quote characters (single (') and double quotes (")), and
+ * <li>component separator (forward slash character (/)).
+ * </ul>
+ * Any occurrence of a leading quote, an escape preceding any meta character,
+ * an escape at the end of a component, or a component separator character
+ * in an unquoted component must be preceded by an escape character when
+ * that component is being composed into a composite name string.
+ * Alternatively, to avoid adding escape characters as described,
+ * the entire component can be quoted using matching single quotes
+ * or matching double quotes. A single quote occurring within a double-quoted
+ * component is not considered a meta character (and need not be escaped),
+ * and vice versa.
+ *<p>
+ * When two composite names are compared, the case of the characters
+ * is significant.
+ *<p>
+ * A leading component separator (the composite name string begins with
+ * a separator) denotes a leading empty component (a component consisting
+ * of an empty string).
+ * A trailing component separator (the composite name string ends with
+ * a separator) denotes a trailing empty component.
+ * Adjacent component separators denote an empty component.
+ *<p>
+ *<h4>Composite Name Examples</h4>
+ *This table shows examples of some composite names. Each row shows
+ *the string form of a composite name and its corresponding structural form
+ *(<tt>CompositeName</tt>).
+ *<p>
+<table border="1" cellpadding=3 width="70%" summary="examples showing string form of composite name and its corresponding structural form (CompositeName)">
+
+<tr>
+<th>String Name</th>
+<th>CompositeName</th>
+</tr>
+
+<tr>
+<td>
+""
+</td>
+<td>{} (the empty name == new CompositeName("") == new CompositeName())
+</td>
+</tr>
+
+<tr>
+<td>
+"x"
+</td>
+<td>{"x"}
+</td>
+</tr>
+
+<tr>
+<td>
+"x/y"
+</td>
+<td>{"x", "y"}</td>
+</tr>
+
+<tr>
+<td>"x/"</td>
+<td>{"x", ""}</td>
+</tr>
+
+<tr>
+<td>"/x"</td>
+<td>{"", "x"}</td>
+</tr>
+
+<tr>
+<td>"/"</td>
+<td>{""}</td>
+</tr>
+
+<tr>
+<td>"//"</td>
+<td>{"", ""}</td>
+</tr>
+
+<tr><td>"/x/"</td>
+<td>{"", "x", ""}</td>
+</tr>
+
+<tr><td>"x//y"</td>
+<td>{"x", "", "y"}</td>
+</tr>
+</table>
+ * <p>
+ *<h4>Composition Examples</h4>
+ * Here are some composition examples. The right column shows composing
+ * string composite names while the left column shows composing the
+ * corresponding <tt>CompositeName</tt>s. Notice that composing the
+ * string forms of two composite names simply involves concatenating
+ * their string forms together.
+
+<p> <table border="1" cellpadding=3 width="70%" summary="composition examples showing string names and composite names">
+
+<tr>
+<th>String Names</th>
+<th>CompositeNames</th>
+</tr>
+
+<tr>
+<td>
+"x/y" + "/" = x/y/
+</td>
+<td>
+{"x", "y"} + {""} = {"x", "y", ""}
+</td>
+</tr>
+
+<tr>
+<td>
+"" + "x" = "x"
+</td>
+<td>
+{} + {"x"} = {"x"}
+</td>
+</tr>
+
+<tr>
+<td>
+"/" + "x" = "/x"
+</td>
+<td>
+{""} + {"x"} = {"", "x"}
+</td>
+</tr>
+
+<tr>
+<td>
+"x" + "" + "" = "x"
+</td>
+<td>
+{"x"} + {} + {} = {"x"}
+</td>
+</tr>
+
+</table>
+ *<p>
+ *<h4>Multithreaded Access</h4>
+ * A <tt>CompositeName</tt> instance is not synchronized against concurrent
+ * multithreaded access. Multiple threads trying to access and modify a
+ * <tt>CompositeName</tt> should lock the object.
+ *
+ * @author Rosanna Lee
+ * @author Scott Seligman
+ * @version 1.21 07/05/05
+ * @since 1.3
+ */
+
+
+public class CompositeName implements Name {
+
+ private transient NameImpl impl;
+ /**
+ * Constructs a new composite name instance using the components
+ * specified by 'comps'. This protected method is intended to be
+ * to be used by subclasses of CompositeName when they override
+ * methods such as clone(), getPrefix(), getSuffix().
+ *
+ * @param comps A non-null enumeration containing the components for the new
+ * composite name. Each element is of class String.
+ * The enumeration will be consumed to extract its
+ * elements.
+ */
+ protected CompositeName(Enumeration<String> comps) {
+ impl = new NameImpl(null, comps); // null means use default syntax
+ }
+
+ /**
+ * Constructs a new composite name instance by parsing the string n
+ * using the composite name syntax (left-to-right, slash separated).
+ * The composite name syntax is described in detail in the class
+ * description.
+ *
+ * @param n The non-null string to parse.
+ * @exception InvalidNameException If n has invalid composite name syntax.
+ */
+ public CompositeName(String n) throws InvalidNameException {
+ impl = new NameImpl(null, n); // null means use default syntax
+ }
+
+ /**
+ * Constructs a new empty composite name. Such a name returns true
+ * when <code>isEmpty()</code> is invoked on it.
+ */
+ public CompositeName() {
+ impl = new NameImpl(null); // null means use default syntax
+ }
+
+ /**
+ * Generates the string representation of this composite name.
+ * The string representation consists of enumerating in order
+ * each component of the composite name and separating
+ * each component by a forward slash character. Quoting and
+ * escape characters are applied where necessary according to
+ * the JNDI syntax, which is described in the class description.
+ * An empty component is represented by an empty string.
+ *
+ * The string representation thus generated can be passed to
+ * the CompositeName constructor to create a new equivalent
+ * composite name.
+ *
+ * @return A non-null string representation of this composite name.
+ */
+ public String toString() {
+ return impl.toString();
+ }
+
+ /**
+ * Determines whether two composite names are equal.
+ * If obj is null or not a composite name, false is returned.
+ * Two composite names are equal if each component in one is equal
+ * to the corresponding component in the other. This implies
+ * both have the same number of components, and each component's
+ * equals() test against the corresponding component in the other name
+ * returns true.
+ *
+ * @param obj The possibly null object to compare against.
+ * @return true if obj is equal to this composite name, false otherwise.
+ * @see #hashCode
+ */
+ public boolean equals(Object obj) {
+ return (obj != null &&
+ obj instanceof CompositeName &&
+ impl.equals(((CompositeName)obj).impl));
+ }
+
+ /**
+ * Computes the hash code of this composite name.
+ * The hash code is the sum of the hash codes of individual components
+ * of this composite name.
+ *
+ * @return An int representing the hash code of this name.
+ * @see #equals
+ */
+ public int hashCode() {
+ return impl.hashCode();
+ }
+
+
+ /**
+ * Compares this CompositeName with the specified Object for order.
+ * Returns a
+ * negative integer, zero, or a positive integer as this Name is less
+ * than, equal to, or greater than the given Object.
+ * <p>
+ * If obj is null or not an instance of CompositeName, ClassCastException
+ * is thrown.
+ * <p>
+ * See equals() for what it means for two composite names to be equal.
+ * If two composite names are equal, 0 is returned.
+ * <p>
+ * Ordering of composite names follows the lexicographical rules for
+ * string comparison, with the extension that this applies to all
+ * the components in the composite name. The effect is as if all the
+ * components were lined up in their specified ordered and the
+ * lexicographical rules applied over the two line-ups.
+ * If this composite name is "lexicographically" lesser than obj,
+ * a negative number is returned.
+ * If this composite name is "lexicographically" greater than obj,
+ * a positive number is returned.
+ * @param obj The non-null object to compare against.
+ *
+ * @return a negative integer, zero, or a positive integer as this Name
+ * is less than, equal to, or greater than the given Object.
+ * @exception ClassCastException if obj is not a CompositeName.
+ */
+ public int compareTo(Object obj) {
+ if (!(obj instanceof CompositeName)) {
+ throw new ClassCastException("Not a CompositeName");
+ }
+ return impl.compareTo(((CompositeName)obj).impl);
+ }
+
+ /**
+ * Generates a copy of this composite name.
+ * Changes to the components of this composite name won't
+ * affect the new copy and vice versa.
+ *
+ * @return A non-null copy of this composite name.
+ */
+ public Object clone() {
+ return (new CompositeName(getAll()));
+ }
+
+ /**
+ * Retrieves the number of components in this composite name.
+ *
+ * @return The nonnegative number of components in this composite name.
+ */
+ public int size() {
+ return (impl.size());
+ }
+
+ /**
+ * Determines whether this composite name is empty. A composite name
+ * is empty if it has zero components.
+ *
+ * @return true if this composite name is empty, false otherwise.
+ */
+ public boolean isEmpty() {
+ return (impl.isEmpty());
+ }
+
+ /**
+ * Retrieves the components of this composite name as an enumeration
+ * of strings.
+ * The effects of updates to this composite name on this enumeration
+ * is undefined.
+ *
+ * @return A non-null enumeration of the components of
+ * this composite name. Each element of the enumeration is of
+ * class String.
+ */
+ public Enumeration<String> getAll() {
+ return (impl.getAll());
+ }
+
+ /**
+ * Retrieves a component of this composite name.
+ *
+ * @param posn The 0-based index of the component to retrieve.
+ * Must be in the range [0,size()).
+ * @return The non-null component at index posn.
+ * @exception ArrayIndexOutOfBoundsException if posn is outside the
+ * specified range.
+ */
+ public String get(int posn) {
+ return (impl.get(posn));
+ }
+
+ /**
+ * Creates a composite name whose components consist of a prefix of the
+ * components in this composite name. Subsequent changes to
+ * this composite name does not affect the name that is returned.
+ *
+ * @param posn The 0-based index of the component at which to stop.
+ * Must be in the range [0,size()].
+ * @return A composite name consisting of the components at indexes in
+ * the range [0,posn).
+ * @exception ArrayIndexOutOfBoundsException
+ * If posn is outside the specified range.
+ */
+ public Name getPrefix(int posn) {
+ Enumeration comps = impl.getPrefix(posn);
+ return (new CompositeName(comps));
+ }
+
+ /**
+ * Creates a composite name whose components consist of a suffix of the
+ * components in this composite name. Subsequent changes to
+ * this composite name does not affect the name that is returned.
+ *
+ * @param posn The 0-based index of the component at which to start.
+ * Must be in the range [0,size()].
+ * @return A composite name consisting of the components at indexes in
+ * the range [posn,size()). If posn is equal to
+ * size(), an empty composite name is returned.
+ * @exception ArrayIndexOutOfBoundsException
+ * If posn is outside the specified range.
+ */
+ public Name getSuffix(int posn) {
+ Enumeration comps = impl....
[truncated message content] |