From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001
From: upstream source tree
Date: Sun, 15 Mar 2015 20:14:05 -0400
Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified
gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream
tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
---
.../javax/naming/AuthenticationException.java | 55 ++
.../AuthenticationNotSupportedException.java | 56 ++
libjava/classpath/javax/naming/BinaryRefAddr.java | 158 +++++
libjava/classpath/javax/naming/Binding.java | 164 +++++
.../javax/naming/CannotProceedException.java | 107 ++++
.../javax/naming/CommunicationException.java | 55 ++
libjava/classpath/javax/naming/CompositeName.java | 343 +++++++++++
libjava/classpath/javax/naming/CompoundName.java | 523 ++++++++++++++++
.../javax/naming/ConfigurationException.java | 55 ++
libjava/classpath/javax/naming/Context.java | 492 +++++++++++++++
.../javax/naming/ContextNotEmptyException.java | 60 ++
libjava/classpath/javax/naming/InitialContext.java | 548 +++++++++++++++++
.../naming/InsufficientResourcesException.java | 55 ++
.../javax/naming/InterruptedNamingException.java | 55 ++
.../javax/naming/InvalidNameException.java | 68 +++
.../javax/naming/LimitExceededException.java | 55 ++
libjava/classpath/javax/naming/LinkException.java | 119 ++++
.../classpath/javax/naming/LinkLoopException.java | 55 ++
libjava/classpath/javax/naming/LinkRef.java | 67 ++
.../javax/naming/MalformedLinkException.java | 55 ++
libjava/classpath/javax/naming/Name.java | 206 +++++++
.../javax/naming/NameAlreadyBoundException.java | 55 ++
libjava/classpath/javax/naming/NameClassPair.java | 198 ++++++
.../javax/naming/NameNotFoundException.java | 55 ++
libjava/classpath/javax/naming/NameParser.java | 60 ++
.../classpath/javax/naming/NamingEnumeration.java | 89 +++
.../classpath/javax/naming/NamingException.java | 316 ++++++++++
.../javax/naming/NamingSecurityException.java | 55 ++
.../javax/naming/NoInitialContextException.java | 55 ++
.../javax/naming/NoPermissionException.java | 55 ++
.../javax/naming/NotContextException.java | 55 ++
.../naming/OperationNotSupportedException.java | 54 ++
.../javax/naming/PartialResultException.java | 59 ++
libjava/classpath/javax/naming/RefAddr.java | 142 +++++
libjava/classpath/javax/naming/Reference.java | 306 ++++++++++
libjava/classpath/javax/naming/Referenceable.java | 56 ++
.../classpath/javax/naming/ReferralException.java | 68 +++
.../javax/naming/ServiceUnavailableException.java | 55 ++
.../javax/naming/SizeLimitExceededException.java | 60 ++
libjava/classpath/javax/naming/StringRefAddr.java | 75 +++
.../javax/naming/TimeLimitExceededException.java | 55 ++
.../javax/naming/directory/Attribute.java | 70 +++
.../naming/directory/AttributeInUseException.java | 56 ++
.../directory/AttributeModificationException.java | 78 +++
.../javax/naming/directory/Attributes.java | 61 ++
.../javax/naming/directory/BasicAttribute.java | 358 +++++++++++
.../javax/naming/directory/BasicAttributes.java | 284 +++++++++
.../javax/naming/directory/DirContext.java | 103 ++++
.../javax/naming/directory/InitialDirContext.java | 272 +++++++++
.../InvalidAttributeIdentifierException.java | 56 ++
.../directory/InvalidAttributeValueException.java | 56 ++
.../directory/InvalidAttributesException.java | 56 ++
.../directory/InvalidSearchControlsException.java | 56 ++
.../directory/InvalidSearchFilterException.java | 56 ++
.../javax/naming/directory/ModificationItem.java | 81 +++
.../naming/directory/NoSuchAttributeException.java | 56 ++
.../naming/directory/SchemaViolationException.java | 56 ++
.../javax/naming/directory/SearchControls.java | 138 +++++
.../javax/naming/directory/SearchResult.java | 95 +++
.../classpath/javax/naming/directory/package.html | 46 ++
.../classpath/javax/naming/event/EventContext.java | 65 ++
.../javax/naming/event/EventDirContext.java | 65 ++
.../naming/event/NamespaceChangeListener.java | 51 ++
.../classpath/javax/naming/event/NamingEvent.java | 122 ++++
.../javax/naming/event/NamingExceptionEvent.java | 77 +++
.../javax/naming/event/NamingListener.java | 51 ++
.../javax/naming/event/ObjectChangeListener.java | 49 ++
libjava/classpath/javax/naming/event/package.html | 46 ++
libjava/classpath/javax/naming/ldap/Control.java | 56 ++
.../javax/naming/ldap/ControlFactory.java | 107 ++++
.../javax/naming/ldap/ExtendedRequest.java | 57 ++
.../javax/naming/ldap/ExtendedResponse.java | 52 ++
.../classpath/javax/naming/ldap/HasControls.java | 51 ++
.../javax/naming/ldap/InitialLdapContext.java | 135 +++++
.../classpath/javax/naming/ldap/LdapContext.java | 63 ++
.../javax/naming/ldap/LdapReferralException.java | 69 +++
.../javax/naming/ldap/StartTlsRequest.java | 108 ++++
.../javax/naming/ldap/StartTlsResponse.java | 119 ++++
.../javax/naming/ldap/UnsolicitedNotification.java | 52 ++
.../naming/ldap/UnsolicitedNotificationEvent.java | 70 +++
.../ldap/UnsolicitedNotificationListener.java | 51 ++
libjava/classpath/javax/naming/ldap/package.html | 46 ++
libjava/classpath/javax/naming/package.html | 46 ++
.../javax/naming/spi/DirObjectFactory.java | 56 ++
.../javax/naming/spi/DirStateFactory.java | 83 +++
.../javax/naming/spi/DirectoryManager.java | 243 ++++++++
.../javax/naming/spi/InitialContextFactory.java | 71 +++
.../naming/spi/InitialContextFactoryBuilder.java | 66 ++
.../classpath/javax/naming/spi/NamingManager.java | 671 +++++++++++++++++++++
.../classpath/javax/naming/spi/ObjectFactory.java | 76 +++
.../javax/naming/spi/ObjectFactoryBuilder.java | 70 +++
.../classpath/javax/naming/spi/ResolveResult.java | 182 ++++++
libjava/classpath/javax/naming/spi/Resolver.java | 62 ++
.../classpath/javax/naming/spi/StateFactory.java | 79 +++
libjava/classpath/javax/naming/spi/package.html | 46 ++
95 files changed, 10621 insertions(+)
create mode 100644 libjava/classpath/javax/naming/AuthenticationException.java
create mode 100644 libjava/classpath/javax/naming/AuthenticationNotSupportedException.java
create mode 100644 libjava/classpath/javax/naming/BinaryRefAddr.java
create mode 100644 libjava/classpath/javax/naming/Binding.java
create mode 100644 libjava/classpath/javax/naming/CannotProceedException.java
create mode 100644 libjava/classpath/javax/naming/CommunicationException.java
create mode 100644 libjava/classpath/javax/naming/CompositeName.java
create mode 100644 libjava/classpath/javax/naming/CompoundName.java
create mode 100644 libjava/classpath/javax/naming/ConfigurationException.java
create mode 100644 libjava/classpath/javax/naming/Context.java
create mode 100644 libjava/classpath/javax/naming/ContextNotEmptyException.java
create mode 100644 libjava/classpath/javax/naming/InitialContext.java
create mode 100644 libjava/classpath/javax/naming/InsufficientResourcesException.java
create mode 100644 libjava/classpath/javax/naming/InterruptedNamingException.java
create mode 100644 libjava/classpath/javax/naming/InvalidNameException.java
create mode 100644 libjava/classpath/javax/naming/LimitExceededException.java
create mode 100644 libjava/classpath/javax/naming/LinkException.java
create mode 100644 libjava/classpath/javax/naming/LinkLoopException.java
create mode 100644 libjava/classpath/javax/naming/LinkRef.java
create mode 100644 libjava/classpath/javax/naming/MalformedLinkException.java
create mode 100644 libjava/classpath/javax/naming/Name.java
create mode 100644 libjava/classpath/javax/naming/NameAlreadyBoundException.java
create mode 100644 libjava/classpath/javax/naming/NameClassPair.java
create mode 100644 libjava/classpath/javax/naming/NameNotFoundException.java
create mode 100644 libjava/classpath/javax/naming/NameParser.java
create mode 100644 libjava/classpath/javax/naming/NamingEnumeration.java
create mode 100644 libjava/classpath/javax/naming/NamingException.java
create mode 100644 libjava/classpath/javax/naming/NamingSecurityException.java
create mode 100644 libjava/classpath/javax/naming/NoInitialContextException.java
create mode 100644 libjava/classpath/javax/naming/NoPermissionException.java
create mode 100644 libjava/classpath/javax/naming/NotContextException.java
create mode 100644 libjava/classpath/javax/naming/OperationNotSupportedException.java
create mode 100644 libjava/classpath/javax/naming/PartialResultException.java
create mode 100644 libjava/classpath/javax/naming/RefAddr.java
create mode 100644 libjava/classpath/javax/naming/Reference.java
create mode 100644 libjava/classpath/javax/naming/Referenceable.java
create mode 100644 libjava/classpath/javax/naming/ReferralException.java
create mode 100644 libjava/classpath/javax/naming/ServiceUnavailableException.java
create mode 100644 libjava/classpath/javax/naming/SizeLimitExceededException.java
create mode 100644 libjava/classpath/javax/naming/StringRefAddr.java
create mode 100644 libjava/classpath/javax/naming/TimeLimitExceededException.java
create mode 100644 libjava/classpath/javax/naming/directory/Attribute.java
create mode 100644 libjava/classpath/javax/naming/directory/AttributeInUseException.java
create mode 100644 libjava/classpath/javax/naming/directory/AttributeModificationException.java
create mode 100644 libjava/classpath/javax/naming/directory/Attributes.java
create mode 100644 libjava/classpath/javax/naming/directory/BasicAttribute.java
create mode 100644 libjava/classpath/javax/naming/directory/BasicAttributes.java
create mode 100644 libjava/classpath/javax/naming/directory/DirContext.java
create mode 100644 libjava/classpath/javax/naming/directory/InitialDirContext.java
create mode 100644 libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java
create mode 100644 libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java
create mode 100644 libjava/classpath/javax/naming/directory/InvalidAttributesException.java
create mode 100644 libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java
create mode 100644 libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java
create mode 100644 libjava/classpath/javax/naming/directory/ModificationItem.java
create mode 100644 libjava/classpath/javax/naming/directory/NoSuchAttributeException.java
create mode 100644 libjava/classpath/javax/naming/directory/SchemaViolationException.java
create mode 100644 libjava/classpath/javax/naming/directory/SearchControls.java
create mode 100644 libjava/classpath/javax/naming/directory/SearchResult.java
create mode 100644 libjava/classpath/javax/naming/directory/package.html
create mode 100644 libjava/classpath/javax/naming/event/EventContext.java
create mode 100644 libjava/classpath/javax/naming/event/EventDirContext.java
create mode 100644 libjava/classpath/javax/naming/event/NamespaceChangeListener.java
create mode 100644 libjava/classpath/javax/naming/event/NamingEvent.java
create mode 100644 libjava/classpath/javax/naming/event/NamingExceptionEvent.java
create mode 100644 libjava/classpath/javax/naming/event/NamingListener.java
create mode 100644 libjava/classpath/javax/naming/event/ObjectChangeListener.java
create mode 100644 libjava/classpath/javax/naming/event/package.html
create mode 100644 libjava/classpath/javax/naming/ldap/Control.java
create mode 100644 libjava/classpath/javax/naming/ldap/ControlFactory.java
create mode 100644 libjava/classpath/javax/naming/ldap/ExtendedRequest.java
create mode 100644 libjava/classpath/javax/naming/ldap/ExtendedResponse.java
create mode 100644 libjava/classpath/javax/naming/ldap/HasControls.java
create mode 100644 libjava/classpath/javax/naming/ldap/InitialLdapContext.java
create mode 100644 libjava/classpath/javax/naming/ldap/LdapContext.java
create mode 100644 libjava/classpath/javax/naming/ldap/LdapReferralException.java
create mode 100644 libjava/classpath/javax/naming/ldap/StartTlsRequest.java
create mode 100644 libjava/classpath/javax/naming/ldap/StartTlsResponse.java
create mode 100644 libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java
create mode 100644 libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java
create mode 100644 libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java
create mode 100644 libjava/classpath/javax/naming/ldap/package.html
create mode 100644 libjava/classpath/javax/naming/package.html
create mode 100644 libjava/classpath/javax/naming/spi/DirObjectFactory.java
create mode 100644 libjava/classpath/javax/naming/spi/DirStateFactory.java
create mode 100644 libjava/classpath/javax/naming/spi/DirectoryManager.java
create mode 100644 libjava/classpath/javax/naming/spi/InitialContextFactory.java
create mode 100644 libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java
create mode 100644 libjava/classpath/javax/naming/spi/NamingManager.java
create mode 100644 libjava/classpath/javax/naming/spi/ObjectFactory.java
create mode 100644 libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java
create mode 100644 libjava/classpath/javax/naming/spi/ResolveResult.java
create mode 100644 libjava/classpath/javax/naming/spi/Resolver.java
create mode 100644 libjava/classpath/javax/naming/spi/StateFactory.java
create mode 100644 libjava/classpath/javax/naming/spi/package.html
(limited to 'libjava/classpath/javax/naming')
diff --git a/libjava/classpath/javax/naming/AuthenticationException.java b/libjava/classpath/javax/naming/AuthenticationException.java
new file mode 100644
index 000000000..36310d3ad
--- /dev/null
+++ b/libjava/classpath/javax/naming/AuthenticationException.java
@@ -0,0 +1,55 @@
+/* AuthenticationException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class AuthenticationException extends NamingSecurityException
+{
+ private static final long serialVersionUID = 3678497619904568096L;
+
+ public AuthenticationException ()
+ {
+ super ();
+ }
+
+ public AuthenticationException (String msg)
+ {
+ super (msg);
+ }
+}
diff --git a/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java b/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java
new file mode 100644
index 000000000..9ebda40bb
--- /dev/null
+++ b/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java
@@ -0,0 +1,56 @@
+/* AuthenticationNotSupportedException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class AuthenticationNotSupportedException
+ extends NamingSecurityException
+{
+ private static final long serialVersionUID = - 7149033933259492300L;
+
+ public AuthenticationNotSupportedException ()
+ {
+ super ();
+ }
+
+ public AuthenticationNotSupportedException (String msg)
+ {
+ super (msg);
+ }
+}
diff --git a/libjava/classpath/javax/naming/BinaryRefAddr.java b/libjava/classpath/javax/naming/BinaryRefAddr.java
new file mode 100644
index 000000000..373802a8c
--- /dev/null
+++ b/libjava/classpath/javax/naming/BinaryRefAddr.java
@@ -0,0 +1,158 @@
+/* BinaryRefAddr.java -- RefAddr that uses a byte array as content.
+ Copyright (C) 2001 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.naming;
+
+import gnu.java.lang.CPStringBuilder;
+
+import java.util.Arrays;
+
+/**
+ * RefAddr that uses a byte array as content.
+ * This can be used to reference objects that can only be represented as
+ * byte arrays.
+ *
+ * @see Reference
+ * @since 1.3
+ * @author Mark Wielaard (mark@klomp.org)
+ */
+public class BinaryRefAddr extends RefAddr
+{
+ static final long serialVersionUID = -3415254970957330361L;
+
+ /**
+ * The possibly null content of this RefAddr.
+ * Set by the constructor and returned by getContent.
+ */
+ private final byte[] buf;
+
+ /**
+ * Contructs a new BinaryRefAddr with the given type and content.
+ * The complete content of the byte array is copied to a new array.
+ */
+ public BinaryRefAddr (String addrType, byte[] buf)
+ {
+ this(addrType, buf, 0, buf.length);
+ }
+
+ /**
+ * Contructs a new BinaryRefAddr with the given type and the content
+ * taken from the given byte array.
+ * The content of the byte array is copied to a new array.
+ */
+ public BinaryRefAddr (String addrType, byte[] buf, int off, int length)
+ {
+ super(addrType);
+ this.buf = new byte[length];
+ System.arraycopy(buf, off, this.buf, 0, length);
+ }
+
+ /**
+ * Returns the byte array contents as given to the constructor.
+ * The returned byte array is shared with this object and other callers.
+ * Changing the content of the buffer is discouraged and should only be
+ * done when the byte array is locked.
+ */
+ public Object getContent ()
+ {
+ return buf;
+ }
+
+ /**
+ * Checks if the object is a BinaryRefAddr with the same type and with the
+ * same bytes in the content.
+ *
+ * @return true if the given object is an instance of BinaryRefAddr,
+ * the addrType is the same as this addrType and the bytes of the
+ * content are the same.
+ */
+ public boolean equals(Object o)
+ {
+ if (o instanceof BinaryRefAddr)
+ {
+ BinaryRefAddr refAddr = (BinaryRefAddr) o;
+ if (this.getType().equals(refAddr.getType()))
+ {
+ byte[] c1 = (byte[]) this.getContent();
+ byte[] c2 = (byte[]) refAddr.getContent();
+ return Arrays.equals(c1, c2);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the hashCode which is the hasCode of the String returned by
+ * getType() plus the hashCode of the byte array returned by
+ * getContent. The hashCode of the byte array is calculated
+ * by taking the xor of all the bytes in the array, or zero when there are
+ * no bytes in the array.
+ */
+ public int hashCode()
+ {
+ int result = 0;
+ byte[] b = (byte[]) getContent();
+ for (int i=0; i < b.length; i++)
+ result = result^b[i];
+
+ return getType().hashCode() + result;
+ }
+
+ private static char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
+ /**
+ * Returns a String representation of the RefAddr. Only the first 32 bytes
+ * of the content are added as hex encoded characters.
+ * Should only be used for debugging purposes.
+ */
+ public String toString()
+ {
+ CPStringBuilder sb = new CPStringBuilder("[RefAddr type: ");
+ sb.append(getType());
+ sb.append(" content: 0x");
+ byte[] b = (byte[]) getContent();
+ for (int i=0; i < b.length && i < 32; i++)
+ {
+ sb.append(hex[(b[i]&0xf0)>>4]);
+ sb.append(hex[b[i]&0x0f]);
+ }
+ if (b.length > 32)
+ sb.append("...");
+ sb.append("]");
+ return sb.toString();
+ }
+}
diff --git a/libjava/classpath/javax/naming/Binding.java b/libjava/classpath/javax/naming/Binding.java
new file mode 100644
index 000000000..23bb4592e
--- /dev/null
+++ b/libjava/classpath/javax/naming/Binding.java
@@ -0,0 +1,164 @@
+/* Binding.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * Binding represents the name-object mapping of a
+ * binding in a context.
+ *
+ * Bindings are mappings of a name to an object and this class is used to
+ * specify such mappings. The bindings of a context are retrieved by the
+ * Context#listBindings() methods.
+ *
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @since 1.3
+ */
+public class Binding extends NameClassPair
+{
+ private static final long serialVersionUID = 8839217842691845890L;
+
+ /**
+ * Constructs an instance with the given name and object.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be null)
+ * @param obj the bound object
+ */
+ public Binding (String name, Object obj)
+ {
+ super (name, null);
+ boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance with the given name and object and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be null)
+ * @param obj the bound object
+ * @param isRelative flag indicating if the name is relative or not
+ */
+ public Binding (String name, Object obj, boolean isRelative)
+ {
+ super (name, null, isRelative);
+ boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance with the given name, classname and object.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be null)
+ * @param className the classname to set (maybe null)
+ * @param obj the bound object
+ */
+ public Binding (String name, String className, Object obj)
+ {
+ super (name, className);
+ boundObj = obj;
+ }
+
+ /**
+ * Constructs an instance with the given name, classname, object and a
+ * flag indicating if the name is relative to the target context.
+ *
+ * @param name the name of the binding relative to the target context
+ * (may not be null)
+ * @param className the classname to set (maybe null)
+ * @param isRelative flag indicating if the name is relative or not
+ * @param obj the bound object
+ */
+ public Binding (String name, String className, Object obj,
+ boolean isRelative)
+ {
+ super (name, className, isRelative);
+ boundObj = obj;
+ }
+
+ /**
+ * Returns the classname of the bound object.
+ *
+ * Returns the classname if set explicitly. If not and the bound object is
+ * not null the classname of the bound object is used.
+ *
+ *
+ * @return The fully qualified classname (may be null).
+ */
+ public String getClassName ()
+ {
+ String r = super.getClassName ();
+ if (r != null)
+ return r;
+ return boundObj == null ? null : boundObj.getClass ().getName ();
+ }
+
+ /**
+ * Returns the bound object of this binding.
+ * @return The bound object (maybe null).
+ */
+ public Object getObject ()
+ {
+ return boundObj;
+ }
+
+ /**
+ * Sets the bound object of this binding.
+ * @param obj the bound object.
+ */
+ public void setObject (Object obj)
+ {
+ boundObj = obj;
+ }
+
+ /**
+ * Returns the string representation.
+ * @return The string as given by the NameClassPair superclass plus
+ * the bound objects string representation seperated by a colon.
+ */
+ public String toString ()
+ {
+ // Format specified by the documentation.
+ return super.toString () + ":" + boundObj.toString ();
+ }
+
+ // This name is fixed by the serialization spec.
+ private Object boundObj;
+}
diff --git a/libjava/classpath/javax/naming/CannotProceedException.java b/libjava/classpath/javax/naming/CannotProceedException.java
new file mode 100644
index 000000000..26b1d0b0c
--- /dev/null
+++ b/libjava/classpath/javax/naming/CannotProceedException.java
@@ -0,0 +1,107 @@
+/* CannotProceedException.java --
+ Copyright (C) 2001, 2004, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy (warrenl@redhat.com)
+ * @date June 14, 2001
+ */
+
+public class CannotProceedException extends NamingException
+{
+ private static final long serialVersionUID = 1219724816191576813L;
+
+ // Serialized fields.
+ protected Name remainingNewName;
+ protected Hashtable, ?> environment;
+ protected Name altName;
+ protected Context altNameCtx;
+
+ public CannotProceedException ()
+ {
+ super ();
+ }
+
+ public CannotProceedException (String msg)
+ {
+ super (msg);
+ }
+
+ public Hashtable, ?> getEnvironment()
+ {
+ return environment;
+ }
+
+ public void setEnvironment(Hashtable, ?> environment)
+ {
+ this.environment = environment;
+ }
+
+ public Name getRemainingNewName()
+ {
+ return remainingNewName;
+ }
+
+ public void setRemainingNewName(Name newName)
+ {
+ remainingNewName = (Name) newName.clone();
+ }
+
+ public Name getAltName()
+ {
+ return altName;
+ }
+
+ public void setAltName(Name altName)
+ {
+ this.altName = altName;
+ }
+
+ public Context getAltNameCtx()
+ {
+ return altNameCtx;
+ }
+
+ public void setAltNameCtx(Context altNameCtx)
+ {
+ this.altNameCtx = altNameCtx;
+ }
+}
diff --git a/libjava/classpath/javax/naming/CommunicationException.java b/libjava/classpath/javax/naming/CommunicationException.java
new file mode 100644
index 000000000..485e5cd1d
--- /dev/null
+++ b/libjava/classpath/javax/naming/CommunicationException.java
@@ -0,0 +1,55 @@
+/* CommunicationException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class CommunicationException extends NamingException
+{
+ private static final long serialVersionUID = 3618507780299986611L;
+
+ public CommunicationException ()
+ {
+ super ();
+ }
+
+ public CommunicationException (String msg)
+ {
+ super (msg);
+ }
+}
diff --git a/libjava/classpath/javax/naming/CompositeName.java b/libjava/classpath/javax/naming/CompositeName.java
new file mode 100644
index 000000000..7d4d362bd
--- /dev/null
+++ b/libjava/classpath/javax/naming/CompositeName.java
@@ -0,0 +1,343 @@
+/* CompositeName.java --
+ Copyright (C) 2001, 2005, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import gnu.java.lang.CPStringBuilder;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+/**
+ * Represents names that may span over several namespaces. For instance,
+ * the composite name http://www.gnu.org/software/classpath/index.html spans
+ * over three namespaces (the protocol http, the web server location
+ * (www.gnu.org) and the index.html location on the server).
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ */
+public class CompositeName implements Name, Cloneable, Serializable
+{
+ private static final long serialVersionUID = 1667768148915813118L;
+
+ private transient Vector elts;
+
+ public CompositeName ()
+ {
+ elts = new Vector ();
+ }
+
+ protected CompositeName (Enumeration comps)
+ {
+ elts = new Vector ();
+ try
+ {
+ while (comps.hasMoreElements ())
+ elts.add (comps.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+
+ public CompositeName (String n) throws InvalidNameException
+ {
+ elts = new Vector ();
+ // Parse the string into its components.
+ final char no_quote = 'x'; // Use 'x' to mean no quoting.
+ char quote = no_quote;
+ boolean escaped = false;
+ StringBuilder new_element = new StringBuilder ();
+ for (int i = 0; i < n.length (); ++i)
+ {
+ char c = n.charAt (i);
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ {
+ escaped = true;
+ continue;
+ }
+ else if (quote != no_quote)
+ {
+ if (quote == c)
+ {
+ // The quotes must surround a complete component.
+ if (i + 1 < n.length () && n.charAt (i + 1) != '/')
+ throw new InvalidNameException ("close quote before end of component");
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ quote = no_quote;
+ continue;
+ }
+ // Otherwise, fall through.
+ }
+ // Quotes are only special at the start of a component.
+ else if (new_element.length () == 0
+ && (c == '\'' || c == '"'))
+ {
+ quote = c;
+ continue;
+ }
+ else if (c == '/')
+ {
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ continue;
+ }
+
+ new_element.append (c);
+ }
+
+ if (new_element.length () != 0)
+ elts.add (new_element.toString ());
+
+ // Error checking.
+ if (quote != no_quote)
+ throw new InvalidNameException ("unterminated quote");
+ if (escaped)
+ throw new InvalidNameException ("trailing escape character");
+ }
+
+ public Name add (int posn, String comp) throws InvalidNameException
+ {
+ elts.add (posn, comp);
+ return this;
+ }
+
+ public Name add (String comp) throws InvalidNameException
+ {
+ elts.add (comp);
+ return this;
+ }
+
+ public Name addAll (int posn, Name n) throws InvalidNameException
+ {
+ Enumeration e = n.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ {
+ elts.add (posn, e.nextElement ());
+ ++posn;
+ }
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Name addAll (Name suffix) throws InvalidNameException
+ {
+ Enumeration e = suffix.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ elts.add (e.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Object clone ()
+ {
+ return new CompositeName (elts.elements ());
+ }
+
+ public int compareTo (Object obj)
+ {
+ if (obj == null || ! (obj instanceof CompositeName))
+ throw new ClassCastException ("CompositeName.compareTo() expected CompositeName");
+ CompositeName cn = (CompositeName) obj;
+ int last = Math.min (cn.elts.size (), elts.size ());
+ for (int i = 0; i < last; ++i)
+ {
+ String f = elts.get (i);
+ int comp = f.compareTo (cn.elts.get (i));
+ if (comp != 0)
+ return comp;
+ }
+ return elts.size () - cn.elts.size ();
+ }
+
+ public boolean endsWith (Name n)
+ {
+ if (! (n instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ int delta = elts.size () - cn.elts.size ();
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ if (! cn.elts.get (i).equals (elts.get (delta + i)))
+ return false;
+ }
+ return true;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) obj;
+ return elts.equals (cn.elts);
+ }
+
+ public String get (int posn)
+ {
+ return elts.get (posn);
+ }
+
+ public Enumeration getAll ()
+ {
+ return elts.elements ();
+ }
+
+ public Name getPrefix (int posn)
+ {
+ CompositeName cn = new CompositeName ();
+ for (int i = 0; i < posn; ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public Name getSuffix (int posn)
+ {
+ if (posn > elts.size ())
+ throw new ArrayIndexOutOfBoundsException (posn);
+ CompositeName cn = new CompositeName ();
+ for (int i = posn; i < elts.size (); ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public int hashCode ()
+ {
+ // Specified in documentation.
+ int h = 0;
+ for (int i = 0; i < elts.size (); ++i)
+ h += elts.get (i).hashCode ();
+ return h;
+ }
+
+ public boolean isEmpty ()
+ {
+ return elts.isEmpty ();
+ }
+
+ public Object remove (int posn) throws InvalidNameException
+ {
+ return elts.remove (posn);
+ }
+
+ public int size ()
+ {
+ return elts.size ();
+ }
+
+ public boolean startsWith (Name n)
+ {
+ if (! (n instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ if (! cn.elts.get (i).equals (elts.get (i)))
+ return false;
+ }
+ return true;
+ }
+
+ public String toString ()
+ {
+ CPStringBuilder result = new CPStringBuilder ();
+ for (int i = 0; i < elts.size (); ++i)
+ {
+ // For simplicity we choose to always quote using escapes and
+ // never quotes.
+ String elt = elts.get (i);
+ if (i > 0
+ || (i == elts.size () - 1 && elt.equals ("")))
+ result.append ('/');
+ for (int k = 0; k < elt.length (); ++k)
+ {
+ char c = elt.charAt (k);
+ // We must quote
+ // ... a leading quote,
+ if ((k == 0 && (c == '"' || c == '\''))
+ // ... an escape preceding a meta character,
+ // or at the end of a component,
+ || (c == '\\'
+ && (k == elt.length () - 1
+ || "\\'\"/".indexOf (elt.charAt (k + 1)) != -1))
+ // ... or a component separator.
+ || c == '/')
+ result.append ('\\');
+ result.append (c);
+ }
+ }
+ return result.toString ();
+ }
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ int size = s.readInt();
+ elts = new Vector(size);
+ for (int i = 0; i < size; i++)
+ elts.add((String) s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s) throws IOException
+ {
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.get(i));
+ }
+}
diff --git a/libjava/classpath/javax/naming/CompoundName.java b/libjava/classpath/javax/naming/CompoundName.java
new file mode 100644
index 000000000..d410f6a97
--- /dev/null
+++ b/libjava/classpath/javax/naming/CompoundName.java
@@ -0,0 +1,523 @@
+/* CompoundName.java --
+ Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import gnu.java.lang.CPStringBuilder;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.Vector;
+
+/**
+ * Represents hierarchical names from the single namespace. For instance,
+ * the path /home/audriusa/classpath/file.txt is the compound name, using
+ * the filesystem namespace.
+ *
+ * @author Tom Tromey (tromey@redhat.com)
+ * @date May 16, 2001
+ *
+ * FIXME: this class is underspecified. For instance, the `flat'
+ * direction is never described. If it means that the CompoundName
+ * can only have a single element, then the Enumeration-based
+ * constructor ought to throw InvalidNameException.
+ *
+ * @since 1.3
+ */
+public class CompoundName implements Name, Cloneable, Serializable
+{
+ private static final long serialVersionUID = 3513100557083972036L;
+
+ private CompoundName (Properties syntax)
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+ }
+
+ protected CompoundName (Enumeration comps, Properties syntax)
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+ try
+ {
+ while (comps.hasMoreElements ())
+ elts.add (comps.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+
+ public CompoundName (String n, Properties syntax)
+ throws InvalidNameException
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+
+ StringBuilder new_element = new StringBuilder ();
+ int i = 0;
+ // QUOTE==null means no quoting right now. When it is set it is
+ // the value of the closing quote.
+ String quote = null;
+ while (i < n.length ())
+ {
+ String special = isSpecial (n, i);
+
+ if (special == escape && escape != null)
+ {
+ if (n.length () == i + special.length ())
+ {
+ // A trailing escape is treated as itself.
+ new_element.append (special);
+ i += special.length ();
+ }
+ else
+ {
+ String eSpecial = isSpecial (n, i + special.length ());
+ if (eSpecial != null)
+ {
+ // Treat the escape as an escape.
+ new_element.append (eSpecial);
+ i += special.length () + eSpecial.length ();
+ }
+ else
+ {
+ // Treat the escape as itself.
+ new_element.append (special);
+ i += special.length ();
+ }
+ continue;
+ }
+ }
+ else if (quote != null)
+ {
+ // It is safe to use == here.
+ if (quote == special)
+ {
+ // Quotes must surround a complete component.
+ if (i + quote.length () < n.length ()
+ && ! n.startsWith (separator, i + quote.length ()))
+ throw new InvalidNameException ("close quote before end of component");
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ i += quote.length ();
+ quote = null;
+ continue;
+ }
+ // Otherwise, fall through.
+ }
+ // Quotes are only special at the start of a component.
+ else if (new_element.length () == 0
+ && special == beginQuote
+ && beginQuote != null)
+ {
+ quote = endQuote;
+ i += special.length ();
+ continue;
+ }
+ else if (new_element.length () == 0
+ && special == beginQuote2
+ && beginQuote2 != null)
+ {
+ quote = endQuote2;
+ i += special.length ();
+ continue;
+ }
+ else if (direction != FLAT && special == separator)
+ {
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ i += special.length ();
+ continue;
+ }
+
+ // Nothing in particular, so try the next character.
+ new_element.append (n.charAt (i));
+ ++i;
+ }
+
+ if (new_element.length () != 0)
+ elts.add (new_element.toString ());
+
+ if (direction == RIGHT_TO_LEFT)
+ {
+ // Reverse the order of the elements.
+ int len = elts.size ();
+ for (i = 0; i < len / 2; ++i)
+ {
+ String t = elts.set (i, elts.get (len - i - 1));
+ elts.set (len - i - 1, t);
+ }
+ }
+
+ // Error checking.
+ if (quote != null)
+ throw new InvalidNameException ("unterminated quote");
+ }
+
+ public Name add (int posn, String comp) throws InvalidNameException
+ {
+ elts.add (posn, comp);
+ return this;
+ }
+
+ public Name add (String comp) throws InvalidNameException
+ {
+ elts.add (comp);
+ return this;
+ }
+
+ public Name addAll (int posn, Name n) throws InvalidNameException
+ {
+ Enumeration e = n.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ {
+ elts.add (posn, e.nextElement ());
+ ++posn;
+ }
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Name addAll (Name suffix) throws InvalidNameException
+ {
+ Enumeration e = suffix.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ elts.add (e.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Object clone ()
+ {
+ return new CompoundName (elts.elements (), mySyntax);
+ }
+
+ public int compareTo (Object obj)
+ {
+ if (! (obj instanceof CompoundName))
+ throw new ClassCastException ("CompoundName.compareTo() expected CompoundName");
+ CompoundName cn = (CompoundName) obj;
+ int last = Math.min (cn.elts.size (), elts.size ());
+ for (int i = 0; i < last; ++i)
+ {
+ String f = canonicalize (elts.get (i));
+ int comp = f.compareTo (canonicalize (cn.elts.get (i)));
+ if (comp != 0)
+ return comp;
+ }
+ return elts.size () - cn.elts.size ();
+ }
+
+ public boolean endsWith (Name n)
+ {
+ if (! (n instanceof CompoundName))
+ return false;
+ CompoundName cn = (CompoundName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ int delta = elts.size () - cn.elts.size ();
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ String f = canonicalize (elts.get (delta + i));
+ if (! f.equals (canonicalize (cn.elts.get (i))))
+ return false;
+ }
+ return true;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof CompoundName))
+ return false;
+ return compareTo (obj) == 0;
+ }
+
+ public String get (int posn)
+ {
+ return elts.get (posn);
+ }
+
+ public Enumeration getAll ()
+ {
+ return elts.elements ();
+ }
+
+ public Name getPrefix (int posn)
+ {
+ CompoundName cn = new CompoundName (mySyntax);
+ for (int i = 0; i < posn; ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public Name getSuffix (int posn)
+ {
+ if (posn > elts.size ())
+ throw new ArrayIndexOutOfBoundsException (posn);
+ CompoundName cn = new CompoundName (mySyntax);
+ for (int i = posn; i < elts.size (); ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public int hashCode ()
+ {
+ int h = 0;
+ for (int i = 0; i < elts.size (); ++i)
+ h += canonicalize (elts.get (i)).hashCode ();
+ return h;
+ }
+
+ public boolean isEmpty ()
+ {
+ return elts.isEmpty ();
+ }
+
+ public Object remove (int posn) throws InvalidNameException
+ {
+ return elts.remove (posn);
+ }
+
+ public int size ()
+ {
+ return elts.size ();
+ }
+
+ public boolean startsWith (Name n)
+ {
+ if (! (n instanceof CompoundName))
+ return false;
+ CompoundName cn = (CompoundName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ String f = canonicalize (elts.get (i));
+ if (! f.equals (canonicalize (cn.elts.get (i))))
+ return false;
+ }
+ return true;
+ }
+
+ // If ELEMENT starts with some meta-sequence at OFFSET, then return
+ // the string representing the meta-sequence. Otherwise return
+ // null.
+ private String isSpecial (String element, int offset)
+ {
+ String special = null;
+ if (separator != null && element.startsWith (separator, offset))
+ special = separator;
+ else if (escape != null && element.startsWith (escape, offset))
+ special = escape;
+ else if (beginQuote != null && element.startsWith (beginQuote, offset))
+ special = beginQuote;
+ else if (endQuote != null && element.startsWith (endQuote, offset))
+ special = endQuote;
+ else if (beginQuote2 != null
+ && element.startsWith (beginQuote2, offset))
+ special = beginQuote2;
+ else if (endQuote2 != null && element.startsWith (endQuote2, offset))
+ special = endQuote2;
+
+ return special;
+ }
+
+ public String toString ()
+ {
+ CPStringBuilder result = new CPStringBuilder ();
+ int size = elts.size ();
+ for (int i = 0; i < size; ++i)
+ {
+ // Find the appropriate element. FIXME: not clear what FLAT
+ // means.
+ int offset = (direction == RIGHT_TO_LEFT) ? (size - i - 1) : i;
+ String element = elts.get (offset);
+ if (i > 0
+ || (i == size - 1 && element.equals ("")))
+ result.append (separator);
+
+ int k = 0;
+ while (k < element.length ())
+ {
+ String special = isSpecial (element, k);
+ if (special != null)
+ {
+ result.append (escape);
+ result.append (special);
+ k += special.length ();
+ }
+ else
+ {
+ result.append (element.charAt (k));
+ ++k;
+ }
+ }
+ }
+
+ return result.toString ();
+ }
+
+ // This canonicalizes a String, based on the syntax, for comparison
+ // or other similar purposes.
+ private String canonicalize (String element)
+ {
+ String ret = element;
+
+ if (ignoreCase)
+ ret = ret.toLowerCase ();
+
+ if (trimBlanks)
+ {
+ int first = 0;
+ while (first < ret.length ()
+ && Character.isWhitespace (ret.charAt (first)))
+ ++first;
+
+ int last = ret.length () - 1;
+ while (last >= first
+ && Character.isWhitespace (ret.charAt (last)))
+ --last;
+
+ ret = ret.substring (first, last);
+ }
+
+ return ret;
+ }
+
+ // This initializes all the syntax variables. This seems easier
+ // than re-querying the properties every time. We're allowed to do
+ // this because the spec says that subclasses should consider the
+ // syntax as being read-only.
+ private void initializeSyntax ()
+ {
+ String t = mySyntax.getProperty ("jndi.syntax.direction", "flat");
+ if (t.equals ("right_to_left"))
+ this.direction = RIGHT_TO_LEFT;
+ else if (t.equals ("left_to_right"))
+ this.direction = LEFT_TO_RIGHT;
+ else
+ {
+ // If we don't recognize it, default to flat.
+ this.direction = FLAT;
+ }
+
+ // This is required unless the direction is FLAT. Unfortunately
+ // there is no way to report this error.
+ this.separator = mySyntax.getProperty ("jndi.syntax.separator", "");
+
+ this.ignoreCase
+ = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.ignorecase",
+ "false")).booleanValue ();
+ this.escape = mySyntax.getProperty ("jndi.syntax.escape", null);
+ this.beginQuote = mySyntax.getProperty ("jndi.syntax.beginquote", null);
+ this.endQuote = mySyntax.getProperty ("jndi.syntax.endquote",
+ this.beginQuote);
+ this.beginQuote2 = mySyntax.getProperty ("jndi.syntax.beginquote2",
+ null);
+ this.endQuote2 = mySyntax.getProperty ("jndi.syntax.endquote2",
+ this.beginQuote2);
+ this.trimBlanks
+ = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.trimblanks",
+ "false")).booleanValue ();
+ }
+
+ private void readObject(ObjectInputStream s)
+ throws IOException, ClassNotFoundException
+ {
+ mySyntax = (Properties) s.readObject();
+ int count = s.readInt();
+ elts = new Vector(count);
+ for (int i = 0; i < count; i++)
+ elts.addElement((String) s.readObject());
+ }
+
+ private void writeObject(ObjectOutputStream s)
+ throws IOException
+ {
+ s.writeObject(mySyntax);
+ s.writeInt(elts.size());
+ for (int i = 0; i < elts.size(); i++)
+ s.writeObject(elts.elementAt(i));
+ }
+
+ // The spec specifies this but does not document it in any way (it
+ // is a package-private class). It is useless as far as I can tell.
+ // So we ignore it.
+ // protected transient NameImpl impl;
+ protected transient Properties mySyntax;
+
+ // The actual elements.
+ private transient Vector elts;
+
+ // The following are all used for syntax.
+ private transient int direction;
+ private transient String separator;
+ private transient boolean ignoreCase;
+ private transient String escape;
+ private transient String beginQuote;
+ private transient String endQuote;
+ private transient String beginQuote2;
+ private transient String endQuote2;
+ private transient boolean trimBlanks;
+ // We didn't need these for parsing, so they are gone.
+ // private transient String avaSeparator;
+ // private transient String typevalSeparator;
+
+ private static final int RIGHT_TO_LEFT = -1;
+ private static final int LEFT_TO_RIGHT = 1;
+ private static final int FLAT = 0;
+}
diff --git a/libjava/classpath/javax/naming/ConfigurationException.java b/libjava/classpath/javax/naming/ConfigurationException.java
new file mode 100644
index 000000000..eb2fbfeec
--- /dev/null
+++ b/libjava/classpath/javax/naming/ConfigurationException.java
@@ -0,0 +1,55 @@
+/* ConfigurationException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+
+public class ConfigurationException extends NamingException
+{
+ private static final long serialVersionUID = - 2535156726228855704L;
+
+ public ConfigurationException ()
+ {
+ super ();
+ }
+
+ public ConfigurationException (String msg)
+ {
+ super (msg);
+ }
+}
diff --git a/libjava/classpath/javax/naming/Context.java b/libjava/classpath/javax/naming/Context.java
new file mode 100644
index 000000000..35217ffc4
--- /dev/null
+++ b/libjava/classpath/javax/naming/Context.java
@@ -0,0 +1,492 @@
+/* Context.java -- A naming context
+ Copyright (C) 2000, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.util.Hashtable;
+
+import javax.naming.directory.InvalidAttributesException;
+
+public interface Context
+{
+ /**
+ * Property with name of the inital context factory to use
+ */
+ String INITIAL_CONTEXT_FACTORY = "java.naming.factory.initial";
+
+ /**
+ * Property with colon-separated list of object factories to use.
+ */
+ String OBJECT_FACTORIES = "java.naming.factory.object";
+
+ /**
+ * Property with colon-separated list of state factories to use.
+ */
+ String STATE_FACTORIES = "java.naming.factory.state";
+
+ /**
+ * Property with colon-separated list of package prefixes to use.
+ */
+ String URL_PKG_PREFIXES = "java.naming.factory.url.pkgs";
+
+ /**
+ * Property with URL specifying configuration for the service provider to use.
+ */
+ String PROVIDER_URL = "java.naming.provider.url";
+
+ /**
+ * Property with the DNS host and domain names to use.
+ */
+ String DNS_URL = "java.naming.dns.url";
+
+ /**
+ * Property with the authoritativeness of the service requested.
+ */
+ String AUTHORITATIVE = "java.naming.authoritative";
+
+ /**
+ * Property with the batch size to use when returning data via the service's
+ * protocol.
+ */
+ String BATCHSIZE = "java.naming.batchsize";
+
+ /**
+ * Property defining how referrals encountered by the service provider are to
+ * be processed.
+ */
+ String REFERRAL = "java.naming.referral";
+
+ /**
+ * Property specifying the security protocol to use.
+ */
+ String SECURITY_PROTOCOL = "java.naming.security.protocol";
+
+ /**
+ * Property specifying the security level to use.
+ */
+ String SECURITY_AUTHENTICATION = "java.naming.security.authentication";
+
+ /**
+ * Property for the identity of the principal for authenticating the caller to
+ * the service.
+ */
+ String SECURITY_PRINCIPAL = "java.naming.security.principal";
+
+ /**
+ * Property specifying the credentials of the principal for authenticating the
+ * caller to the service.
+ */
+ String SECURITY_CREDENTIALS = "java.naming.security.credentials";
+
+ /**
+ * Property for specifying the preferred language to use with the service.
+ */
+ String LANGUAGE = "java.naming.language";
+
+ /**
+ * Property for the initial context constructor to use when searching for
+ * other properties.
+ */
+ String APPLET = "java.naming.applet";
+
+ /**
+ * Give the specified name for the specified object. The passed name must not
+ * be already bound to some other object.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws NameAlreadyBoundException if this name is already used to name some
+ * object.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void bind(Name name, Object obj) throws NamingException;
+
+ /**
+ * Give the specified name for the specified object. The passed name must not
+ * be already bound to some other object.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws NameAlreadyBoundException if this name is already used to name some
+ * object.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void bind(String name, Object obj) throws NamingException;
+
+ /**
+ * Gets the previously named object by name. If the passed name is empty, the
+ * method should return a cloned instance of this naming context.
+ *
+ * @param name the name of the object being searched in this context
+ * @return the named object
+ * @throws NamingException if the naming fails.
+ */
+ Object lookup(Name name) throws NamingException;
+
+ /**
+ * Gets the previously named object by name. If the passed name is empty, the
+ * method should return a cloned instance of this naming context.
+ *
+ * @param name the name of the object being searched in this context
+ * @return the named object
+ * @throws NamingException if the naming fails.
+ */
+ Object lookup(String name) throws NamingException;
+
+ /**
+ * Give the specified name for the specified object. Unlike bind, this method
+ * silently replaces the existing binding for this name, if one exists.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rebind(Name name, Object obj) throws NamingException;
+
+ /**
+ * Give the specified name for the specified object. Unlike bind, this method
+ * silently replaces the existing binding for this name, if one exists.
+ *
+ * @param name the name that will be given to the object (in the scope of this
+ * context).
+ * @param obj the object being named.
+ * @throws InvalidAttributesException if the object does not supply all
+ * required attributes.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rebind(String name, Object obj) throws NamingException;
+
+ /**
+ * Removes the name - object mapping from the current context. This method
+ * returns without action if the name is not bound to an object in the
+ * terminal context, but throws {@link NameNotFoundException} if one of the
+ * intermadiate contexts does not exist.
+ *
+ * @param name the name to be removed
+ * @throws NameNotFoundException if one of the intermediate naming contexts
+ * does not exist. Will not be thrown if just the terminal binding
+ * is missing.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void unbind(Name name) throws NamingException;
+
+ /**
+ * Removes the name - object mapping from the current context. This method
+ * returns without action if the name is not bound to an object in the
+ * terminal context, but throws {@link NameNotFoundException} if one of the
+ * intermadiate contexts does not exist.
+ *
+ * @param name the name to be removed
+ * @throws NameNotFoundException if one of the intermediate naming contexts
+ * does not exist. Will not be thrown if just the terminal binding
+ * is missing.
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void unbind(String name) throws NamingException;
+
+ /**
+ * Renames the existing binding, removing the existing and giving the new name
+ * for the same object.
+ *
+ * @param oldName the existing name of the known object
+ * @param newName the new name of the same object
+ * @throws NameNotFoundException if the oldName is unknown for this context
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rename(Name oldName, Name newName) throws NamingException;
+
+ /**
+ * Renames the existing binding, removing the existing and giving the new name
+ * for the same object.
+ *
+ * @param oldName the existing name of the known object
+ * @param newName the new name of the same object
+ * @throws NameNotFoundException if the oldName is unknown for this context
+ * @throws NamingException if the naming operation has failed due other
+ * reasons.
+ */
+ void rename(String oldName, String newName) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name bindings that are present
+ * the given subcontext. The enumeration elements have the type of
+ * {@link NameClassPair}, providing also information about the class of the
+ * bound object. The behaviour in the case if the bindings are added or
+ * removed later is not defined. The contents of the subcontexts are not
+ * included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration list(Name name) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name bindings that are present
+ * the given subcontext. The enumeration elements have the type of
+ * {@link NameClassPair}, providing also information about the class of the
+ * bound object. The behaviour in the case if the bindings are added or
+ * removed later is not defined. The contents of the subcontexts are not
+ * included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration list(String name) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name - object bindings that
+ * are present the given subcontext. The enumeration elements have the type of
+ * {@link Binding}, providing also information about the class of the bound
+ * object. The behaviour in the case if the bindings are added or removed
+ * later is not defined. The contents of the subcontexts are not included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration listBindings(Name name) throws NamingException;
+
+ /**
+ * Creates and returns the enumeration over the name - object bindings that
+ * are present the given subcontext. The enumeration elements have the type of
+ * {@link Binding}, providing also information about the class of the bound
+ * object. The behaviour in the case if the bindings are added or removed
+ * later is not defined. The contents of the subcontexts are not included.
+ *
+ * @param name the name of the subcontext
+ * @return the enumeration over the names, known for the given subcontext.
+ * @throws NamingException
+ */
+ NamingEnumeration listBindings(String name) throws NamingException;
+
+ /**
+ * Creates the new naming subcontext and binds it to the current (this)
+ * context.
+ *
+ * @param name the name of the new context being created
+ * @return the newly created context, bound to the instance of the context on
+ * that the method has been called
+ * @throws NameAlreadyBoundException if this name is already bound
+ * @throws InvalidAttributesException if the creation of the new context
+ * requires the missing mandatory attributes
+ * @throws NamingException
+ */
+ Context createSubcontext(Name name) throws NamingException;
+
+ /**
+ * Creates the new naming subcontext and binds it to the current (this)
+ * context.
+ *
+ * @param name the name of the new context being created
+ * @return the newly created context, bound to the instance of the context on
+ * that the method has been called
+ * @throws NameAlreadyBoundException if this name is already bound
+ * @throws InvalidAttributesException if the creation of the new context
+ * requires the missing mandatory attributes
+ * @throws NamingException
+ */
+ Context createSubcontext(String name) throws NamingException;
+
+ /**
+ * Removes the naming subcontext from this naming context. Returns without
+ * action if such subcontext does not exist. The context being destroyed must
+ * be empty.
+ *
+ * @param name the name of the subcontext beig removed.
+ * @throws ContextNotEmptyException if the named context is not empty.
+ * @throws NamingException
+ */
+ void destroySubcontext(Name name) throws NamingException;
+
+ /**
+ * Removes the naming subcontext from this naming context. Returns without
+ * action if such subcontext does not exist. The context being destroyed must
+ * be empty.
+ *
+ * @param name the name of the subcontext beig removed.
+ * @throws ContextNotEmptyException if the named context is not empty.
+ * @throws NamingException
+ */
+ void destroySubcontext(String name) throws NamingException;
+
+ /**
+ * Retrieves the named object, not following the link of the terminal atomic
+ * component of the name. If the object, named by the passed name, is not a
+ * link, returns that object itself. The intermediate links, if present, are
+ * followed.
+ *
+ * @param name the name of the object that may be a link, leading to another
+ * object.
+ * @return the named object, not following the terminal link (if present).
+ * @throws NamingException
+ */
+ Object lookupLink(Name name) throws NamingException;
+
+ /**
+ * Retrieves the named object, not following the link of the terminal atomic
+ * component of the name. If the object, named by the passed name, is not a
+ * link, returns that object itself. The intermediate links, if present, are
+ * followed.
+ *
+ * @param name the name of the object that may be a link, leading to another
+ * object.
+ * @return the named object, not following the terminal link (if present).
+ * @throws NamingException
+ */
+ Object lookupLink(String name) throws NamingException;
+
+ /**
+ * Obtains the name parser for parsing the names of the given naming
+ * subcontext.
+ *
+ * @param name the name of the subcontext for that the parser must be obtained
+ * @return the parser to parse the names of that context
+ * @throws NamingException
+ */
+ NameParser getNameParser(Name name) throws NamingException;
+
+ /**
+ * Obtains the name parser for parsing the names of the given naming
+ * subcontext.
+ *
+ * @param name the name of the subcontext for that the parser must be obtained
+ * @return the parser to parse the names of that context
+ * @throws NamingException
+ */
+ NameParser getNameParser(String name) throws NamingException;
+
+ /**
+ * Composes the name of this context together with another name, related to
+ * this context.
+ *
+ * @param name a name, defined in the scope of this context
+ * @param prefix a name of this context itself, defined in the scope of some
+ * ancestor
+ * @return the name of the same object as named by the first parameter, but
+ * related to the context of the specified ancestor.
+ * @throws NamingException
+ */
+ Name composeName(Name name, Name prefix) throws NamingException;
+
+ /**
+ * Composes the name of this context together with another name, related to
+ * this context.
+ *
+ * @param name a name, defined in the scope of this context
+ * @param prefix a name of this context itself, defined in the scope of some
+ * ancestor
+ * @return the name of the same object as named by the first parameter, but
+ * related to the context of the specified ancestor.
+ * @throws NamingException
+ */
+ String composeName(String name, String prefix) throws NamingException;
+
+ /**
+ * Add new environment property to the environment of this context. Both name
+ * and value of the new property must not be null. If the property is already
+ * defined, is current value is replaced by the propVal.
+ *
+ * @param propName the name of the new property
+ * @param propVal the value of the new property
+ * @return the previous value of this property or null if the property has not
+ * been previously defined
+ * @throws NamingException
+ */
+ Object addToEnvironment(String propName, Object propVal)
+ throws NamingException;
+
+ /**
+ * Removes the property with the given name from the environment. Returns
+ * without action if this property is not defined.
+ *
+ * @param propName the name of the property being removed.
+ * @return the value of the property that has been removed or null if the
+ * property was not defined.
+ * @throws NamingException
+ */
+ Object removeFromEnvironment(String propName) throws NamingException;
+
+ /**
+ * Returns the environment, associated with this naming context. The returned
+ * table should never be modified by the caller. Use {@link #addToEnvironment}
+ * and {@link #removeFromEnvironment} to modify the environement, if needed.
+ *
+ * @return the table, representing the environment of this context
+ * @throws NamingException
+ */
+ Hashtable,?> getEnvironment() throws NamingException;
+
+ /**
+ * Releases all resources, associated with this context. The close() method
+ * can be called several times, but after it has been once invoked, it is not
+ * allowed to call any other method of this context,
+ *
+ * @throws NamingException
+ */
+ void close() throws NamingException;
+
+ /**
+ * Returs the full name of this naming context. The returned string is not a
+ * JNDI composite name and should not be passed directly to the methods of the
+ * naming context.
+ *
+ * @return the full name of this naming context, in its own namespace.
+ * @throws OperationNotSupportedException if the naming system, represented by
+ * this context, does not support the notation of the full name.
+ * @throws NamingException
+ */
+ String getNameInNamespace() throws NamingException;
+}
diff --git a/libjava/classpath/javax/naming/ContextNotEmptyException.java b/libjava/classpath/javax/naming/ContextNotEmptyException.java
new file mode 100644
index 000000000..816e70312
--- /dev/null
+++ b/libjava/classpath/javax/naming/ContextNotEmptyException.java
@@ -0,0 +1,60 @@
+/* ContextNotEmptyException.java --
+ Copyright (C) 2000, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+/**
+ * This exception is thrown in response to the attempt to destroy the non
+ * empty context. Only empty contexts (without bindings) can be destroyed.
+ *
+ * @see Context#destroySubcontext
+ */
+public class ContextNotEmptyException extends NamingException
+{
+ private static final long serialVersionUID = 1090963683348219877L;
+
+ public ContextNotEmptyException ()
+ {
+ super ();
+ }
+
+ public ContextNotEmptyException (String msg)
+ {
+ super (msg);
+ }
+}
diff --git a/libjava/classpath/javax/naming/InitialContext.java b/libjava/classpath/javax/naming/InitialContext.java
new file mode 100644
index 000000000..c33122adf
--- /dev/null
+++ b/libjava/classpath/javax/naming/InitialContext.java
@@ -0,0 +1,548 @@
+/* InitialContext.java -- Initial naming context.
+ Copyright (C) 2000, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath 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 for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.naming;
+
+import java.applet.Applet;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Properties;
+
+import javax.naming.spi.NamingManager;
+
+/**
+ * The starting context for performing naming operations. All naming operations
+ * are performed in the scope of some context. The initial context is the
+ * starting point for the name resolution.
+ */
+public class InitialContext implements Context
+{
+ /**
+ * Contains the default initial context. This value is returned by
+ * {@link NamingManager#getInitialContext}. It is set by this method
+ * when calling it first time. The subsequent calls return the value of
+ * this field.
+ */
+ protected Context defaultInitCtx;
+
+ /**
+ * Indicates if the initial context was obtained by calling
+ * {@link NamingManager#getInitialContext}.
+ */
+ protected boolean gotDefault = false;
+
+ /**
+ * The environment, associated with this initial context.
+ */
+ protected Hashtable
+ *
+ * @param environment the table of the properties, may be null. The method
+ * modifies the table and stores the reference to it. The caller must
+ * not later reuse this structure for other purposes.
+ * @since 1.3
+ */
+ protected void init(Hashtable, ?> environment) throws NamingException
+ {
+ // If is documented that the caller should not modify the environment.
+ if (environment != null)
+ myProps = (Hashtable