diff options
author | Mark Wielaard <mark@klomp.org> | 2002-11-23 21:44:28 +0000 |
---|---|---|
committer | Mark Wielaard <mark@klomp.org> | 2002-11-23 21:44:28 +0000 |
commit | b61bf64712b988823f3a1d18ba05c33c30e53325 (patch) | |
tree | 829e89993782808f59ca69a0fc10b342ab382d9f /javax | |
parent | 1f4bcf34c963b6f098d0ef1d251b1ac32b055c10 (diff) | |
download | classpath-b61bf64712b988823f3a1d18ba05c33c30e53325.tar.gz |
* javax/naming/AuthenticationException.java: Import file from libgcj.
* javax/naming/AuthenticationNotSupportedException.java: Likewise.
* javax/naming/Binding.java: Likewise.
* javax/naming/CannotProceedException.java: Likewise.
* javax/naming/CommunicationException.java: Likewise.
* javax/naming/CompositeName.java: Likewise.
* javax/naming/CompoundName.java: Likewise.
* javax/naming/ConfigurationException.java: Likewise.
* javax/naming/Context.java: Likewise.
* javax/naming/ContextNotEmptyException.java: Likewise.
* javax/naming/InitialContext.java: Likewise.
* javax/naming/InsufficientResourcesException.java: Likewise.
* javax/naming/InterruptedNamingException.java: Likewise.
* javax/naming/LimitExceededException.java: Likewise.
* javax/naming/LinkException.java: Likewise.
* javax/naming/LinkLoopException.java: Likewise.
* javax/naming/LinkRef.java: Likewise.
* javax/naming/MalformedLinkException.java: Likewise.
* javax/naming/NameAlreadyBoundException.java: Likewise.
* javax/naming/NameClassPair.java: Likewise.
* javax/naming/NameNotFoundException.java: Likewise.
* javax/naming/NameParser.java: Likewise.
* javax/naming/NamingEnumeration.java: Likewise.
* javax/naming/NamingSecurityException.java: Likewise.
* javax/naming/NoInitialContextException.java: Likewise.
* javax/naming/NoPermissionException.java: Likewise.
* javax/naming/NotContextException.java: Likewise.
* javax/naming/OperationNotSupportedException.java: Likewise.
* javax/naming/PartialResultException.java: Likewise.
* javax/naming/Reference.java: Likewise.
* javax/naming/Referenceable.java: Likewise.
* javax/naming/ReferralException.java: Likewise.
* javax/naming/ServiceUnavailableException.java: Likewise.
* javax/naming/SizeLimitExceededException.java: Likewise.
* javax/naming/TimeLimitExceededException.java: Likewise.
* javax/naming/directory/Attribute.java: Likewise.
* javax/naming/directory/AttributeInUseException.java: Likewise.
* javax/naming/directory/AttributeModificationException.java: Likewise.
* javax/naming/directory/Attributes.java: Likewise.
* javax/naming/directory/BasicAttribute.java: Likewise.
* javax/naming/directory/BasicAttributes.java: Likewise.
* javax/naming/directory/DirContext.java: Likewise.
* javax/naming/directory/InitialDirContext.java: Likewise.
* javax/naming/directory/InvalidAttributeIdentifierException.java:
Likewise.
* javax/naming/directory/InvalidAttributeValueException.java: Likewise.
* javax/naming/directory/InvalidAttributesException.java: Likewise.
* javax/naming/directory/InvalidSearchControlsException.java: Likewise.
* javax/naming/directory/InvalidSearchFilterException.java: Likewise.
* javax/naming/directory/ModificationItem.java: Likewise.
* javax/naming/directory/NoSuchAttributeException.java: Likewise.
* javax/naming/directory/SchemaViolationException.java: Likewise.
* javax/naming/directory/SearchControls.java: Likewise.
* javax/naming/directory/SearchResult.java: Likewise.
* javax/naming/event/EventContext.java: Likewise.
* javax/naming/event/EventDirContext.java: Likewise.
* javax/naming/event/NamespaceChangeListener.java: Likewise.
* javax/naming/event/NamingEvent.java: Likewise.
* javax/naming/event/NamingExceptionEvent.java: Likewise.
* javax/naming/event/NamingListener.java: Likewise.
* javax/naming/event/ObjectChangeListener.java: Likewise.
* javax/naming/ldap/Control.java: Likewise.
* javax/naming/ldap/ControlFactory.java: Likewise.
* javax/naming/ldap/ExtendedRequest.java: Likewise.
* javax/naming/ldap/ExtendedResponse.java: Likewise.
* javax/naming/ldap/HasControls.java: Likewise.
* javax/naming/ldap/InitialLdapContext.java: Likewise.
* javax/naming/ldap/LdapContext.java: Likewise.
* javax/naming/ldap/LdapReferralException.java: Likewise.
* javax/naming/ldap/UnsolicitedNotification.java: Likewise.
* javax/naming/ldap/UnsolicitedNotificationEvent.java: Likewise.
* javax/naming/ldap/UnsolicitedNotificationListener.java: Likewise.
* javax/naming/spi/DirObjectFactory.java: Likewise.
* javax/naming/spi/DirStateFactory.java: Likewise.
* javax/naming/spi/DirectoryManager.java: Likewise.
* javax/naming/spi/InitialContextFactory.java: Likewise.
* javax/naming/spi/InitialContextFactoryBuilder.java: Likewise.
* javax/naming/spi/NamingManager.java: Likewise.
* javax/naming/spi/ObjectFactory.java: Likewise.
* javax/naming/spi/ObjectFactoryBuilder.java: Likewise.
* javax/naming/spi/ResolveResult.java: Likewise.
* javax/naming/spi/Resolver.java: Likewise.
* javax/naming/spi/StateFactory.java: Likewise.
Diffstat (limited to 'javax')
82 files changed, 7560 insertions, 0 deletions
diff --git a/javax/naming/AuthenticationException.java b/javax/naming/AuthenticationException.java new file mode 100644 index 000000000..112dd612e --- /dev/null +++ b/javax/naming/AuthenticationException.java @@ -0,0 +1,54 @@ +/* AuthenticationException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class AuthenticationException extends NamingSecurityException +{ + public AuthenticationException () + { + super (); + } + + public AuthenticationException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/AuthenticationNotSupportedException.java b/javax/naming/AuthenticationNotSupportedException.java new file mode 100644 index 000000000..6409e6490 --- /dev/null +++ b/javax/naming/AuthenticationNotSupportedException.java @@ -0,0 +1,55 @@ +/* AuthenticationNotSupportedException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class AuthenticationNotSupportedException + extends NamingSecurityException +{ + public AuthenticationNotSupportedException () + { + super (); + } + + public AuthenticationNotSupportedException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/Binding.java b/javax/naming/Binding.java new file mode 100644 index 000000000..45f0d13ea --- /dev/null +++ b/javax/naming/Binding.java @@ -0,0 +1,98 @@ +/* Binding.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date May 16, 2001 + */ +public class Binding extends NameClassPair +{ + public Binding (String name, Object obj) + { + super (name, null); + boundObj = obj; + } + + public Binding (String name, Object obj, boolean isRelative) + { + super (name, null, isRelative); + boundObj = obj; + } + + public Binding (String name, String className, Object obj) + { + super (name, className); + boundObj = obj; + } + + public Binding (String name, String className, Object obj, + boolean isRelative) + { + super (name, className, isRelative); + boundObj = obj; + } + + public String getClassName () + { + String r = super.getClassName (); + if (r != null) + return r; + return boundObj == null ? null : boundObj.getClass ().getName (); + } + + public Object getObject () + { + return boundObj; + } + + public void setObject (Object obj) + { + boundObj = obj; + } + + 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/javax/naming/CannotProceedException.java b/javax/naming/CannotProceedException.java new file mode 100644 index 000000000..f98541876 --- /dev/null +++ b/javax/naming/CannotProceedException.java @@ -0,0 +1,106 @@ +/* CannotProceedException.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 14, 2001 + */ + +public class CannotProceedException extends NamingException +{ + // 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/javax/naming/CommunicationException.java b/javax/naming/CommunicationException.java new file mode 100644 index 000000000..8731be15a --- /dev/null +++ b/javax/naming/CommunicationException.java @@ -0,0 +1,54 @@ +/* CommunicationException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class CommunicationException extends NamingException +{ + public CommunicationException () + { + super (); + } + + public CommunicationException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/CompositeName.java b/javax/naming/CompositeName.java new file mode 100644 index 000000000..71cdaaf7b --- /dev/null +++ b/javax/naming/CompositeName.java @@ -0,0 +1,319 @@ +/* CompositeName.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.io.Serializable; +import java.util.Enumeration; +import java.util.NoSuchElementException; +import java.util.Vector; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date May 16, 2001 + * + * FIXME: must write readObject and writeObject to conform to + * serialization spec. + */ +public class CompositeName implements Name, Cloneable, Serializable +{ + 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; + StringBuffer new_element = new StringBuffer (); + 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 = (String) elts.get (i); + int comp = f.compareTo ((String) 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 (String) 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 ((String) 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 ((String) 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 () + { + StringBuffer result = new StringBuffer (); + for (int i = 0; i < elts.size (); ++i) + { + // For simplicity we choose to always quote using escapes and + // never quotes. + String elt = (String) 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 transient Vector elts; +} diff --git a/javax/naming/CompoundName.java b/javax/naming/CompoundName.java new file mode 100644 index 000000000..686a3a3d3 --- /dev/null +++ b/javax/naming/CompoundName.java @@ -0,0 +1,490 @@ +/* CompoundName.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.io.Serializable; +import java.util.Enumeration; +import java.util.Properties; +import java.util.NoSuchElementException; +import java.util.Vector; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date May 16, 2001 + * + * FIXME: must write readObject and writeObject to conform to + * serialization spec. + * + * 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. + */ +public class CompoundName implements Name, Cloneable, Serializable +{ + 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 (); + + StringBuffer new_element = new StringBuffer (); + 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) + { + quote = endQuote; + i += special.length (); + continue; + } + else if (new_element.length () == 0 && special == beginQuote2) + { + quote = endQuote2; + i += special.length (); + continue; + } + else if (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) + { + Object 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 == null || ! (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 ((String) elts.get (i)); + int comp = f.compareTo (canonicalize ((String) 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 ((String) elts.get (i)); + if (! f.equals (canonicalize ((String) 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 (String) 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 ((String) 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 ((String) elts.get (i)); + if (! f.equals (canonicalize ((String) 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 () + { + StringBuffer result = new StringBuffer (); + 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 = (String) 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 (); + } + + // 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/javax/naming/ConfigurationException.java b/javax/naming/ConfigurationException.java new file mode 100644 index 000000000..7df4603c5 --- /dev/null +++ b/javax/naming/ConfigurationException.java @@ -0,0 +1,54 @@ +/* ConfigurationException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class ConfigurationException extends NamingException +{ + public ConfigurationException () + { + super (); + } + + public ConfigurationException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/Context.java b/javax/naming/Context.java new file mode 100644 index 000000000..5720dc402 --- /dev/null +++ b/javax/naming/Context.java @@ -0,0 +1,160 @@ +/* Context.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +public interface Context +{ + // Property with name of the inital context factory to use + public static final String INITIAL_CONTEXT_FACTORY + = "java.naming.factory.initial"; + + // Property with colon-separated list of object factories to use. + public static final String OBJECT_FACTORIES + = "java.naming.factory.object"; + + // Property with colon-separated list of state factories to use. + public static final String STATE_FACTORIES + = "java.naming.factory.state"; + + // Property with colon-separated list of package prefixes to use. + public static final String URL_PKG_PREFIXES + = "java.naming.factory.url.pkgs"; + + // Property with URL specifying configuration for the service + // provider to use. + public static final String PROVIDER_URL + = "java.naming.provider.url"; + + // Property with the DNS host and domain names to use. + public static final String DNS_URL + = "java.naming.dns.url"; + + // Property with the authoritativeness of the service requested. + public static final String AUTHORITATIVE + = "java.naming.authoritative"; + + // Property with the batch size to use when returning data via the + // service's protocol. + public static final String BATCHSIZE + = "java.naming.batchsize"; + + // Property defining how referrals encountered by the service + // provider are to be processed. + public static final String REFERRAL + = "java.naming.referral"; + + // Property specifying the security protocol to use. + public static final String SECURITY_PROTOCOL + = "java.naming.security.protocol"; + + // Property specifying the security level to use. + public static final String SECURITY_AUTHENTICATION + = "java.naming.security.authentication"; + + // Property for the identity of the principal for authenticating + // the caller to the service. + public static final String SECURITY_PRINCIPAL + = "java.naming.security.principal"; + + // Property specifying the credentials of the principal for + // authenticating the caller to the service. + public static final String SECURITY_CREDENTIALS + = "java.naming.security.credentials"; + + // Property for specifying the preferred language to use with the + // service. + public static final String LANGUAGE + = "java.naming.language"; + + // Property for the initial context constructor to use when searching + // for other properties. + public static final String APPLET + = "java.naming.applet"; + + public void bind (Name name, Object obj) throws NamingException; + public void bind (String name, Object obj) throws NamingException; + + public Object lookup (Name name) throws NamingException; + public Object lookup (String name) throws NamingException; + + public void rebind (Name name, Object obj) throws NamingException; + public void rebind (String name, Object obj) throws NamingException; + + public void unbind (Name name) throws NamingException; + public void unbind (String name) throws NamingException; + + public void rename (Name oldName, Name newName) throws NamingException; + public void rename (String oldName, String newName) throws NamingException; + + public NamingEnumeration list (Name name) throws NamingException; + public NamingEnumeration list (String name) throws NamingException; + + public NamingEnumeration listBindings (Name name) throws NamingException; + public NamingEnumeration listBindings (String name) throws NamingException; + + public void destroySubcontext (Name name) throws NamingException; + public void destroySubcontext (String name) throws NamingException; + + public Context createSubcontext (Name name) throws NamingException; + public Context createSubcontext (String name) throws NamingException; + + public Object lookupLink (Name name) throws NamingException; + public Object lookupLink (String name) throws NamingException; + + public NameParser getNameParser (Name name) throws NamingException; + public NameParser getNameParser (String name) throws NamingException; + + public Name composeName (Name name, Name prefix) throws NamingException; + public String composeName (String name, + String prefix) throws NamingException; + + public Object addToEnvironment (String propName, + Object propVal) throws NamingException; + + public Object removeFromEnvironment (String propName) throws NamingException; + + public Hashtable getEnvironment () throws NamingException; + + public void close () throws NamingException; + + public String getNameInNamespace () throws NamingException; +} + diff --git a/javax/naming/ContextNotEmptyException.java b/javax/naming/ContextNotEmptyException.java new file mode 100644 index 000000000..74204db54 --- /dev/null +++ b/javax/naming/ContextNotEmptyException.java @@ -0,0 +1,54 @@ +/* ContextNotEmptyException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class ContextNotEmptyException extends NamingException +{ + public ContextNotEmptyException () + { + super (); + } + + public ContextNotEmptyException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/InitialContext.java b/javax/naming/InitialContext.java new file mode 100644 index 000000000..99ae426e9 --- /dev/null +++ b/javax/naming/InitialContext.java @@ -0,0 +1,363 @@ +/* InitialContext.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Properties; +import java.applet.Applet; +import java.util.Hashtable; +import javax.naming.spi.NamingManager; + +public class InitialContext implements Context +{ + protected Context defaultInitCtx; + protected boolean gotDefault = false; + protected Hashtable myProps; + + public InitialContext (Hashtable environment) + { + init (environment); + } + + protected InitialContext (boolean lazy) + { + if (! lazy) + init (null); + } + + public InitialContext () + { + init (null); + } + + protected void init (Hashtable environment) + { + // FIXME: Is this enough? + final String[] properties = { + Context.DNS_URL, + Context.INITIAL_CONTEXT_FACTORY, + Context.OBJECT_FACTORIES, + Context.PROVIDER_URL, + Context.STATE_FACTORIES, + Context.URL_PKG_PREFIXES, + }; + + // Create myProps, cloning environment if needed. + if (environment != null) + myProps = (Hashtable) environment.clone (); + else + myProps = new Hashtable (); + + Applet napplet = (Applet) myProps.get (Context.APPLET); + + for (int i = properties.length - 1; i >= 0; i--) + { + Object o = myProps.get (properties[i]); + + if (o == null) + { + if (napplet != null) + o = napplet.getParameter (properties[i]); + if (o == null) + o = System.getProperty (properties[i]); + if (o != null) + myProps.put (properties[i], o); + } + } + + try + { + Enumeration ep = Thread.currentThread().getContextClassLoader().getResources("jndi.naming"); + while (ep.hasMoreElements ()) + { + URL url = (URL) ep.nextElement (); + Properties p = new Properties (); + + try { + InputStream is = url.openStream (); + p.load (is); + is.close (); + } catch (IOException e) {} + + merge (myProps, p); + } + } + catch (IOException e) {} + + String home = System.getProperty("java.home"); + if (home != null) + { + String fileName = home + File.separator + + "lib" + File.separator + "jndi.properties"; + Properties p = new Properties (); + + try { + InputStream is = new FileInputStream (fileName); + p.load (is); + is.close (); + } catch (IOException e) {} + + merge (myProps, p); + } + } + + // FIXME: Is this enough? + private static final String[] colon_list = + { + Context.OBJECT_FACTORIES, + Context.URL_PKG_PREFIXES, + Context.STATE_FACTORIES + }; + + private static void merge (Hashtable h1, Hashtable h2) + { + Enumeration e2 = h2.keys(); + + while (e2.hasMoreElements()) + { + String key2 = (String) e2.nextElement(); + Object value1 = h1.get(key2); + if (value1 == null) + h1.put(key2, h2.get(key2)); + else if (key2.compareTo(colon_list[0]) == 0 + || key2.compareTo(colon_list[1]) == 0 + || key2.compareTo(colon_list[2]) == 0 + || key2.compareTo(colon_list[3]) == 0) + { + String value2 = (String) h2.get(key2); + h1.put(key2, (String) value1 + ":" + value2); + } + } + } + + protected Context getDefaultInitCtx () throws NamingException + { + if (! gotDefault) + { + defaultInitCtx = NamingManager.getInitialContext (myProps); + gotDefault = true; + } + return defaultInitCtx; + } + + + protected Context getURLOrDefaultInitCtx (Name name) + throws NamingException + { + if (name.size () > 0) + return getURLOrDefaultInitCtx (name.get (0)); + else + return getDefaultInitCtx (); + } + + protected Context getURLOrDefaultInitCtx (String name) + throws NamingException + { + String scheme = null; + + if (NamingManager.hasInitialContextFactoryBuilder()) + return getDefaultInitCtx(); + int colon = name.indexOf(':'); + int slash = name.indexOf('/'); + if (colon > 0 && (slash == -1 || colon < slash)) + scheme = name.substring(0, colon); + if (scheme != null) + { + Context context = + NamingManager.getURLContext(scheme, myProps); + if (context != null) + return context; + } + + return getDefaultInitCtx(); + } + + public void bind (Name name, Object obj) throws NamingException + { + getURLOrDefaultInitCtx (name).bind (name, obj); + } + + public void bind (String name, Object obj) throws NamingException + { + getURLOrDefaultInitCtx (name).bind (name, obj); + } + + public Object lookup (Name name) throws NamingException + { + return getURLOrDefaultInitCtx (name).lookup (name); + } + + public Object lookup (String name) throws NamingException + { + return getURLOrDefaultInitCtx (name).lookup (name); + } + + public void rebind (Name name, Object obj) throws NamingException + { + getURLOrDefaultInitCtx (name).rebind (name, obj); + } + + public void rebind (String name, Object obj) throws NamingException + { + getURLOrDefaultInitCtx (name).rebind (name, obj); + } + + public void unbind (Name name) throws NamingException + { + getURLOrDefaultInitCtx (name).unbind (name); + } + + public void unbind (String name) throws NamingException + { + getURLOrDefaultInitCtx (name).unbind (name); + } + + public void rename (Name oldName, Name newName) throws NamingException + { + getURLOrDefaultInitCtx (oldName).rename (oldName, newName); + } + + public void rename (String oldName, String newName) throws NamingException + { + getURLOrDefaultInitCtx (oldName).rename (oldName, newName); + } + + public NamingEnumeration list (Name name) throws NamingException + { + return getURLOrDefaultInitCtx (name).list (name); + } + + public NamingEnumeration list (String name) throws NamingException + { + return getURLOrDefaultInitCtx (name).list (name); + } + + public NamingEnumeration listBindings (Name name) throws NamingException + { + return getURLOrDefaultInitCtx (name).listBindings (name); + } + + public NamingEnumeration listBindings (String name) throws NamingException + { + return getURLOrDefaultInitCtx (name).listBindings (name); + } + + public void destroySubcontext (Name name) throws NamingException + { + getURLOrDefaultInitCtx (name).destroySubcontext (name); + } + + public void destroySubcontext (String name) throws NamingException + { + getURLOrDefaultInitCtx (name).destroySubcontext (name); + } + + public Context createSubcontext (Name name) throws NamingException + { + return getURLOrDefaultInitCtx (name).createSubcontext (name); + } + + public Context createSubcontext (String name) throws NamingException + { + return getURLOrDefaultInitCtx (name).createSubcontext (name); + } + + public Object lookupLink (Name name) throws NamingException + { + return getURLOrDefaultInitCtx (name).lookupLink (name); + } + + public Object lookupLink (String name) throws NamingException + { + return getURLOrDefaultInitCtx (name).lookupLink (name); + } + + public NameParser getNameParser (Name name) throws NamingException + { + return getURLOrDefaultInitCtx (name).getNameParser (name); + } + + public NameParser getNameParser (String name) throws NamingException + { + return getURLOrDefaultInitCtx (name).getNameParser (name); + } + + public Name composeName (Name name, Name prefix) throws NamingException + { + return getURLOrDefaultInitCtx (name).composeName (name, prefix); + } + + public String composeName (String name, + String prefix) throws NamingException + { + return getURLOrDefaultInitCtx (name).composeName (name, prefix); + } + + public Object addToEnvironment (String propName, + Object propVal) throws NamingException + { + return myProps.put (propName, propVal); + } + + public Object removeFromEnvironment (String propName) throws NamingException + { + return myProps.remove (propName); + } + + public Hashtable getEnvironment () throws NamingException + { + return myProps; + } + + public void close () throws NamingException + { + throw new OperationNotSupportedException (); + } + + public String getNameInNamespace () throws NamingException + { + throw new OperationNotSupportedException (); + } +} diff --git a/javax/naming/InsufficientResourcesException.java b/javax/naming/InsufficientResourcesException.java new file mode 100644 index 000000000..120033dd1 --- /dev/null +++ b/javax/naming/InsufficientResourcesException.java @@ -0,0 +1,54 @@ +/* InsufficientResourcesException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class InsufficientResourcesException extends NamingException +{ + public InsufficientResourcesException () + { + super (); + } + + public InsufficientResourcesException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/InterruptedNamingException.java b/javax/naming/InterruptedNamingException.java new file mode 100644 index 000000000..e5ad1f864 --- /dev/null +++ b/javax/naming/InterruptedNamingException.java @@ -0,0 +1,54 @@ +/* InterruptedNamingException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class InterruptedNamingException extends NamingException +{ + public InterruptedNamingException () + { + super (); + } + + public InterruptedNamingException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/LimitExceededException.java b/javax/naming/LimitExceededException.java new file mode 100644 index 000000000..4bbbb0f49 --- /dev/null +++ b/javax/naming/LimitExceededException.java @@ -0,0 +1,54 @@ +/* LimitExceededException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class LimitExceededException extends NamingException +{ + public LimitExceededException () + { + super (); + } + + public LimitExceededException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/LinkException.java b/javax/naming/LinkException.java new file mode 100644 index 000000000..46ea6bd0b --- /dev/null +++ b/javax/naming/LinkException.java @@ -0,0 +1,118 @@ +/* LinkException.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 14, 2001 + */ + +public class LinkException extends NamingException +{ + // Serialized fields. + protected Name linkResolvedName; + protected Object linkResolvedObj; + protected Name linkRemainingName; + protected String linkExplanation; + + public LinkException () + { + super (); + } + + public LinkException (String msg) + { + super (msg); + } + + public Name getLinkResolvedName() + { + return linkResolvedName; + } + + public Name getLinkRemainingName() + { + return linkRemainingName; + } + + public Object getLinkResolvedObj() + { + return linkResolvedObj; + } + + public String getLinkExplanation() + { + return linkExplanation; + } + + public void setLinkExplanation(String msg) + { + linkExplanation = msg; + } + + public void setLinkResolvedName(Name name) + { + linkResolvedName = (Name) name.clone(); + } + + public void setLinkRemainingName(Name name) + { + linkRemainingName = (Name) name.clone(); + } + + public void setLinkResolvedObj(Object obj) + { + linkResolvedObj = obj; + } + + public String toString () + { + return super.toString () + "; " + linkRemainingName.toString (); + } + + public String toString (boolean detail) + { + String r = super.toString (detail) + "; " + linkRemainingName.toString (); + if (detail) + r += "; " + linkResolvedObj.toString (); + return r; + } +} diff --git a/javax/naming/LinkLoopException.java b/javax/naming/LinkLoopException.java new file mode 100644 index 000000000..0c2bdddd8 --- /dev/null +++ b/javax/naming/LinkLoopException.java @@ -0,0 +1,54 @@ +/* LinkLoopException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class LinkLoopException extends LinkException +{ + public LinkLoopException () + { + super (); + } + + public LinkLoopException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/LinkRef.java b/javax/naming/LinkRef.java new file mode 100644 index 000000000..a8a22adca --- /dev/null +++ b/javax/naming/LinkRef.java @@ -0,0 +1,65 @@ +/* LinkRef.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.io.Serializable; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date May 16, 2001 + */ +public class LinkRef extends Reference +{ + public LinkRef (Name name) + { + this (name.toString ()); + } + + public LinkRef (String name) + { + // FIXME: javax.naming.LinkRef? + super ("LinkRef", new StringRefAddr ("LinkAddress", name)); + } + + public String getLinkName () + { + StringRefAddr sra = (StringRefAddr) get (0); + return (String) sra.getContent (); + } +} diff --git a/javax/naming/MalformedLinkException.java b/javax/naming/MalformedLinkException.java new file mode 100644 index 000000000..5233e7723 --- /dev/null +++ b/javax/naming/MalformedLinkException.java @@ -0,0 +1,54 @@ +/* MalformedLinkException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class MalformedLinkException extends LinkException +{ + public MalformedLinkException () + { + super (); + } + + public MalformedLinkException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/NameAlreadyBoundException.java b/javax/naming/NameAlreadyBoundException.java new file mode 100644 index 000000000..2b5743628 --- /dev/null +++ b/javax/naming/NameAlreadyBoundException.java @@ -0,0 +1,54 @@ +/* NameAlreadyBoundException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class NameAlreadyBoundException extends NamingException +{ + public NameAlreadyBoundException () + { + super (); + } + + public NameAlreadyBoundException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/NameClassPair.java b/javax/naming/NameClassPair.java new file mode 100644 index 000000000..2f1155986 --- /dev/null +++ b/javax/naming/NameClassPair.java @@ -0,0 +1,101 @@ +/* NameClassPair.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.io.Serializable; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date May 16, 2001 + */ +public class NameClassPair implements Serializable +{ + public NameClassPair (String name, String className) + { + this (name, className, true); + } + + public NameClassPair (String name, String className, boolean isRelative) + { + this.name = name; + this.className = className; + this.isRel = isRelative; + } + + public String getClassName () + { + return className; + } + + public String getName () + { + return name; + } + + public boolean isRelative () + { + return isRel; + } + + public void setClassName (String name) + { + this.className = name; + } + + public void setName (String name) + { + this.name = name; + } + + public void setRelative (boolean r) + { + this.isRel = r; + } + + public String toString () + { + // Specified by class documentation. + return name + ":" + className; + } + + // These field names are fixed by the serialization spec. + private String name; + private String className; + private boolean isRel; +} diff --git a/javax/naming/NameNotFoundException.java b/javax/naming/NameNotFoundException.java new file mode 100644 index 000000000..cb22ab371 --- /dev/null +++ b/javax/naming/NameNotFoundException.java @@ -0,0 +1,54 @@ +/* NameNotFoundException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class NameNotFoundException extends NamingException +{ + public NameNotFoundException () + { + super (); + } + + public NameNotFoundException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/NameParser.java b/javax/naming/NameParser.java new file mode 100644 index 000000000..0bd2a7a8a --- /dev/null +++ b/javax/naming/NameParser.java @@ -0,0 +1,46 @@ +/* NameParser.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 interface NameParser +{ + public Name parse (String name) throws NamingException; +} + + diff --git a/javax/naming/NamingEnumeration.java b/javax/naming/NamingEnumeration.java new file mode 100644 index 000000000..4340c1287 --- /dev/null +++ b/javax/naming/NamingEnumeration.java @@ -0,0 +1,48 @@ +/* NamingEnumeration.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.Enumeration; + +public interface NamingEnumeration extends Enumeration +{ + public void close() throws NamingException; + public boolean hasMore() throws NamingException; + public Object next() throws NamingException; +} diff --git a/javax/naming/NamingSecurityException.java b/javax/naming/NamingSecurityException.java new file mode 100644 index 000000000..71d538a0b --- /dev/null +++ b/javax/naming/NamingSecurityException.java @@ -0,0 +1,54 @@ +/* NamingSecurityException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class NamingSecurityException extends NamingException +{ + public NamingSecurityException () + { + super (); + } + + public NamingSecurityException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/NoInitialContextException.java b/javax/naming/NoInitialContextException.java new file mode 100644 index 000000000..a1220dfb8 --- /dev/null +++ b/javax/naming/NoInitialContextException.java @@ -0,0 +1,54 @@ +/* NoInitialContextException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class NoInitialContextException extends NamingException +{ + public NoInitialContextException() + { + super(); + } + + public NoInitialContextException(String msg) + { + super(msg); + } +} diff --git a/javax/naming/NoPermissionException.java b/javax/naming/NoPermissionException.java new file mode 100644 index 000000000..261b7ff26 --- /dev/null +++ b/javax/naming/NoPermissionException.java @@ -0,0 +1,54 @@ +/* NoPermissionException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class NoPermissionException extends NamingSecurityException +{ + public NoPermissionException () + { + super (); + } + + public NoPermissionException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/NotContextException.java b/javax/naming/NotContextException.java new file mode 100644 index 000000000..87edeb319 --- /dev/null +++ b/javax/naming/NotContextException.java @@ -0,0 +1,54 @@ +/* NotContextException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class NotContextException extends NamingException +{ + public NotContextException () + { + super (); + } + + public NotContextException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/OperationNotSupportedException.java b/javax/naming/OperationNotSupportedException.java new file mode 100644 index 000000000..7278118d9 --- /dev/null +++ b/javax/naming/OperationNotSupportedException.java @@ -0,0 +1,52 @@ +/* OperationNotSupportedException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 OperationNotSupportedException extends NamingException +{ + public OperationNotSupportedException() + { + super(); + } + + public OperationNotSupportedException(String msg) + { + super(msg); + } +} diff --git a/javax/naming/PartialResultException.java b/javax/naming/PartialResultException.java new file mode 100644 index 000000000..6f323d59d --- /dev/null +++ b/javax/naming/PartialResultException.java @@ -0,0 +1,54 @@ +/* PartialResultException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class PartialResultException extends NamingException +{ + public PartialResultException () + { + super (); + } + + public PartialResultException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/Reference.java b/javax/naming/Reference.java new file mode 100644 index 000000000..7309ebd29 --- /dev/null +++ b/javax/naming/Reference.java @@ -0,0 +1,194 @@ +/* Reference.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.io.Serializable; +import java.util.Enumeration; +import java.util.Vector; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date May 16, 2001 + */ +public class Reference implements Cloneable, Serializable +{ + public Reference (String className) + { + this.className = className; + addrs = new Vector (); + } + + public Reference (String className, RefAddr addr) + { + this.className = className; + addrs = new Vector (); + addrs.add (addr); + } + + public Reference (String className, String factory, String factoryLocation) + { + this.className = className; + this.classFactory = factory; + this.classFactoryLocation = factoryLocation; + addrs = new Vector (); + } + + public Reference (String className, RefAddr addr, + String factory, String factoryLocation) + { + this.className = className; + this.classFactory = factory; + this.classFactoryLocation = factoryLocation; + addrs = new Vector (); + addrs.add (addr); + } + + public void add (int posn, RefAddr addr) + { + addrs.add (posn, addr); + } + + public void add (RefAddr addr) + { + addrs.add (addr); + } + + public void clear () + { + addrs.clear (); + } + + public Object clone () + { + Reference r = new Reference (className, classFactory, + classFactoryLocation); + r.addrs = (Vector) addrs.clone (); + return r; + } + + // Convenience function. + private boolean equals (String a, String b) + { + return (a == null) ? (b == null) : a.equals (b); + } + + public boolean equals (Object obj) + { + if (! (obj instanceof Reference)) + return false; + Reference r = (Reference) obj; + return (equals (classFactory, r.classFactory) + && equals (classFactoryLocation, r.classFactoryLocation) + && equals (className, r.className) + && addrs.equals (r.addrs)); + } + + public RefAddr get (int posn) + { + return (RefAddr) addrs.get (posn); + } + + public RefAddr get (String addrType) + { + for (int i = 0; i < addrs.size (); ++i) + { + RefAddr r = (RefAddr) addrs.get (i); + if (addrType.equals (r.getType ())) + return r; + } + return null; + } + + public Enumeration getAll () + { + return addrs.elements (); + } + + public String getClassName () + { + return className; + } + + public String getFactoryClassLocation () + { + return classFactoryLocation; + } + + public String getFactoryClassName () + { + return classFactory; + } + + public int hashCode () + { + // The spec says the hash code is the sum of the hash codes of the + // addresses. It does not mention the other fields. + int h = 0; + for (int i = 0; i < addrs.size (); ++i) + h += addrs.get (i).hashCode (); + return h; + } + + public Object remove (int posn) + { + return addrs.remove (posn); + } + + public int size () + { + return addrs.size (); + } + + public String toString () + { + String x = getClass ().toString () + "["; + for (int i = 0; i < addrs.size (); ++i) + { + if (i > 0) + x += ","; + x += addrs.get (i).toString (); + } + return x + "]"; + } + + protected Vector addrs; + protected String classFactory; + protected String classFactoryLocation; + protected String className; +} diff --git a/javax/naming/Referenceable.java b/javax/naming/Referenceable.java new file mode 100644 index 000000000..50170b9ac --- /dev/null +++ b/javax/naming/Referenceable.java @@ -0,0 +1,44 @@ +/* Referenceable.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 interface Referenceable +{ + public Reference getReference() throws NamingException; +} diff --git a/javax/naming/ReferralException.java b/javax/naming/ReferralException.java new file mode 100644 index 000000000..5becc6b31 --- /dev/null +++ b/javax/naming/ReferralException.java @@ -0,0 +1,67 @@ +/* ReferralException.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 14, 2001 + */ + +public abstract class ReferralException extends NamingException +{ + protected ReferralException () + { + super (); + } + + protected ReferralException (String msg) + { + super (msg); + } + + public abstract Object getReferralInfo(); + public abstract Context getReferralContext() throws NamingException; + public abstract Context getReferralContext(Hashtable env) + throws NamingException; + public abstract boolean skipReferral(); + public abstract void retryReferral(); +} diff --git a/javax/naming/ServiceUnavailableException.java b/javax/naming/ServiceUnavailableException.java new file mode 100644 index 000000000..43aee5354 --- /dev/null +++ b/javax/naming/ServiceUnavailableException.java @@ -0,0 +1,54 @@ +/* ServiceUnavailableException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class ServiceUnavailableException extends NamingException +{ + public ServiceUnavailableException () + { + super (); + } + + public ServiceUnavailableException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/SizeLimitExceededException.java b/javax/naming/SizeLimitExceededException.java new file mode 100644 index 000000000..5d4414f7b --- /dev/null +++ b/javax/naming/SizeLimitExceededException.java @@ -0,0 +1,54 @@ +/* SizeLimitExceededException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class SizeLimitExceededException extends LimitExceededException +{ + public SizeLimitExceededException () + { + super (); + } + + public SizeLimitExceededException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/TimeLimitExceededException.java b/javax/naming/TimeLimitExceededException.java new file mode 100644 index 000000000..dc8dadf1e --- /dev/null +++ b/javax/naming/TimeLimitExceededException.java @@ -0,0 +1,54 @@ +/* TimeLimitExceededException.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.lang.Exception; + +public class TimeLimitExceededException extends LimitExceededException +{ + public TimeLimitExceededException () + { + super (); + } + + public TimeLimitExceededException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/Attribute.java b/javax/naming/directory/Attribute.java new file mode 100644 index 000000000..d04a12c36 --- /dev/null +++ b/javax/naming/directory/Attribute.java @@ -0,0 +1,70 @@ +/* Attribute.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.*; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 14, 2001 + */ + +public interface Attribute extends Cloneable, Serializable +{ + // FIXME: Need to set value from JNDI 1.1.1 fro interoperability. + // public static final long serialVersionUID = ; + + public NamingEnumeration getAll() throws NamingException; + public Object get() throws NamingException; + public int size(); + public String getID(); + public boolean contains(Object attrVal); + public boolean add(Object attrVal); + public boolean remove(Object attrval); + public void clear(); + public DirContext getAttributeSyntaxDefinition() throws NamingException; + public DirContext getAttributeDefinition() throws NamingException; + public Object clone(); + public boolean isOrdered(); + public Object get(int ix) throws NamingException; + public Object remove(int ix); + public void add(int ix, Object attrVal); + public Object set(int ix, Object attrVal); +} diff --git a/javax/naming/directory/AttributeInUseException.java b/javax/naming/directory/AttributeInUseException.java new file mode 100644 index 000000000..709595542 --- /dev/null +++ b/javax/naming/directory/AttributeInUseException.java @@ -0,0 +1,54 @@ +/* AttributeInUseException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class AttributeInUseException extends NamingException +{ + public AttributeInUseException () + { + super (); + } + + public AttributeInUseException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/AttributeModificationException.java b/javax/naming/directory/AttributeModificationException.java new file mode 100644 index 000000000..001245800 --- /dev/null +++ b/javax/naming/directory/AttributeModificationException.java @@ -0,0 +1,77 @@ +/* AttributeModificationException.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 14, 2001 + */ + +public class AttributeModificationException extends NamingException +{ + // Serialized fields. + private ModificationItem[] unexecs; + + public AttributeModificationException () + { + super (); + } + + public AttributeModificationException (String msg) + { + super (msg); + } + + public void setUnexecutedModifications(ModificationItem[] e) + { + unexecs = e; + } + + public ModificationItem[] getUnexecutedModifications() + { + return unexecs; + } + + public String toString() + { + return super.toString () + ": " + unexecs[0].toString (); + } +} diff --git a/javax/naming/directory/Attributes.java b/javax/naming/directory/Attributes.java new file mode 100644 index 000000000..7f5ac47c2 --- /dev/null +++ b/javax/naming/directory/Attributes.java @@ -0,0 +1,61 @@ +/* Attributes.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.*; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 14, 2001 + */ + +public interface Attributes extends Cloneable, Serializable +{ + public boolean isCaseIgnored(); + public int size(); + public Attribute get(String attrID); + public NamingEnumeration getAll(); + public NamingEnumeration getIDs(); + public Attribute put(String attrID, Object val); + public Attribute put(Attribute attr); + public Attribute remove(String attrID); + public Object clone(); +} + diff --git a/javax/naming/directory/BasicAttribute.java b/javax/naming/directory/BasicAttribute.java new file mode 100644 index 000000000..6bf77f171 --- /dev/null +++ b/javax/naming/directory/BasicAttribute.java @@ -0,0 +1,328 @@ +/* BasicAttribute.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.*; +import java.util.*; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date June 20, 2001 + */ +public class BasicAttribute implements Attribute +{ + /** The ID of this attribute. */ + protected String attrID; + /** True if this attribute's values are ordered. */ + protected boolean ordered; + /** Values for this attribute. */ + protected transient Vector values; + + // Used by cloning. + private BasicAttribute () + { + } + + public BasicAttribute (String id) + { + this (id, false); + } + + public BasicAttribute (String id, boolean ordered) + { + attrID = id; + this.ordered = ordered; + values = new Vector (); + } + + public BasicAttribute (String id, Object value) + { + this (id, value, false); + } + + public BasicAttribute (String id, Object value, boolean ordered) + { + attrID = id; + this.ordered = ordered; + values = new Vector (); + values.add (value); + } + + public void add (int index, Object val) + { + if (! ordered && contains (val)) + throw new IllegalStateException ("value already in attribute"); + values.add (index, val); + } + + public boolean add (Object val) + { + if (! ordered && contains (val)) + throw new IllegalStateException ("value already in attribute"); + return values.add (val); + } + + public void clear () + { + values.clear (); + } + + public Object clone () + { + BasicAttribute c = new BasicAttribute (); + c.attrID = attrID; + c.ordered = ordered; + c.values = (Vector) values.clone (); + return c; + } + + public boolean contains (Object val) + { + for (int i = 0; i < values.size (); ++i) + { + if (equals (val, values.get (i))) + return true; + } + + return false; + } + + public boolean equals (Object obj) + { + if (! (obj instanceof BasicAttribute)) + return false; + BasicAttribute b = (BasicAttribute) obj; + + if (ordered != b.ordered + || ! attrID.equals (b.attrID) + || values.size () != b.values.size ()) + return false; + + for (int i = 0; i < values.size (); ++i) + { + boolean ok = false; + if (ordered) + ok = equals (values.get (i), b.values.get (i)); + else + { + for (int j = 0; j < b.values.size (); ++j) + { + if (equals (values.get (i), b.values.get (j))) + { + ok = true; + break; + } + } + } + + if (! ok) + return false; + } + + return true; + } + + public Object get () + { + if (values.size () == 0) + throw new NoSuchElementException ("no values"); + return get (0); + } + + public Object get (int index) + { + return values.get (index); + } + + public NamingEnumeration getAll () + { + return new BasicAttributeEnumeration (); + } + + public DirContext getAttributeDefinition () + throws OperationNotSupportedException, NamingException + { + throw new OperationNotSupportedException (); + } + + public DirContext getAttributeSyntaxDefinition () + throws OperationNotSupportedException, NamingException + { + throw new OperationNotSupportedException (); + } + + public String getID () + { + return attrID; + } + + public int hashCode () + { + int val = attrID.hashCode (); + for (int i = 0; i < values.size (); ++i) + { + Object o = values.get (i); + if (o == null) + { + // Nothing. + } + else if (o instanceof Object[]) + { + Object[] a = (Object[]) o; + for (int j = 0; j < a.length; ++j) + val += a[j].hashCode (); + } + else + val += o.hashCode (); + } + + return val; + } + + public boolean isOrdered () + { + return ordered; + } + + public Object remove (int index) + { + return values.remove (index); + } + + public boolean remove (Object val) + { + for (int i = 0; i < values.size (); ++i) + { + if (equals (val, values.get (i))) + { + values.remove (i); + return true; + } + } + + return false; + } + + public Object set (int index, Object val) + { + if (! ordered && contains (val)) + throw new IllegalStateException ("value already in attribute"); + return values.set (index, val); + } + + public int size () + { + return values.size (); + } + + public String toString () + { + String r = attrID; + for (int i = 0; i < values.size (); ++i) + r += ";" + values.get (i).toString (); + return r; + } + + // This is used for testing equality of two Objects according to our + // local rules. + private boolean equals (Object one, Object two) + { + if (one == null) + return two == null; + + if (one instanceof Object[]) + { + if (! (two instanceof Object[])) + return false; + + Object[] aone = (Object[]) one; + Object[] atwo = (Object[]) two; + + if (aone.length != atwo.length) + return false; + + for (int i = 0; i < aone.length; ++i) + { + if (! aone[i].equals (atwo[i])) + return false; + } + + return true; + } + + return one.equals (two); + } + + // Used when enumerating this attribute. + private class BasicAttributeEnumeration implements NamingEnumeration + { + int where = -1; + + public BasicAttributeEnumeration () + { + } + + public void close () throws NamingException + { + } + + public boolean hasMore () throws NamingException + { + return hasMoreElements (); + } + + public Object next () throws NamingException + { + return nextElement (); + } + + public boolean hasMoreElements () + { + return where < values.size (); + } + + public Object nextElement () throws NoSuchElementException + { + if (where + 1 >= values.size ()) + throw new NoSuchElementException ("no more elements"); + ++where; + return values.get (where); + } + } +} diff --git a/javax/naming/directory/BasicAttributes.java b/javax/naming/directory/BasicAttributes.java new file mode 100644 index 000000000..331a3c2a3 --- /dev/null +++ b/javax/naming/directory/BasicAttributes.java @@ -0,0 +1,224 @@ +/* BasicAttributes.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.*; +import java.util.*; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date June 22, 2001 + */ +public class BasicAttributes implements Attributes +{ + public BasicAttributes () + { + this (false); + } + + public BasicAttributes (boolean ignoreCase) + { + this.ignoreCase = ignoreCase; + this.attributes = new Vector (); + } + + public BasicAttributes (String attrID, Object val) + { + this (attrID, val, false); + } + + public BasicAttributes (String attrID, Object val, boolean ignoreCase) + { + this.ignoreCase = ignoreCase; + attributes = new Vector (); + attributes.add (new BasicAttribute (attrID, val)); + } + + public Object clone () + { + // Slightly inefficient as we make a garbage Vector here. + BasicAttributes ba = new BasicAttributes (ignoreCase); + ba.attributes = (Vector) attributes.clone (); + return ba; + } + + public boolean equals (Object obj) + { + if (! (obj instanceof BasicAttributes)) + return false; + BasicAttributes b = (BasicAttributes) obj; + if (ignoreCase != b.ignoreCase + || attributes.size () != b.attributes.size ()) + return false; + + // Does order matter? + for (int i = 0; i < attributes.size (); ++i) + { + if (! attributes.get (i).equals (b.attributes.get (i))) + return false; + } + + return true; + } + + public Attribute get (String attrID) + { + for (int i = 0; i < attributes.size (); ++i) + { + Attribute at = (Attribute) attributes.get (i); + if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ())) + || (! ignoreCase && attrID.equals (at.getID ()))) + return at; + } + + return null; + } + + public NamingEnumeration getAll () + { + return new BasicAttributesEnumeration (false); + } + + public NamingEnumeration getIDs () + { + return new BasicAttributesEnumeration (true); + } + + public int hashCode () + { + int val = 0; + for (int i = 0; i < attributes.size (); ++i) + val += attributes.get (i).hashCode (); + return val; + } + + public boolean isCaseIgnored () + { + return ignoreCase; + } + + public Attribute put (Attribute attr) + { + Attribute r = remove (attr.getID ()); + attributes.add (attr); + return r; + } + + public Attribute put (String attrID, Object val) + { + return put (new BasicAttribute (attrID, val)); + } + + public Attribute remove (String attrID) + { + for (int i = 0; i < attributes.size (); ++i) + { + Attribute at = (Attribute) attributes.get (i); + if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ())) + || (! ignoreCase && attrID.equals (at.getID ()))) + { + attributes.remove (i); + return at; + } + } + + return null; + } + + public int size () + { + return attributes.size (); + } + + public String toString () + { + String r = ""; + for (int i = 0; i < attributes.size (); ++i) + { + if (i > 0) + r += "; "; + r += attributes.get (i).toString (); + } + return r; + } + + // This is set by the serialization spec. + private boolean ignoreCase; + private transient Vector attributes; + + // Used when enumerating. + private class BasicAttributesEnumeration implements NamingEnumeration + { + int where = -1; + boolean id; + + public BasicAttributesEnumeration (boolean id) + { + this.id = id; + } + + public void close () throws NamingException + { + } + + public boolean hasMore () throws NamingException + { + return hasMoreElements (); + } + + public Object next () throws NamingException + { + return nextElement (); + } + + public boolean hasMoreElements () + { + return where < attributes.size (); + } + + public Object nextElement () throws NoSuchElementException + { + if (where + 1 >= attributes.size ()) + throw new NoSuchElementException ("no more elements"); + ++where; + Attribute at = (Attribute) attributes.get (where); + return id ? (Object) at.getID () : (Object) at; + } + } +} diff --git a/javax/naming/directory/DirContext.java b/javax/naming/directory/DirContext.java new file mode 100644 index 000000000..aabad173e --- /dev/null +++ b/javax/naming/directory/DirContext.java @@ -0,0 +1,80 @@ +/* DirContext.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 13, 2001 + */ + +public interface DirContext extends Context +{ + public static final int ADD_ATTRIBUTE = 1; + public static final int REPLACE_ATTRIBUTE = 2; + public static final int REMOVE_ATTRIBUTE = 3; + + public Attributes getAttributes (String name) throws NamingException; + public Attributes getAttributes (String name, String[] attrIds) throws NamingException; + public Attributes getAttributes (Name name) throws NamingException; + public Attributes getAttributes(Name name, String[] attrIds) throws NamingException; + public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException; + public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException; + public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException; + public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException; + public void bind(Name name, Object obj, Attributes attrs) throws NamingException; + public void bind(String name, Object obj, Attributes attrs) throws NamingException; + public void rebind(Name name, Object obj, Attributes attrs) throws NamingException; + public void rebind(String name, Object obj, Attributes attrs) throws NamingException; + public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException; + public DirContext createSubcontext(String name, Attributes attrs) throws NamingException; + public DirContext getSchema(Name name) throws NamingException; + public DirContext getSchema(String name) throws NamingException; + public DirContext getSchemaClassDefinition(Name name) throws NamingException; + public DirContext getSchemaClassDefinition(String name) throws NamingException; + public NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException; + public NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException; + public NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException; + public NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException; + public NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException; + public NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException; + public NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException; + public NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException; +} diff --git a/javax/naming/directory/InitialDirContext.java b/javax/naming/directory/InitialDirContext.java new file mode 100644 index 000000000..05c48af89 --- /dev/null +++ b/javax/naming/directory/InitialDirContext.java @@ -0,0 +1,258 @@ +/* InitialDirContext.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.*; +import java.util.Hashtable; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date June 25, 2001 + */ +public class InitialDirContext extends InitialContext implements DirContext +{ + public InitialDirContext () + throws NamingException + { + this (null); + } + + protected InitialDirContext (boolean lazy) + throws NamingException + { + super (lazy); + } + + public InitialDirContext (Hashtable environment) + throws NamingException + { + super (environment); + } + + // The InitialContext docs suggest that this exist. And it does + // seem like a good idea. but the InitialDirContext docs indicate + // it cannot be non-private. + private DirContext getURLOrDefaultInitDirCtx (Name name) + throws NamingException + { + Context c = getURLOrDefaultInitCtx (name); + if (c == null) + throw new NoInitialContextException (); + else if (! (c instanceof DirContext)) + throw new NotContextException (); + return (DirContext) c; + } + + private DirContext getURLOrDefaultInitDirCtx (String name) + throws NamingException + { + Context c = getURLOrDefaultInitCtx (name); + if (c == null) + throw new NoInitialContextException (); + else if (! (c instanceof DirContext)) + throw new NotContextException (); + return (DirContext) c; + } + + public Attributes getAttributes (String name) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getAttributes (name); + } + + public Attributes getAttributes (String name, String[] attrIds) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getAttributes (name, attrIds); + } + + public Attributes getAttributes (Name name) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getAttributes (name); + } + + public Attributes getAttributes(Name name, String[] attrIds) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getAttributes (name, attrIds); + } + + public void modifyAttributes(Name name, int mod_op, Attributes attrs) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mod_op, attrs); + } + + public void modifyAttributes(String name, int mod_op, Attributes attrs) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mod_op, attrs); + } + + public void modifyAttributes(Name name, ModificationItem[] mods) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mods); + } + + public void modifyAttributes(String name, ModificationItem[] mods) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mods); + } + + public void bind(Name name, Object obj, Attributes attrs) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).bind (name, obj, attrs); + } + + public void bind(String name, Object obj, Attributes attrs) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).bind (name, obj, attrs); + } + + public void rebind(Name name, Object obj, Attributes attrs) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).rebind (name, obj, attrs); + } + + public void rebind(String name, Object obj, Attributes attrs) + throws NamingException + { + getURLOrDefaultInitDirCtx (name).rebind (name, obj, attrs); + } + + public DirContext createSubcontext(Name name, Attributes attrs) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).createSubcontext (name, attrs); + } + + public DirContext createSubcontext(String name, Attributes attrs) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).createSubcontext (name, attrs); + } + + public DirContext getSchema(Name name) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getSchema (name); + } + + public DirContext getSchema(String name) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getSchema (name); + } + + public DirContext getSchemaClassDefinition(Name name) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name); + } + + public DirContext getSchemaClassDefinition(String name) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name); + } + + public NamingEnumeration search(Name name, Attributes matchingAttributes, + String[] attributesToReturn) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes, + attributesToReturn); + } + + public NamingEnumeration search(String name, Attributes matchingAttributes, + String[] attributesToReturn) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes, + attributesToReturn); + } + + public NamingEnumeration search(Name name, Attributes matchingAttributes) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes); + } + + public NamingEnumeration search(String name, Attributes matchingAttributes) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes); + } + + public NamingEnumeration search(Name name, String filter, + SearchControls cons) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, filter, cons); + } + + public NamingEnumeration search(String name, String filter, + SearchControls cons) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, filter, cons); + } + + public NamingEnumeration search(Name name, String filterExpr, + Object[] filterArgs, SearchControls cons) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, filterExpr, + filterArgs, cons); + } + + public NamingEnumeration search(String name, String filterExpr, + Object[] filterArgs, SearchControls cons) + throws NamingException + { + return getURLOrDefaultInitDirCtx (name).search (name, filterExpr, + filterArgs, cons); + } +} diff --git a/javax/naming/directory/InvalidAttributeIdentifierException.java b/javax/naming/directory/InvalidAttributeIdentifierException.java new file mode 100644 index 000000000..e48d48352 --- /dev/null +++ b/javax/naming/directory/InvalidAttributeIdentifierException.java @@ -0,0 +1,54 @@ +/* InvalidAttributeIdentifierException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class InvalidAttributeIdentifierException extends NamingException +{ + public InvalidAttributeIdentifierException () + { + super (); + } + + public InvalidAttributeIdentifierException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/InvalidAttributeValueException.java b/javax/naming/directory/InvalidAttributeValueException.java new file mode 100644 index 000000000..b9f62237f --- /dev/null +++ b/javax/naming/directory/InvalidAttributeValueException.java @@ -0,0 +1,54 @@ +/* InvalidAttributeValueException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class InvalidAttributeValueException extends NamingException +{ + public InvalidAttributeValueException () + { + super (); + } + + public InvalidAttributeValueException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/InvalidAttributesException.java b/javax/naming/directory/InvalidAttributesException.java new file mode 100644 index 000000000..a7a8cc61f --- /dev/null +++ b/javax/naming/directory/InvalidAttributesException.java @@ -0,0 +1,54 @@ +/* InvalidAttributesException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class InvalidAttributesException extends NamingException +{ + public InvalidAttributesException () + { + super (); + } + + public InvalidAttributesException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/InvalidSearchControlsException.java b/javax/naming/directory/InvalidSearchControlsException.java new file mode 100644 index 000000000..38325cee4 --- /dev/null +++ b/javax/naming/directory/InvalidSearchControlsException.java @@ -0,0 +1,54 @@ +/* InvalidSearchControlsException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class InvalidSearchControlsException extends NamingException +{ + public InvalidSearchControlsException () + { + super (); + } + + public InvalidSearchControlsException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/InvalidSearchFilterException.java b/javax/naming/directory/InvalidSearchFilterException.java new file mode 100644 index 000000000..b6e009c88 --- /dev/null +++ b/javax/naming/directory/InvalidSearchFilterException.java @@ -0,0 +1,54 @@ +/* InvalidSearchFilterException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class InvalidSearchFilterException extends NamingException +{ + public InvalidSearchFilterException () + { + super (); + } + + public InvalidSearchFilterException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/ModificationItem.java b/javax/naming/directory/ModificationItem.java new file mode 100644 index 000000000..b32fd6f7a --- /dev/null +++ b/javax/naming/directory/ModificationItem.java @@ -0,0 +1,79 @@ +/* ModificationItem.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 13, 2001 + */ + +public class ModificationItem implements Serializable +{ + // Serialized fields. + private int mod_op; + private Attribute attr; + + public ModificationItem(int mod_op, Attribute attr) + { + if (attr == null) + throw new IllegalArgumentException("attr is null"); + if (mod_op != DirContext.ADD_ATTRIBUTE && + mod_op != DirContext.REPLACE_ATTRIBUTE && + mod_op != DirContext.REMOVE_ATTRIBUTE) + throw new IllegalArgumentException("mod_op is invalid"); + this.mod_op = mod_op; + this.attr = attr; + } + + public int getModificationOp() + { + return mod_op; + } + + public Attribute getAttribute() + { + return attr; + } + + public String toString() + { + return "mod_op=" + mod_op + ":" + "attr=" + attr.toString(); + } +} diff --git a/javax/naming/directory/NoSuchAttributeException.java b/javax/naming/directory/NoSuchAttributeException.java new file mode 100644 index 000000000..48598bba6 --- /dev/null +++ b/javax/naming/directory/NoSuchAttributeException.java @@ -0,0 +1,54 @@ +/* NoSuchAttributeException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class NoSuchAttributeException extends NamingException +{ + public NoSuchAttributeException () + { + super (); + } + + public NoSuchAttributeException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/SchemaViolationException.java b/javax/naming/directory/SchemaViolationException.java new file mode 100644 index 000000000..56afc1147 --- /dev/null +++ b/javax/naming/directory/SchemaViolationException.java @@ -0,0 +1,54 @@ +/* SchemaViolationException.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; + +import javax.naming.NamingException; + +public class SchemaViolationException extends NamingException +{ + public SchemaViolationException () + { + super (); + } + + public SchemaViolationException (String msg) + { + super (msg); + } +} diff --git a/javax/naming/directory/SearchControls.java b/javax/naming/directory/SearchControls.java new file mode 100644 index 000000000..21b97403f --- /dev/null +++ b/javax/naming/directory/SearchControls.java @@ -0,0 +1,136 @@ +/* SearchControls.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 5, 2001 + */ + +public class SearchControls extends Object implements Serializable +{ + public static final int OBJECT_SCOPE = 0; + public static final int ONELEVEL_SCOPE = 1; + public static final int SUBTREE_SCOPE = 2; + + // Serialized fields. + private int searchScope; + private int timeLimit; + private boolean derefLink; + private boolean returnObj; + private long countLimit; + private String[] attributesToReturn; + + public SearchControls() + { + this(ONELEVEL_SCOPE, 0L, 0, null, false, false); + } + + public SearchControls(int scope, long countlim, int timelim, String[] attrs, + boolean retobj, boolean deref) + { + searchScope = scope; + timeLimit = timelim; + derefLink = deref; + returnObj = retobj; + countLimit = countlim; + attributesToReturn = attrs; + } + + public int getSearchScope() + { + return searchScope; + } + + public int getTimeLimit() + { + return timeLimit; + } + + public boolean getDerefLinkFlag() + { + return derefLink; + } + + public boolean getReturningObjFlag() + { + return returnObj; + } + + public long getCountLimit() + { + return countLimit; + } + + public String[] getReturningAttributes() + { + return attributesToReturn; + } + + public void setSearchScope(int scope) + { + searchScope = scope; + } + + public void setTimeLimit(int ms) + { + timeLimit = ms; + } + + public void setDerefLinkFlag(boolean on) + { + derefLink = on; + } + + public void setReturningObjFlag(boolean on) + { + returnObj = on; + } + + public void setCountLimit(long limit) + { + countLimit = limit; + } + + public void setReturningAttributes(String[] attrs) + { + attributesToReturn = attrs; + } +} diff --git a/javax/naming/directory/SearchResult.java b/javax/naming/directory/SearchResult.java new file mode 100644 index 000000000..5d3396355 --- /dev/null +++ b/javax/naming/directory/SearchResult.java @@ -0,0 +1,94 @@ +/* SearchResult.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.directory; +import javax.naming.*; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 13, 2001 + */ + +public class SearchResult extends Binding +{ + // Serialized fields. + private Attributes attrs; + + public SearchResult(String name, Object obj, Attributes attrs) + { + super(name, obj); + this.attrs = attrs; + } + + public SearchResult(String name, Object obj, Attributes attrs, + boolean isRelative) + { + super(name, obj, isRelative); + this.attrs = attrs; + } + + public SearchResult(String name, String className, Object obj, + Attributes attrs) + { + super(name, className, obj); + this.attrs = attrs; + } + + public SearchResult(String name, String className, Object obj, + Attributes attrs, boolean isRelative) + { + super(name, className, obj, isRelative); + this.attrs = attrs; + } + + public Attributes getAttributes() + { + return attrs; + } + + public void setAttributes(Attributes attrs) + { + this.attrs = attrs; + } + + public String toString() + { + return super.toString() + ":" + attrs.toString(); + } +} diff --git a/javax/naming/event/EventContext.java b/javax/naming/event/EventContext.java new file mode 100644 index 000000000..c4936ab44 --- /dev/null +++ b/javax/naming/event/EventContext.java @@ -0,0 +1,59 @@ +/* EventContext.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; +import javax.naming.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface EventContext extends Context +{ + public static final int OBJECT_SCOPE = 0; + public static final int ONELEVEL_SCOPE = 1; + public static final int SUBTREE_SCOPE = 2; + + public void addNamingListener(Name target, int scope, NamingListener l) + throws NamingException; + public void addNamingListener(String target, int scope, NamingListener l) + throws NamingException; + public void removeNamingListener(NamingListener l) throws NamingException; + public boolean targetMustExist() throws NamingException; +} diff --git a/javax/naming/event/EventDirContext.java b/javax/naming/event/EventDirContext.java new file mode 100644 index 000000000..0c3a5d143 --- /dev/null +++ b/javax/naming/event/EventDirContext.java @@ -0,0 +1,61 @@ +/* EventDirContext.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; +import javax.naming.*; +import javax.naming.directory.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface EventDirContext extends EventContext, DirContext +{ + public void addNamingListener(Name target, String filter, SearchControls ctls, + NamingListener l) throws NamingException; + public void addNamingListener(String target, String filter, + SearchControls ctls, NamingListener l) + throws NamingException; + public void addNamingListener(Name target, String filter, Object[] filterArgs, + SearchControls ctls, NamingListener l) + throws NamingException; + public void addNamingListener(String target, String filter, + Object[] filterArgs, SearchControls ctls, + NamingListener l) throws NamingException; +} diff --git a/javax/naming/event/NamespaceChangeListener.java b/javax/naming/event/NamespaceChangeListener.java new file mode 100644 index 000000000..9eeecd0ee --- /dev/null +++ b/javax/naming/event/NamespaceChangeListener.java @@ -0,0 +1,51 @@ +/* NamespaceChangeListener.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface NamespaceChangeListener extends NamingListener +{ + public void objectAdded(NamingEvent evt); + public void objectRemoved(NamingEvent evt); + public void objectRenamed(NamingEvent evt); +} diff --git a/javax/naming/event/NamingEvent.java b/javax/naming/event/NamingEvent.java new file mode 100644 index 000000000..2415704e1 --- /dev/null +++ b/javax/naming/event/NamingEvent.java @@ -0,0 +1,119 @@ +/* NamingEvent.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; +import javax.naming.*; +import java.util.EventObject; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 5, 2001 + */ + +public class NamingEvent extends EventObject +{ + public static final int OBJECT_ADDED = 0; + public static final int OBJECT_REMOVED = 1; + public static final int OBJECT_RENAMED = 2; + public static final int OBJECT_CHANGED = 3; + + // Serialized fields. + protected Object changeInfo; + protected int type; + protected Binding oldBinding; + protected Binding newBinding; + + public NamingEvent(EventContext source, int type, Binding newBd, + Binding oldBd, Object changeInfo) + { + super(source); + this.type = type; + this.oldBinding = oldBd; + this.newBinding = newBd; + this.changeInfo = changeInfo; + // FIXME: for OBJECT_ADDED, newBd must not be null; + // FIXME: for OBJECT_CHANGED, newBd and oldBd must not be null; + // FIXME: for OBJECT_RENAMED, one of newBd or oldBd may be null if newBd or + // FIXME: oldBd is outside of the scope for which listener has registered. + // FIXME: namingExceptionThrown() is called for the listener in question. + } + + public int getType() + { + return type; + } + + public EventContext getEventContext() + { + return (EventContext) getSource(); + } + + public Binding getOldBinding() + { + return oldBinding; + } + + public Binding getNewBinding() + { + return newBinding; + } + + public Object getChangeInfo() + { + return changeInfo; + } + + public void dispatch(NamingListener listener) + { + switch (type) + { + case OBJECT_ADDED: + ((NamespaceChangeListener) listener).objectAdded(this); + break; + case OBJECT_REMOVED: + ((NamespaceChangeListener) listener).objectRemoved(this); + break; + case OBJECT_RENAMED: + ((NamespaceChangeListener) listener).objectRenamed(this); + break; + case OBJECT_CHANGED: + ((ObjectChangeListener) listener).objectChanged(this); + break; + } + } +} diff --git a/javax/naming/event/NamingExceptionEvent.java b/javax/naming/event/NamingExceptionEvent.java new file mode 100644 index 000000000..79f23dd38 --- /dev/null +++ b/javax/naming/event/NamingExceptionEvent.java @@ -0,0 +1,73 @@ +/* NamingExceptionEvent.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; +import javax.naming.*; +import java.util.EventObject; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 5, 2001 + */ + +public class NamingExceptionEvent extends EventObject +{ + // Serialized fields. + private NamingException exception; + + public NamingExceptionEvent(EventContext source, NamingException exc) + { + super(source); + exception = exc; + } + + public NamingException getException() + { + return exception; + } + + public EventContext getEventContext() + { + return (EventContext) getSource(); + } + + public void dispatch(NamingListener listener) + { + listener.namingExceptionThrown(this); + } +} diff --git a/javax/naming/event/NamingListener.java b/javax/naming/event/NamingListener.java new file mode 100644 index 000000000..59ff4185a --- /dev/null +++ b/javax/naming/event/NamingListener.java @@ -0,0 +1,50 @@ +/* NamingListener.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; +import java.util.EventListener; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface NamingListener extends EventListener +{ + public void namingExceptionThrown(NamingExceptionEvent evt); +} diff --git a/javax/naming/event/ObjectChangeListener.java b/javax/naming/event/ObjectChangeListener.java new file mode 100644 index 000000000..99426bbd8 --- /dev/null +++ b/javax/naming/event/ObjectChangeListener.java @@ -0,0 +1,49 @@ +/* ObjectChangeListener.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.event; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface ObjectChangeListener extends NamingListener +{ + public void objectChanged(NamingEvent evt); +} diff --git a/javax/naming/ldap/Control.java b/javax/naming/ldap/Control.java new file mode 100644 index 000000000..7fed89418 --- /dev/null +++ b/javax/naming/ldap/Control.java @@ -0,0 +1,55 @@ +/* Control.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface Control extends Serializable +{ + public static final boolean CRITICAL = true; + public static final boolean NONCRITICAL = false; + + public String getID(); + public boolean isCritical(); + public byte[] getEncodedValue(); +} diff --git a/javax/naming/ldap/ControlFactory.java b/javax/naming/ldap/ControlFactory.java new file mode 100644 index 000000000..a9acd3d7e --- /dev/null +++ b/javax/naming/ldap/ControlFactory.java @@ -0,0 +1,105 @@ +/* ControlFactory.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; + +import javax.naming.*; +import java.util.StringTokenizer; +import java.util.Hashtable; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date June 22, 2001 + */ +public abstract class ControlFactory +{ + protected ControlFactory () + { + } + + public abstract Control getControlInstance (Control control) + throws NamingException; + + public static Control getControlInstance (Control control, + Context ctx, + Hashtable env) + throws NamingException + { + String path = (String) env.get (LdapContext.CONTROL_FACTORIES); + String path2 = null; + if (ctx != null) + path2 = (String) ctx.getEnvironment ().get (LdapContext.CONTROL_FACTORIES); + if (path == null) + path = path2; + else if (path2 != null) + path += ":" + path2; + + StringTokenizer tokens = new StringTokenizer (path, ":"); + while (tokens.hasMoreTokens ()) + { + String name = tokens.nextToken (); + try + { + Class k = Class.forName (name); + ControlFactory cf = (ControlFactory) k.newInstance (); + Control ctrl = cf.getControlInstance (control); + if (ctrl != null) + return ctrl; + } + catch (ClassNotFoundException _1) + { + // Ignore it. + } + catch (ClassCastException _2) + { + // Ignore it. + } + catch (InstantiationException _3) + { + // If we couldn't instantiate the factory we might get + // this. + } + catch (IllegalAccessException _4) + { + // Another possibility when instantiating. + } + } + + return control; + } +} diff --git a/javax/naming/ldap/ExtendedRequest.java b/javax/naming/ldap/ExtendedRequest.java new file mode 100644 index 000000000..dd6b538a6 --- /dev/null +++ b/javax/naming/ldap/ExtendedRequest.java @@ -0,0 +1,56 @@ +/* ExtendedRequest.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import java.io.Serializable; +import javax.naming.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface ExtendedRequest extends Serializable +{ + public String getID(); + public byte[] getEncodedValue(); + public ExtendedResponse createExtendedResponse(String id, + byte[] berValue, int offset, + int length) + throws NamingException; +} diff --git a/javax/naming/ldap/ExtendedResponse.java b/javax/naming/ldap/ExtendedResponse.java new file mode 100644 index 000000000..3591e6ddb --- /dev/null +++ b/javax/naming/ldap/ExtendedResponse.java @@ -0,0 +1,51 @@ +/* ExtendedResponse.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface ExtendedResponse extends Serializable +{ + public String getID(); + public byte[] getEncodedValue(); +} diff --git a/javax/naming/ldap/HasControls.java b/javax/naming/ldap/HasControls.java new file mode 100644 index 000000000..bf4b00184 --- /dev/null +++ b/javax/naming/ldap/HasControls.java @@ -0,0 +1,50 @@ +/* HasControls.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import javax.naming.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface HasControls +{ + public Control[] getControls() throws NamingException; +} diff --git a/javax/naming/ldap/InitialLdapContext.java b/javax/naming/ldap/InitialLdapContext.java new file mode 100644 index 000000000..7a7d7ad72 --- /dev/null +++ b/javax/naming/ldap/InitialLdapContext.java @@ -0,0 +1,129 @@ +/* InitialLdapContext.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; + +import javax.naming.*; +import javax.naming.directory.InitialDirContext; +import java.util.Hashtable; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date June 21, 2001 + */ +public class InitialLdapContext + extends InitialDirContext + implements LdapContext +{ + public InitialLdapContext () + throws NamingException + { + this (null, null); + } + + public InitialLdapContext (Hashtable environment, Control[] connControls) + throws NamingException + { + super (false); + + if (connControls != null) + { + if (environment == null) + environment = new Hashtable (); + else + environment = (Hashtable) environment.clone (); + environment.put ("java.naming.ldap.control.connect", + connControls); + } + + init (environment); + } + + private LdapContext getDefaultInitLdapCtx () + throws NamingException + { + Context c = getDefaultInitCtx (); + if (c == null) + throw new NoInitialContextException (); + else if (! (c instanceof LdapContext)) + throw new NotContextException (); + return (LdapContext) c; + } + + public ExtendedResponse extendedOperation (ExtendedRequest request) + throws NamingException + { + return getDefaultInitLdapCtx ().extendedOperation (request); + } + + public Control[] getConnectControls () + throws NamingException + { + return getDefaultInitLdapCtx ().getConnectControls (); + } + + public Control[] getRequestControls () + throws NamingException + { + return getDefaultInitLdapCtx ().getRequestControls (); + } + + public Control[] getResponseControls () + throws NamingException + { + return getDefaultInitLdapCtx ().getResponseControls (); + } + + public LdapContext newInstance (Control[] reqControls) + throws NamingException + { + return getDefaultInitLdapCtx ().newInstance (reqControls); + } + + public void reconnect (Control[] connControls) + throws NamingException + { + getDefaultInitLdapCtx ().reconnect (connControls); + } + + public void setRequestControls (Control[] reqControls) + throws NamingException + { + getDefaultInitLdapCtx ().setRequestControls (reqControls); + } +} diff --git a/javax/naming/ldap/LdapContext.java b/javax/naming/ldap/LdapContext.java new file mode 100644 index 000000000..c61639434 --- /dev/null +++ b/javax/naming/ldap/LdapContext.java @@ -0,0 +1,62 @@ +/* LdapContext.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import javax.naming.*; +import javax.naming.directory.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface LdapContext extends DirContext +{ + public static final String CONTROL_FACTORIES = "java.naming.factory.control"; + + public ExtendedResponse extendedOperation(ExtendedRequest request) + throws NamingException; + public LdapContext newInstance(Control[] requestControls) + throws NamingException; + public void reconnect(Control[] connCtls) throws NamingException; + public Control[] getConnectControls() throws NamingException; + public void setRequestControls(Control[] requestControls) + throws NamingException; + public Control[] getRequestControls() throws NamingException; + public Control[] getResponseControls() throws NamingException; +} diff --git a/javax/naming/ldap/LdapReferralException.java b/javax/naming/ldap/LdapReferralException.java new file mode 100644 index 000000000..a4b4f0a62 --- /dev/null +++ b/javax/naming/ldap/LdapReferralException.java @@ -0,0 +1,65 @@ +/* LdapReferralException.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import javax.naming.*; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public abstract class LdapReferralException extends ReferralException +{ + protected LdapReferralException() + { + super(); + } + + protected LdapReferralException(String explanation) + { + super(explanation); + } + + public abstract Context getReferralContext() throws NamingException; + public abstract Context getReferralContext(Hashtable env) + throws NamingException; + public abstract Context getReferralContext(Hashtable env, Control[] reqCtls) + throws NamingException; +} diff --git a/javax/naming/ldap/UnsolicitedNotification.java b/javax/naming/ldap/UnsolicitedNotification.java new file mode 100644 index 000000000..b185d798a --- /dev/null +++ b/javax/naming/ldap/UnsolicitedNotification.java @@ -0,0 +1,51 @@ +/* UnsolicitedNotification.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import javax.naming.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface UnsolicitedNotification extends ExtendedResponse, HasControls +{ + public String[] getReferrals(); + public NamingException getException(); +} diff --git a/javax/naming/ldap/UnsolicitedNotificationEvent.java b/javax/naming/ldap/UnsolicitedNotificationEvent.java new file mode 100644 index 000000000..93d914423 --- /dev/null +++ b/javax/naming/ldap/UnsolicitedNotificationEvent.java @@ -0,0 +1,68 @@ +/* UnsolicitedNotificationEvent.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import java.util.EventObject; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 5, 2001 + */ + +public class UnsolicitedNotificationEvent extends EventObject +{ + // Serialized fields. + private UnsolicitedNotification notice; + + public UnsolicitedNotificationEvent(Object src, + UnsolicitedNotification notice) + { + super(src); + this.notice = notice; + } + + public UnsolicitedNotification getNotification() + { + return notice; + } + + public void dispatch(UnsolicitedNotificationListener listener) + { + listener.notificationReceived(this); + } +} diff --git a/javax/naming/ldap/UnsolicitedNotificationListener.java b/javax/naming/ldap/UnsolicitedNotificationListener.java new file mode 100644 index 000000000..c01f54532 --- /dev/null +++ b/javax/naming/ldap/UnsolicitedNotificationListener.java @@ -0,0 +1,50 @@ +/* UnsolicitedNotificationListener.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.ldap; +import javax.naming.event.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface UnsolicitedNotificationListener extends NamingListener +{ + public void notificationReceived(UnsolicitedNotificationEvent evt); +} diff --git a/javax/naming/spi/DirObjectFactory.java b/javax/naming/spi/DirObjectFactory.java new file mode 100644 index 000000000..c80aeeb5c --- /dev/null +++ b/javax/naming/spi/DirObjectFactory.java @@ -0,0 +1,54 @@ +/* DirObjectFactory.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; +import javax.naming.*; +import javax.naming.directory.*; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface DirObjectFactory extends ObjectFactory +{ + public Object getObjectInstance(Object obj, Name name, Context nameCtx, + Hashtable environment, Attributes attrs) + throws Exception; +} diff --git a/javax/naming/spi/DirStateFactory.java b/javax/naming/spi/DirStateFactory.java new file mode 100644 index 000000000..03d6c8d1c --- /dev/null +++ b/javax/naming/spi/DirStateFactory.java @@ -0,0 +1,80 @@ +/* DirStateFactory.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; +import javax.naming.*; +import javax.naming.directory.*; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface DirStateFactory extends StateFactory +{ + // Inner class + + public static class Result + { + private Object obj; + private Attributes outAttrs; + + public Result(Object obj, Attributes outAttrs) + { + this.obj = obj; + this.outAttrs = outAttrs; + } + + public Object getObject() + { + return obj; + } + + public Attributes getAttributes() + { + return outAttrs; + } + } + + public DirStateFactory.Result getStateToBind(Object obj, Name name, + Context nameCtx, + Hashtable environment, + Attributes inAttrs) + throws NamingException; +} diff --git a/javax/naming/spi/DirectoryManager.java b/javax/naming/spi/DirectoryManager.java new file mode 100644 index 000000000..78b960c74 --- /dev/null +++ b/javax/naming/spi/DirectoryManager.java @@ -0,0 +1,234 @@ +/* DirectoryManager.java -- + Copyright (C) 2000, 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; + +import javax.naming.*; +import javax.naming.directory.*; +import java.util.Hashtable; +import java.util.StringTokenizer; +import java.util.Enumeration; + +/** + * @author Tom Tromey <tromey@redhat.com> + * @date June 25, 2001 + */ +public class DirectoryManager extends NamingManager +{ + // Can't instantiate this class. + DirectoryManager () + { + } + + public static DirContext getContinuationDirContext (CannotProceedException c) + throws NamingException + { + return (DirContext) getContinuationContext (c); + } + + // Try to create an object using the factory. Return null on + // failure. + private static Object tryCreateObject (ObjectFactory factory, + Object refInfo, + Name name, + Context nameCtx, + Hashtable environment, + Attributes attrs) + throws Exception + { + if (factory instanceof DirObjectFactory) + { + DirObjectFactory dof = (DirObjectFactory) factory; + return dof.getObjectInstance (refInfo, name, nameCtx, + environment, attrs); + } + else + return factory.getObjectInstance (refInfo, name, nameCtx, + environment); + } + + public static Object getObjectInstance (Object refInfo, Name name, + Context nameCtx, + Hashtable environment, + Attributes attrs) + throws Exception + { + ObjectFactory factory = null; + + if (ofb != null) + factory = ofb.createObjectFactory (refInfo, environment); + else + { + // First see if we have a Reference or a Referenceable. If so + // we do some special processing. + Object ref2 = refInfo; + if (refInfo instanceof Referenceable) + ref2 = ((Referenceable) refInfo).getReference (); + if (ref2 instanceof Reference) + { + Reference ref = (Reference) ref2; + + // If we have a factory class name then we use that. + String fClass = ref.getFactoryClassName (); + if (fClass != null) + { + // Exceptions here are passed to the caller. + Class k = Class.forName (fClass); + factory = (ObjectFactory) k.newInstance (); + } + else + { + // There's no factory class name. If the address is a + // StringRefAddr with address type `URL', then we try + // the URL's context factory. + Enumeration e = ref.getAll (); + while (e.hasMoreElements ()) + { + RefAddr ra = (RefAddr) e.nextElement (); + if (ra instanceof StringRefAddr + && "URL".equals (ra.getType ())) + { + factory + = (ObjectFactory) getURLContext (refInfo, + name, + nameCtx, + (String) ra.getContent (), + environment); + Object obj = tryCreateObject (factory, + refInfo, + name, + nameCtx, + environment, + attrs); + if (obj != null) + return obj; + } + } + + // Have to try the next step. + factory = null; + } + } + + // Now look at OBJECT_FACTORIES to find the factory. + if (factory == null) + { + StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES, + environment, nameCtx); + + while (tokens.hasMoreTokens ()) + { + String klassName = tokens.nextToken (); + Class k = Class.forName (klassName); + factory = (ObjectFactory) k.newInstance (); + Object obj = tryCreateObject (factory, refInfo, name, + nameCtx, environment, attrs); + if (obj != null) + return obj; + } + + // Failure. + return refInfo; + } + } + + if (factory == null) + return refInfo; + Object obj = tryCreateObject (factory, refInfo, name, + nameCtx, environment, attrs); + return obj == null ? refInfo : obj; + } + + public static DirStateFactory.Result getStateToBind (Object obj, + Name name, + Context nameCtx, + Hashtable environment, + Attributes attrs) + throws NamingException + { + StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES, + environment, nameCtx); + while (tokens.hasMoreTokens ()) + { + String klassName = tokens.nextToken (); + try + { + Class k = Class.forName (klassName); + StateFactory factory = (StateFactory) k.newInstance (); + + DirStateFactory.Result result = null; + if (factory instanceof DirStateFactory) + { + DirStateFactory dsf = (DirStateFactory) factory; + result = dsf.getStateToBind (obj, name, nameCtx, environment, + attrs); + } + else + { + Object o = factory.getStateToBind (obj, name, nameCtx, + environment); + if (o != null) + result = new DirStateFactory.Result (o, attrs); + } + if (result != null) + return result; + } + catch (ClassNotFoundException _1) + { + // Ignore it. + } + catch (ClassCastException _2) + { + // This means that the class we found was not an + // ObjectFactory or that the factory returned something + // which was not a Context. + } + catch (InstantiationException _3) + { + // If we couldn't instantiate the factory we might get + // this. + } + catch (IllegalAccessException _4) + { + // Another possibility when instantiating. + } + } + + return new DirStateFactory.Result (obj, attrs); + } +} diff --git a/javax/naming/spi/InitialContextFactory.java b/javax/naming/spi/InitialContextFactory.java new file mode 100644 index 000000000..57a421ecf --- /dev/null +++ b/javax/naming/spi/InitialContextFactory.java @@ -0,0 +1,48 @@ +/* InitialContextFactory.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; + +import java.util.Hashtable; +import javax.naming.Context; +import javax.naming.NamingException; + +public interface InitialContextFactory +{ + public Context getInitialContext (Hashtable environment) throws NamingException; +} diff --git a/javax/naming/spi/InitialContextFactoryBuilder.java b/javax/naming/spi/InitialContextFactoryBuilder.java new file mode 100644 index 000000000..39d7eeb0d --- /dev/null +++ b/javax/naming/spi/InitialContextFactoryBuilder.java @@ -0,0 +1,47 @@ +/* InitialContextFactoryBuilder.java -- + Copyright (C) 2000 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; + +import java.util.Hashtable; +import javax.naming.NamingException; + +public interface InitialContextFactoryBuilder +{ + public InitialContextFactory createInitialContextFactory (Hashtable environment) throws NamingException; +} diff --git a/javax/naming/spi/NamingManager.java b/javax/naming/spi/NamingManager.java new file mode 100644 index 000000000..bb3d87253 --- /dev/null +++ b/javax/naming/spi/NamingManager.java @@ -0,0 +1,370 @@ +/* NamingManager.java -- + Copyright (C) 2000, 2001, 2002 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; + +import java.util.*; +import javax.naming.*; + +public class NamingManager +{ + public static final String CPE = "java.naming.spi.CannotProceedException"; + + private static InitialContextFactoryBuilder icfb = null; + + // Package private so DirectoryManager can access it. + static ObjectFactoryBuilder ofb = null; + + // This class cannot be instantiated. + NamingManager () + { + } + + public static boolean hasInitialContextFactoryBuilder () + { + return icfb != null; + } + + public static Context getInitialContext (Hashtable environment) + throws NamingException + { + InitialContextFactory icf = null; + + if (icfb != null) + icf = icfb.createInitialContextFactory(environment); + else + { + String java_naming_factory_initial = null; + if (environment != null) + java_naming_factory_initial + = (String) environment.get (Context.INITIAL_CONTEXT_FACTORY); + if (java_naming_factory_initial == null) + java_naming_factory_initial = + System.getProperty (Context.INITIAL_CONTEXT_FACTORY); + if (java_naming_factory_initial == null) + throw new + NoInitialContextException ("Can't find property: " + + Context.INITIAL_CONTEXT_FACTORY); + + try + { + icf = (InitialContextFactory) Class.forName (java_naming_factory_initial).newInstance (); + } + catch (Exception exception) + { + NoInitialContextException e + = new NoInitialContextException ("Can't load InitialContextFactory class: " + + java_naming_factory_initial); + e.setRootCause(exception); + throw e; + } + } + + return icf.getInitialContext (environment); + } + + static Context getURLContext (Object refInfo, + Name name, + Context nameCtx, + String scheme, + Hashtable environment) + throws NamingException + { + String prefixes = null; + if (environment != null) + prefixes = (String) environment.get (Context.URL_PKG_PREFIXES); + if (prefixes == null) + prefixes = System.getProperty (Context.URL_PKG_PREFIXES); + if (prefixes == null) + { + // Specified as the default in the docs. Unclear if this is + // right for us. + prefixes = "com.sun.jndi.url"; + } + + scheme += "URLContextFactory"; + + StringTokenizer tokens = new StringTokenizer (prefixes, ":"); + while (tokens.hasMoreTokens ()) + { + String aTry = tokens.nextToken (); + try + { + Class factoryClass = Class.forName (aTry + "." + scheme); + ObjectFactory factory = + (ObjectFactory) factoryClass.newInstance (); + Object obj = factory.getObjectInstance (refInfo, name, + nameCtx, environment); + Context ctx = (Context) obj; + if (ctx != null) + return ctx; + } + catch (ClassNotFoundException _1) + { + // Ignore it. + } + catch (ClassCastException _2) + { + // This means that the class we found was not an + // ObjectFactory or that the factory returned something + // which was not a Context. + } + catch (InstantiationException _3) + { + // If we couldn't instantiate the factory we might get + // this. + } + catch (IllegalAccessException _4) + { + // Another possibility when instantiating. + } + catch (NamingException _5) + { + throw _5; + } + catch (Exception _6) + { + // Anything from getObjectInstance. + } + } + + return null; + } + + public static Context getURLContext (String scheme, + Hashtable environment) + throws NamingException + { + return getURLContext (null, null, null, scheme, environment); + } + + public static void setObjectFactoryBuilder (ObjectFactoryBuilder builder) + throws NamingException + { + SecurityManager sm = System.getSecurityManager (); + if (sm != null) + sm.checkSetFactory (); + // Once the builder is installed it cannot be replaced. + if (ofb != null) + throw new IllegalStateException ("builder already installed"); + if (builder != null) + ofb = builder; + } + + static StringTokenizer getPlusPath (String property, Hashtable env, + Context nameCtx) + throws NamingException + { + String path = (String) env.get (property); + if (nameCtx == null) + nameCtx = getInitialContext (env); + String path2 = (String) nameCtx.getEnvironment ().get (property); + if (path == null) + path = path2; + else if (path2 != null) + path += ":" + path2; + return new StringTokenizer (path != null ? path : "", ":"); + } + + public static Object getObjectInstance (Object refInfo, + Name name, + Context nameCtx, + Hashtable environment) + throws Exception + { + ObjectFactory factory = null; + + if (ofb != null) + factory = ofb.createObjectFactory (refInfo, environment); + else + { + // First see if we have a Reference or a Referenceable. If so + // we do some special processing. + Object ref2 = refInfo; + if (refInfo instanceof Referenceable) + ref2 = ((Referenceable) refInfo).getReference (); + if (ref2 instanceof Reference) + { + Reference ref = (Reference) ref2; + + // If we have a factory class name then we use that. + String fClass = ref.getFactoryClassName (); + if (fClass != null) + { + // Exceptions here are passed to the caller. + Class k = Class.forName (fClass); + factory = (ObjectFactory) k.newInstance (); + } + else + { + // There's no factory class name. If the address is a + // StringRefAddr with address type `URL', then we try + // the URL's context factory. + Enumeration e = ref.getAll (); + while (e.hasMoreElements ()) + { + RefAddr ra = (RefAddr) e.nextElement (); + if (ra instanceof StringRefAddr + && "URL".equals (ra.getType ())) + { + factory + = (ObjectFactory) getURLContext (refInfo, + name, + nameCtx, + (String) ra.getContent (), + environment); + Object obj = factory.getObjectInstance (refInfo, + name, + nameCtx, + environment); + if (obj != null) + return obj; + } + } + + // Have to try the next step. + factory = null; + } + } + + // Now look at OBJECT_FACTORIES to find the factory. + if (factory == null) + { + StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES, + environment, nameCtx); + + while (tokens.hasMoreTokens ()) + { + String klassName = tokens.nextToken (); + Class k = Class.forName (klassName); + factory = (ObjectFactory) k.newInstance (); + Object obj = factory.getObjectInstance (refInfo, name, + nameCtx, environment); + if (obj != null) + return obj; + } + + // Failure. + return refInfo; + } + } + + if (factory == null) + return refInfo; + Object obj = factory.getObjectInstance (refInfo, name, + nameCtx, environment); + return obj == null ? refInfo : obj; + } + + public static void setInitialContextFactoryBuilder (InitialContextFactoryBuilder builder) + throws NamingException + { + SecurityManager sm = System.getSecurityManager (); + if (sm != null) + sm.checkSetFactory (); + // Once the builder is installed it cannot be replaced. + if (icfb != null) + throw new IllegalStateException ("builder already installed"); + if (builder != null) + icfb = builder; + } + + public static Context getContinuationContext (CannotProceedException cpe) + throws NamingException + { + Hashtable env = cpe.getEnvironment (); + if (env != null) + env.put (CPE, cpe); + + // It is really unclear to me if this is right. + try + { + Object obj = getObjectInstance (null, cpe.getAltName (), + cpe.getAltNameCtx (), env); + if (obj != null) + return (Context) obj; + } + catch (Exception _) + { + } + + throw cpe; + } + + public static Object getStateToBind (Object obj, Name name, + Context nameCtx, Hashtable environment) + throws NamingException + { + StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES, + environment, nameCtx); + while (tokens.hasMoreTokens ()) + { + String klassName = tokens.nextToken (); + try + { + Class k = Class.forName (klassName); + StateFactory factory = (StateFactory) k.newInstance (); + Object o = factory.getStateToBind (obj, name, nameCtx, + environment); + if (o != null) + return o; + } + catch (ClassNotFoundException _1) + { + // Ignore it. + } + catch (ClassCastException _2) + { + // This means that the class we found was not an + // ObjectFactory or that the factory returned something + // which was not a Context. + } + catch (InstantiationException _3) + { + // If we couldn't instantiate the factory we might get + // this. + } + catch (IllegalAccessException _4) + { + // Another possibility when instantiating. + } + } + + return obj; + } +} diff --git a/javax/naming/spi/ObjectFactory.java b/javax/naming/spi/ObjectFactory.java new file mode 100644 index 000000000..5b291f04c --- /dev/null +++ b/javax/naming/spi/ObjectFactory.java @@ -0,0 +1,51 @@ +/* ObjectFactory.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; + +import java.util.Hashtable; +import javax.naming.*; + +public interface ObjectFactory +{ + public Object getObjectInstance (Object obj, + Name name, + Context nameCtx, + Hashtable environment) + throws Exception; +} diff --git a/javax/naming/spi/ObjectFactoryBuilder.java b/javax/naming/spi/ObjectFactoryBuilder.java new file mode 100644 index 000000000..828f5c935 --- /dev/null +++ b/javax/naming/spi/ObjectFactoryBuilder.java @@ -0,0 +1,53 @@ +/* ObjectFactoryBuilder.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; +import javax.naming.*; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface ObjectFactoryBuilder +{ + public ObjectFactory createObjectFactory(Object obj, + Hashtable environment) + throws NamingException; +} diff --git a/javax/naming/spi/ResolveResult.java b/javax/naming/spi/ResolveResult.java new file mode 100644 index 000000000..7e34e3c7d --- /dev/null +++ b/javax/naming/spi/ResolveResult.java @@ -0,0 +1,123 @@ +/* ResolveResult.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; +import javax.naming.*; +import java.util.EventObject; +import java.io.Serializable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 5, 2001 + */ + +public class ResolveResult implements Serializable +{ + // Serialized fields. + protected Object resolvedObj; + protected Name remainingName; + + protected ResolveResult() + { + resolvedObj = null; + remainingName = null; + } + + public ResolveResult(Object robj, String rcomp) + { + if (robj == null || rcomp == null) + throw new IllegalArgumentException (); + resolvedObj = robj; + remainingName = new CompositeName (); + try + { + remainingName.add (rcomp); + } + catch (InvalidNameException _) + { + } + } + + public ResolveResult(Object robj, Name rname) + { + resolvedObj = robj; + remainingName = rname; + } + + public Name getRemainingName() + { + return remainingName; + } + + public Object getResolvedObj() + { + return resolvedObj; + } + + public void setRemainingName(Name name) + { + remainingName = (Name) name.clone(); + } + + public void appendRemainingName(Name name) + { + try + { + remainingName.addAll(name); + } + catch (InvalidNameException _) + { + } + } + + public void appendRemainingComponent(String name) + { + try + { + remainingName.add(name); + } + catch (InvalidNameException _) + { + } + } + + public void setResolvedObj(Object obj) + { + resolvedObj = obj; + } +} diff --git a/javax/naming/spi/Resolver.java b/javax/naming/spi/Resolver.java new file mode 100644 index 000000000..1cae847f1 --- /dev/null +++ b/javax/naming/spi/Resolver.java @@ -0,0 +1,53 @@ +/* Resolver.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; +import javax.naming.*; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface Resolver +{ + public ResolveResult resolveToClass(Name name, Class contextType) + throws NamingException; + public ResolveResult resolveToClass(String name, Class contextType) + throws NamingException; +} diff --git a/javax/naming/spi/StateFactory.java b/javax/naming/spi/StateFactory.java new file mode 100644 index 000000000..3f41b551d --- /dev/null +++ b/javax/naming/spi/StateFactory.java @@ -0,0 +1,52 @@ +/* StateFactory.java -- + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.spi; +import javax.naming.*; +import java.util.Hashtable; + +/** + * @author Warren Levy <warrenl@redhat.com> + * @date June 1, 2001 + */ + +public interface StateFactory +{ + public Object getStateToBind(Object obj, Name name, Context nameCtx, + Hashtable environment) throws NamingException; +} |