diff options
author | Tom Tromey <tromey@gcc.gnu.org> | 2005-07-16 00:30:23 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2005-07-16 00:30:23 +0000 |
commit | f911ba985aa7fe0096c386c5be385ac5825ea527 (patch) | |
tree | a0b991cf5866ae1d616639b906ac001811d74508 /libjava/classpath/javax/naming | |
parent | 6f4434b39b261de5317dc81ddfdd94d2e1d62b11 (diff) | |
download | gcc-f911ba985aa7fe0096c386c5be385ac5825ea527.zip gcc-f911ba985aa7fe0096c386c5be385ac5825ea527.tar.gz gcc-f911ba985aa7fe0096c386c5be385ac5825ea527.tar.bz2 |
Initial revision
From-SVN: r102074
Diffstat (limited to 'libjava/classpath/javax/naming')
93 files changed, 8887 insertions, 0 deletions
diff --git a/libjava/classpath/javax/naming/AuthenticationException.java b/libjava/classpath/javax/naming/AuthenticationException.java new file mode 100644 index 0000000..f332561 --- /dev/null +++ b/libjava/classpath/javax/naming/AuthenticationException.java @@ -0,0 +1,53 @@ +/* AuthenticationException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class AuthenticationException extends NamingSecurityException +{ + public AuthenticationException () + { + super (); + } + + public AuthenticationException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java b/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java new file mode 100644 index 0000000..52b133a --- /dev/null +++ b/libjava/classpath/javax/naming/AuthenticationNotSupportedException.java @@ -0,0 +1,54 @@ +/* AuthenticationNotSupportedException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class AuthenticationNotSupportedException + extends NamingSecurityException +{ + public AuthenticationNotSupportedException () + { + super (); + } + + public AuthenticationNotSupportedException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/BinaryRefAddr.java b/libjava/classpath/javax/naming/BinaryRefAddr.java new file mode 100644 index 0000000..0b813ab --- /dev/null +++ b/libjava/classpath/javax/naming/BinaryRefAddr.java @@ -0,0 +1,156 @@ +/* BinaryRefAddr.java -- RefAddr that uses a byte array as content. + Copyright (C) 2001 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming; + +import java.util.Arrays; + +/** + * RefAddr that uses a byte array as content. + * This can be used to reference objects that can only be represented as + * byte arrays. + * + * @see Reference + * @since 1.3 + * @author Mark Wielaard (mark@klomp.org) + */ +public class BinaryRefAddr extends RefAddr +{ + static final long serialVersionUID = -3415254970957330361L; + + /** + * The possibly null content of this RefAddr. + * Set by the constructor and returned by getContent. + */ + private final byte[] buf; + + /** + * Contructs a new BinaryRefAddr with the given type and content. + * The complete content of the byte array is copied to a new array. + */ + public BinaryRefAddr (String addrType, byte[] buf) + { + this(addrType, buf, 0, buf.length); + } + + /** + * Contructs a new BinaryRefAddr with the given type and the content + * taken from the given byte array. + * The content of the byte array is copied to a new array. + */ + public BinaryRefAddr (String addrType, byte[] buf, int off, int length) + { + super(addrType); + this.buf = new byte[length]; + System.arraycopy(buf, off, this.buf, 0, length); + } + + /** + * Returns the byte array contents as given to the constructor. + * The returned byte array is shared with this object and other callers. + * Changing the content of the buffer is discouraged and should only be + * done when the byte array is locked. + */ + public Object getContent () + { + return buf; + } + + /** + * Checks if the object is a BinaryRefAddr with the same type and with the + * same bytes in the content. + * + * @return true if the given object is an instance of BinaryRefAddr, + * the addrType is the same as this addrType and the bytes of the + * content are the same. + */ + public boolean equals(Object o) + { + if (o instanceof BinaryRefAddr) + { + BinaryRefAddr refAddr = (BinaryRefAddr) o; + if (this.getType().equals(refAddr.getType())) + { + byte[] c1 = (byte[]) this.getContent(); + byte[] c2 = (byte[]) refAddr.getContent(); + return Arrays.equals(c1, c2); + } + } + return false; + } + + /** + * Returns the hashCode which is the hasCode of the String returned by + * <code>getType()</code> plus the hashCode of the byte array returned by + * <code>getContent</code>. The hashCode of the byte array is calculated + * by taking the xor of all the bytes in the array, or zero when there are + * no bytes in the array. + */ + public int hashCode() + { + int result = 0; + byte[] b = (byte[]) getContent(); + for (int i=0; i < b.length; i++) + result = result^b[i]; + + return getType().hashCode() + result; + } + + private static char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + /** + * Returns a String representation of the RefAddr. Only the first 32 bytes + * of the content are added as hex encoded characters. + * Should only be used for debugging purposes. + */ + public String toString() + { + StringBuffer sb = new StringBuffer("[RefAddr type: "); + sb.append(getType()); + sb.append(" content: 0x"); + byte[] b = (byte[]) getContent(); + for (int i=0; i < b.length && i < 32; i++) + { + sb.append(hex[(b[i]&0xf0)>>4]); + sb.append(hex[b[i]&0x0f]); + } + if (b.length > 32) + sb.append("..."); + sb.append("]"); + return sb.toString(); + } +} diff --git a/libjava/classpath/javax/naming/Binding.java b/libjava/classpath/javax/naming/Binding.java new file mode 100644 index 0000000..91c0d95 --- /dev/null +++ b/libjava/classpath/javax/naming/Binding.java @@ -0,0 +1,98 @@ +/* Binding.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +/** + * @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/libjava/classpath/javax/naming/CannotProceedException.java b/libjava/classpath/javax/naming/CannotProceedException.java new file mode 100644 index 0000000..3a69cd3 --- /dev/null +++ b/libjava/classpath/javax/naming/CannotProceedException.java @@ -0,0 +1,105 @@ +/* CannotProceedException.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import 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/libjava/classpath/javax/naming/CommunicationException.java b/libjava/classpath/javax/naming/CommunicationException.java new file mode 100644 index 0000000..c780387 --- /dev/null +++ b/libjava/classpath/javax/naming/CommunicationException.java @@ -0,0 +1,53 @@ +/* CommunicationException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class CommunicationException extends NamingException +{ + public CommunicationException () + { + super (); + } + + public CommunicationException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/CompositeName.java b/libjava/classpath/javax/naming/CompositeName.java new file mode 100644 index 0000000..61adcf1 --- /dev/null +++ b/libjava/classpath/javax/naming/CompositeName.java @@ -0,0 +1,321 @@ +/* CompositeName.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import 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 +{ + private static final long serialVersionUID = 1667768148915813118L; + + 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/libjava/classpath/javax/naming/CompoundName.java b/libjava/classpath/javax/naming/CompoundName.java new file mode 100644 index 0000000..4b30557 --- /dev/null +++ b/libjava/classpath/javax/naming/CompoundName.java @@ -0,0 +1,498 @@ +/* CompoundName.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import java.io.Serializable; +import java.util.Enumeration; +import java.util.NoSuchElementException; +import java.util.Properties; +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. + * + * @since 1.3 + */ +public class CompoundName implements Name, Cloneable, Serializable +{ + private static final long serialVersionUID = 3513100557083972036L; + + private CompoundName (Properties syntax) + { + elts = new Vector (); + mySyntax = syntax; + initializeSyntax (); + } + + protected CompoundName (Enumeration comps, Properties syntax) + { + elts = new Vector (); + mySyntax = syntax; + initializeSyntax (); + try + { + while (comps.hasMoreElements ()) + elts.add (comps.nextElement ()); + } + catch (NoSuchElementException ignore) + { + } + } + + public CompoundName (String n, Properties syntax) + throws InvalidNameException + { + elts = new Vector (); + mySyntax = syntax; + initializeSyntax (); + + 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 + && beginQuote != null) + { + quote = endQuote; + i += special.length (); + continue; + } + else if (new_element.length () == 0 + && special == beginQuote2 + && beginQuote2 != null) + { + quote = endQuote2; + i += special.length (); + continue; + } + else if (direction != FLAT && special == separator) + { + elts.add (new_element.toString ()); + new_element.setLength (0); + i += special.length (); + continue; + } + + // Nothing in particular, so try the next character. + new_element.append (n.charAt (i)); + ++i; + } + + if (new_element.length () != 0) + elts.add (new_element.toString ()); + + if (direction == RIGHT_TO_LEFT) + { + // Reverse the order of the elements. + int len = elts.size (); + for (i = 0; i < len / 2; ++i) + { + 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 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 (delta + 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/libjava/classpath/javax/naming/ConfigurationException.java b/libjava/classpath/javax/naming/ConfigurationException.java new file mode 100644 index 0000000..1966548 --- /dev/null +++ b/libjava/classpath/javax/naming/ConfigurationException.java @@ -0,0 +1,53 @@ +/* ConfigurationException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class ConfigurationException extends NamingException +{ + public ConfigurationException () + { + super (); + } + + public ConfigurationException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/Context.java b/libjava/classpath/javax/naming/Context.java new file mode 100644 index 0000000..9df82c68 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import java.util.Hashtable; + +public interface Context +{ + // Property with name of the inital context factory to use + String INITIAL_CONTEXT_FACTORY + = "java.naming.factory.initial"; + + // Property with colon-separated list of object factories to use. + String OBJECT_FACTORIES + = "java.naming.factory.object"; + + // Property with colon-separated list of state factories to use. + String STATE_FACTORIES + = "java.naming.factory.state"; + + // Property with colon-separated list of package prefixes to use. + String URL_PKG_PREFIXES + = "java.naming.factory.url.pkgs"; + + // Property with URL specifying configuration for the service + // provider to use. + String PROVIDER_URL + = "java.naming.provider.url"; + + // Property with the DNS host and domain names to use. + String DNS_URL + = "java.naming.dns.url"; + + // Property with the authoritativeness of the service requested. + String AUTHORITATIVE + = "java.naming.authoritative"; + + // Property with the batch size to use when returning data via the + // service's protocol. + String BATCHSIZE + = "java.naming.batchsize"; + + // Property defining how referrals encountered by the service + // provider are to be processed. + String REFERRAL + = "java.naming.referral"; + + // Property specifying the security protocol to use. + String SECURITY_PROTOCOL + = "java.naming.security.protocol"; + + // Property specifying the security level to use. + String SECURITY_AUTHENTICATION + = "java.naming.security.authentication"; + + // Property for the identity of the principal for authenticating + // the caller to the service. + String SECURITY_PRINCIPAL + = "java.naming.security.principal"; + + // Property specifying the credentials of the principal for + // authenticating the caller to the service. + String SECURITY_CREDENTIALS + = "java.naming.security.credentials"; + + // Property for specifying the preferred language to use with the + // service. + String LANGUAGE + = "java.naming.language"; + + // Property for the initial context constructor to use when searching + // for other properties. + String APPLET + = "java.naming.applet"; + + void bind (Name name, Object obj) throws NamingException; + void bind (String name, Object obj) throws NamingException; + + Object lookup (Name name) throws NamingException; + Object lookup (String name) throws NamingException; + + void rebind (Name name, Object obj) throws NamingException; + void rebind (String name, Object obj) throws NamingException; + + void unbind (Name name) throws NamingException; + void unbind (String name) throws NamingException; + + void rename (Name oldName, Name newName) throws NamingException; + void rename (String oldName, String newName) throws NamingException; + + NamingEnumeration list (Name name) throws NamingException; + NamingEnumeration list (String name) throws NamingException; + + NamingEnumeration listBindings (Name name) throws NamingException; + NamingEnumeration listBindings (String name) throws NamingException; + + void destroySubcontext (Name name) throws NamingException; + void destroySubcontext (String name) throws NamingException; + + Context createSubcontext (Name name) throws NamingException; + Context createSubcontext (String name) throws NamingException; + + Object lookupLink (Name name) throws NamingException; + Object lookupLink (String name) throws NamingException; + + NameParser getNameParser (Name name) throws NamingException; + NameParser getNameParser (String name) throws NamingException; + + Name composeName (Name name, Name prefix) throws NamingException; + String composeName (String name, + String prefix) throws NamingException; + + Object addToEnvironment (String propName, + Object propVal) throws NamingException; + + Object removeFromEnvironment (String propName) throws NamingException; + + Hashtable getEnvironment () throws NamingException; + + void close () throws NamingException; + + String getNameInNamespace () throws NamingException; +} + diff --git a/libjava/classpath/javax/naming/ContextNotEmptyException.java b/libjava/classpath/javax/naming/ContextNotEmptyException.java new file mode 100644 index 0000000..c6fe5e8 --- /dev/null +++ b/libjava/classpath/javax/naming/ContextNotEmptyException.java @@ -0,0 +1,53 @@ +/* ContextNotEmptyException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class ContextNotEmptyException extends NamingException +{ + public ContextNotEmptyException () + { + super (); + } + + public ContextNotEmptyException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/InitialContext.java b/libjava/classpath/javax/naming/InitialContext.java new file mode 100644 index 0000000..1a9ee5a --- /dev/null +++ b/libjava/classpath/javax/naming/InitialContext.java @@ -0,0 +1,393 @@ +/* InitialContext.java -- + Copyright (C) 2000, 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import java.applet.Applet; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.Properties; + +import javax.naming.spi.NamingManager; + +public class InitialContext implements Context +{ + protected Context defaultInitCtx; + protected boolean gotDefault = false; + protected Hashtable myProps; + + public InitialContext (Hashtable environment) + throws NamingException + { + init (environment); + } + + protected InitialContext (boolean lazy) + throws NamingException + { + if (! lazy) + init (null); + } + + public InitialContext () + throws NamingException + { + init (null); + } + + /** @since 1.3 */ + protected void init (Hashtable environment) + throws NamingException + { + // 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("gnu.classpath.home.url"); + if (home != null) + { + String url = home + "/jndi.properties"; + Properties p = new Properties (); + + try + { + InputStream is = new URL(url).openStream(); + p.load (is); + is.close (); + } + catch (IOException e) + { + // Ignore. + } + + 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 + { + try + { + return getURLOrDefaultInitCtx (name).lookup (name); + } + catch (CannotProceedException cpe) + { + Context ctx = NamingManager.getContinuationContext (cpe); + return ctx.lookup (cpe.getRemainingName()); + } + } + + public Object lookup (String name) throws NamingException + { + try + { + return getURLOrDefaultInitCtx (name).lookup (name); + } + catch (CannotProceedException cpe) + { + Context ctx = NamingManager.getContinuationContext (cpe); + return ctx.lookup (cpe.getRemainingName()); + } + } + + 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 + { + myProps = null; + defaultInitCtx = null; + } + + public String getNameInNamespace () throws NamingException + { + throw new OperationNotSupportedException (); + } +} diff --git a/libjava/classpath/javax/naming/InsufficientResourcesException.java b/libjava/classpath/javax/naming/InsufficientResourcesException.java new file mode 100644 index 0000000..bcb9fe5 --- /dev/null +++ b/libjava/classpath/javax/naming/InsufficientResourcesException.java @@ -0,0 +1,53 @@ +/* InsufficientResourcesException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class InsufficientResourcesException extends NamingException +{ + public InsufficientResourcesException () + { + super (); + } + + public InsufficientResourcesException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/InterruptedNamingException.java b/libjava/classpath/javax/naming/InterruptedNamingException.java new file mode 100644 index 0000000..8cdf30d --- /dev/null +++ b/libjava/classpath/javax/naming/InterruptedNamingException.java @@ -0,0 +1,53 @@ +/* InterruptedNamingException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class InterruptedNamingException extends NamingException +{ + public InterruptedNamingException () + { + super (); + } + + public InterruptedNamingException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/InvalidNameException.java b/libjava/classpath/javax/naming/InvalidNameException.java new file mode 100644 index 0000000..a3b99e1 --- /dev/null +++ b/libjava/classpath/javax/naming/InvalidNameException.java @@ -0,0 +1,66 @@ +/* InvalidNameException.java -- Exception indicating an invalid component/name + 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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming; + +/** + * Exception indicating an invalid component or <code>Name</code>. + * Thrown when a <code>Name</code> or component of a name is encountered that + * does not follow the syntactic rules of a particular <code>Name</code> class. + * + * @author Anthony Green (green@redhat.com) + * @author Mark Wielaard (mark@klomp.org) + */ +public class InvalidNameException extends NamingException +{ + /** + * Creates a new exception without setting any of its fields. + */ + public InvalidNameException () + { + super (); + } + + /** + * Creates a new exception and sets the detailed message field. + * All other fields are not set. + */ + public InvalidNameException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/LimitExceededException.java b/libjava/classpath/javax/naming/LimitExceededException.java new file mode 100644 index 0000000..7e7af81 --- /dev/null +++ b/libjava/classpath/javax/naming/LimitExceededException.java @@ -0,0 +1,53 @@ +/* LimitExceededException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class LimitExceededException extends NamingException +{ + public LimitExceededException () + { + super (); + } + + public LimitExceededException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/LinkException.java b/libjava/classpath/javax/naming/LinkException.java new file mode 100644 index 0000000..2c3c507 --- /dev/null +++ b/libjava/classpath/javax/naming/LinkException.java @@ -0,0 +1,117 @@ +/* LinkException.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +/** + * @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/libjava/classpath/javax/naming/LinkLoopException.java b/libjava/classpath/javax/naming/LinkLoopException.java new file mode 100644 index 0000000..9c00dbe --- /dev/null +++ b/libjava/classpath/javax/naming/LinkLoopException.java @@ -0,0 +1,53 @@ +/* LinkLoopException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class LinkLoopException extends LinkException +{ + public LinkLoopException () + { + super (); + } + + public LinkLoopException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/LinkRef.java b/libjava/classpath/javax/naming/LinkRef.java new file mode 100644 index 0000000..35d9a40 --- /dev/null +++ b/libjava/classpath/javax/naming/LinkRef.java @@ -0,0 +1,67 @@ +/* LinkRef.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +/** + * @author Tom Tromey (tromey@redhat.com) + * @date May 16, 2001 + */ +public class LinkRef extends Reference +{ + private static final long serialVersionUID = -5386290613498931298L; + + public LinkRef (Name name) + { + this (name.toString ()); + } + + public LinkRef (String name) + { + // FIXME: javax.naming.LinkRef? + super ("LinkRef", new StringRefAddr ("LinkAddress", name)); + } + + public String getLinkName () + throws NamingException + { + StringRefAddr sra = (StringRefAddr) get (0); + return (String) sra.getContent (); + } +} diff --git a/libjava/classpath/javax/naming/MalformedLinkException.java b/libjava/classpath/javax/naming/MalformedLinkException.java new file mode 100644 index 0000000..5422b90 --- /dev/null +++ b/libjava/classpath/javax/naming/MalformedLinkException.java @@ -0,0 +1,53 @@ +/* MalformedLinkException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class MalformedLinkException extends LinkException +{ + public MalformedLinkException () + { + super (); + } + + public MalformedLinkException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/Name.java b/libjava/classpath/javax/naming/Name.java new file mode 100644 index 0000000..f8592d9 --- /dev/null +++ b/libjava/classpath/javax/naming/Name.java @@ -0,0 +1,198 @@ +/* Name.java -- Name build up from different components + Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming; + +import java.io.Serializable; +import java.util.Enumeration; + +/** + * Interface descriping a name build up from different components. + * The components are represented as <code>String</code>s which are + * ordered from most significant to least significant. There are methods to + * get the number of components. Methods to get a particular component or group + * of components. Components can be added as <code>String</code>s or + * <code>Name</code>s and a component can be removed from any position in the + * <code>Name</code>. + * A <code>Name</code> can be compared to another <code>Name</code> and it can + * be checked if a particular <code>Name</code> starts or ends with the same + * components as another <code>Name</code>. Finally <code>Name</code>s can be + * serialized and cloned. + * <p> + * Since <code>Name</code>s can be empty (have no components) methods that + * return a <code>Name</code> will never return <code>null</code>. + * + * @since 1.3 + * @author Anthony Green (green@redhat.com) + * @author Mark Wielaard (mark@klomp.org) + */ +public interface Name extends Cloneable, Serializable +{ + long serialVersionUID = -3617482732056931635L; + + /** + * Returns the number of components of this <code>Name</code>. + * The returned number can be zero. + */ + int size(); + + /** + * Returns <code>true</code> if the number of components of this + * <code>Name</code> is zero, <code>false</code> otherwise. + */ + boolean isEmpty(); + + /** + * Returns a non-null (but possibly empty) <code>Enumeration</code> of the + * components of the <code>Name</code> as <code>String</code>s. + */ + Enumeration getAll(); + + /** + * Gets the component at the given index. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to <code>size()</code>. + */ + String get(int i); + + /** + * Returns the components till the given index as a <code>Name</code>. + * The returned <code>Name</code> can be modified without changing the + * original. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to <code>size()</code>. + */ + Name getPrefix(int i); + + /** + * Returns the components from the given index till the end as a + * <code>Name</code>. + * The returned <code>Name</code> can be modified without changing the + * original. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to <code>size()</code>. + */ + Name getSuffix(int i); + + /** + * Adds the given <code>String</code> component to the end of this + * <code>Name</code>. The method modifies the current <code>Name</code> and + * then returns it. + * + * @exception InvalidNameException if the given <code>String</code> is not a + * valid component for this <code>Name</code>. + */ + Name add(String comp) throws InvalidNameException; + + /** + * Inserts the given <code>String</code> component to this <code>Name</code> + * at the given index. The method modifies the current <code>Name</code> and + * then returns it. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to <code>size()</code>. + * @exception InvalidNameException if the given <code>String</code> is not a + * valid component for this <code>Name</code>. + */ + Name add(int posn, String comp) throws InvalidNameException; + + /** + * Adds all the components of the given <code>Name</code> to the end of this + * <code>Name</code>. The method modifies the current <code>Name</code> and + * then returns it. + * + * @exception InvalidNameException if any of the given components is not a + * valid component for this <code>Name</code>. + */ + Name addAll(Name suffix) throws InvalidNameException; + + /** + * Inserts all the components of the given <code>Name</code> to this + * <code>Name</code> at the given index. The method modifies the current + * <code>Name</code> and then returns it. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to <code>size()</code>. + * @exception InvalidNameException if any of the given components is not a + * valid component for this <code>Name</code>. + */ + Name addAll(int posn, Name n) throws InvalidNameException; + + /** + * Removes the component at the given index from this <code>Name</code>. + * The method modifies the current <code>Name</code> and then returns it. + * + * @exception InvalidNameException if the given <code>String</code> is not a + * valid component for this <code>Name</code>. + */ + Object remove(int posn) throws InvalidNameException; + + /** + * Returns <code>true</code> if this <code>Name</code> starts with the + * components of the given <code>Name</code>, <code>false</code> otherwise. + */ + boolean startsWith(Name name); + + /** + * Returns <code>true</code> if this <code>Name</code> ends with the + * components of the given <code>Name</code>, <code>false</code> otherwise. + */ + boolean endsWith(Name name); + + /** + * Compares the given object to this <code>Name</code>. + * Returns a negative value if the given <code>Object</code> is smaller then + * this <code>Name</code>, a positive value if the <code>Object</code> is + * bigger, and zero if the are equal. If the <code>Object</code> is not of + * a class that can be compared to the class of this <code>Name</code> then + * a <code>ClassCastException</code> is thrown. Note that it is not + * guaranteed that <code>Name</code>s implemented in different classes can + * be compared. The definition of smaller, bigger and equal is up to the + * actual implementing class. + */ + int compareTo(Object obj); + + /** + * Returns a clone of this <code>Name</code>. It will be a deep copy of + * all the components of the <code>Name</code> so that changes to components + * of the components does not change the component in this <code>Name</code>. + */ + Object clone(); +} diff --git a/libjava/classpath/javax/naming/NameAlreadyBoundException.java b/libjava/classpath/javax/naming/NameAlreadyBoundException.java new file mode 100644 index 0000000..4b2fb0e --- /dev/null +++ b/libjava/classpath/javax/naming/NameAlreadyBoundException.java @@ -0,0 +1,53 @@ +/* NameAlreadyBoundException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class NameAlreadyBoundException extends NamingException +{ + public NameAlreadyBoundException () + { + super (); + } + + public NameAlreadyBoundException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/NameClassPair.java b/libjava/classpath/javax/naming/NameClassPair.java new file mode 100644 index 0000000..4e26051 --- /dev/null +++ b/libjava/classpath/javax/naming/NameClassPair.java @@ -0,0 +1,101 @@ +/* NameClassPair.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import 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/libjava/classpath/javax/naming/NameNotFoundException.java b/libjava/classpath/javax/naming/NameNotFoundException.java new file mode 100644 index 0000000..b533b04 --- /dev/null +++ b/libjava/classpath/javax/naming/NameNotFoundException.java @@ -0,0 +1,53 @@ +/* NameNotFoundException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class NameNotFoundException extends NamingException +{ + public NameNotFoundException () + { + super (); + } + + public NameNotFoundException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/NameParser.java b/libjava/classpath/javax/naming/NameParser.java new file mode 100644 index 0000000..1aeaf36 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +public interface NameParser +{ + Name parse (String name) throws NamingException; +} + + diff --git a/libjava/classpath/javax/naming/NamingEnumeration.java b/libjava/classpath/javax/naming/NamingEnumeration.java new file mode 100644 index 0000000..3c9ee2d --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import java.util.Enumeration; + +public interface NamingEnumeration extends Enumeration +{ + void close() throws NamingException; + boolean hasMore() throws NamingException; + Object next() throws NamingException; +} diff --git a/libjava/classpath/javax/naming/NamingException.java b/libjava/classpath/javax/naming/NamingException.java new file mode 100644 index 0000000..ad39233 --- /dev/null +++ b/libjava/classpath/javax/naming/NamingException.java @@ -0,0 +1,315 @@ +/* NamingException.java -- Superclass of all naming Exceptions + 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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * Superclass of all naming Exceptions. + * Can contain extra information about the root cause of this exception + * (for example when the original exception was not a subclass of + * <code>NamingException</code>), the part of the <code>Name</code> that + * could be resolved (including the <code>Object</code> it resolved to) + * and the part of the <code>Name</code> that could not be resolved when + * the exception occured. + * + * @since 1.3 + * @author Anthony Green (green@redhat.com) + * @author Mark Wielaard (mark@klomp.org) + */ +public class NamingException extends Exception +{ + private static final long serialVersionUID = -1299181962103167177L; + + /** + * The root cause of this exception. Might be null. Set by calling + * <code>setRootCause()</code>, can be accessed by calling + * <code>getRootCause()</code>. + */ + protected Throwable rootException; + + /** + * If the exception was caused while resolving a <code>Name</code> then + * this field contains that part of the name that could be resolved. + * Field might be null. Set by calling <code>setResolvedName()</code>. + * Can be accessed by calling <code>getResolvedName</code>. + */ + protected Name resolvedName; + + /** + * If the exception was caused while resolving a <code>Name</code> then + * this field contains the object that part of the name could be resolved to. + * Field might be null. Set by calling <code>setResolvedObj()</code>. + * Can be accessed by calling <code>getResolvedObj</code>. + */ + protected Object resolvedObj; + + /** + * If the exception was caused while resolving a <code>Name</code> then + * this field contains that part of the name that could not be resolved. + * Field might be null. Set by calling <code>setRemainingName()</code>. + * The field can be extended by calling <code>appendRemainingName()</code> + * or <code>appendRemainingComponent()</code>. + * Can be accessed by calling <code>getRemainingName</code>. + */ + protected Name remainingName; + + /** + * Creates a new NamingException without a message. Does not set any of the + * <code>rootException</code>, <code>resolvedName</code>, + * <code>resolvedObj</code> or <code>remainingObject</code> fields. + * These fields can be set later. + */ + public NamingException () + { + super(); + } + + /** + * Creates a new NamingException with a detailed message. Does not set + * the <code>rootException</code>, <code>resolvedName</code>, + * <code>resolvedObj</code> or <code>remainingObject,</code> fields. + * These fields can be set later. + */ + public NamingException (String msg) + { + super(msg); + } + + /** + * Gets the root cause field <code>rootException</code> of this Exception. + */ + public Throwable getRootCause () + { + return rootException; + } + + /** + * Sets the root cause field <code>rootException</code> of this Exception. + */ + public void setRootCause (Throwable e) + { + rootException = e; + } + + /** + * Gets the part of the name that could be resolved before this exception + * happend. Returns the <code>resolvedName</code> field of this Exception. + */ + public Name getResolvedName () + { + return resolvedName; + } + + /** + * Sets the part of the name that could be resolved before this exception + * happend. Sets the <code>resolvedName</code> field of this Exception. + */ + public void setResolvedName (Name name) + { + resolvedName = name; + } + + /** + * Gets the Object to which (part of) the name could be resolved before this + * exception happend. Returns the <code>resolvedObj</code> field of this + * Exception. + */ + public Object getResolvedObj () + { + return resolvedObj; + } + + /** + * Sets the Object to which (part of) the name could be resolved before this + * exception happend. Sets the <code>resolvedObj</code> field of this + * Exception. + */ + public void setResolvedObj (Object o) + { + resolvedObj = o; + } + + /** + * Gets the part of the name that could not be resolved before this exception + * happend. Returns the <code>remainingName</code> field of this Exception. + */ + public Name getRemainingName () + { + return remainingName; + } + + /** + * Sets the part of the name that could be resolved before this exception + * happend. Sets the <code>resolvedName</code> field of this Exception. + * The field can be extended by calling <code>appendRemainingName()</code> + * or <code>appendRemainingComponent()</code>. + */ + public void setRemainingName (Name name) + { + remainingName = name; + } + + /** + * Adds the given <code>Name</code> to the <code>remainingName</code> field. + * Does nothing when <code>name</code> is null or when a + * <code>InvalidNameException</code> is thrown when adding the name. + * + * @see Name#addAll(Name) + */ + public void appendRemainingName (Name name) + { + if (name != null) + try + { + remainingName.addAll(name); + } + catch(InvalidNameException ine) { /* ignored */ } + } + + /** + * Adds the given <code>String</code> to the <code>remainingName</code> field. + * Does nothing when <code>name</code> is null or when a + * <code>InvalidNameException</code> is thrown when adding the component. + * + * @see Name#add(String) + */ + public void appendRemainingComponent (String name) + { + if (name != null) + try + { + remainingName.add(name); + } + catch(InvalidNameException ine) { /* ignored */ } + } + + /** + * Gets the message given to the constructor or null if no message was given. + * + * @see Throwable#getMessage(); + */ + public String getExplanation() + { + return getMessage(); + } + + /** + * Returns a String representation of this exception and possibly including + * the part object that could be resolved if the given flag is set to true. + * Always includes the root cause and the remaining name if not null. + */ + public String toString(boolean objectInfo) + { + StringBuffer sb = new StringBuffer(super.toString()); + Throwable cause = getRootCause(); + if (cause != null) + { + sb.append(" caused by "); + sb.append(cause); + } + Name remaining = getRemainingName(); + if (remaining != null) + { + sb.append(" [remainingName: "); + sb.append(remaining); + } + Object resolved = getResolvedObj(); + if (objectInfo && resolved != null) + { + if (remainingName == null) + sb.append(" ["); + else + sb.append(", "); + sb.append("resolvedObj: "); + sb.append(resolved); + } + if ((remaining != null) || (objectInfo && resolved != null)) + sb.append(']'); + + return sb.toString(); + } + + /** + * Returns a string representation of this exception. + * Calls <code>toString(false)</code>. + */ + public String toString() + { + return toString(false); + } + /** + * Prints the stacktrace of this exception or of the root cause if not null. + */ + public void printStackTrace() + { + Throwable cause = getRootCause(); + if (cause != null) + cause.printStackTrace(); + else + super.printStackTrace(); + } + + /** + * Prints the stacktrace of this exception or of the root cause if not null + * to the given <code>PrintStream</code>. + */ + public void printStackTrace(PrintStream ps) + { + Throwable cause = getRootCause(); + if (cause != null) + cause.printStackTrace(ps); + else + super.printStackTrace(ps); + } + + /** + * Prints the stacktrace of this exception or of the root cause if not null + * to the given <code>PrintWriter</code>. + */ + public void printStackTrace(PrintWriter pw) + { + Throwable cause = getRootCause(); + if (cause != null) + cause.printStackTrace(pw); + else + super.printStackTrace(pw); + } +} + diff --git a/libjava/classpath/javax/naming/NamingSecurityException.java b/libjava/classpath/javax/naming/NamingSecurityException.java new file mode 100644 index 0000000..ae7f5ed --- /dev/null +++ b/libjava/classpath/javax/naming/NamingSecurityException.java @@ -0,0 +1,55 @@ +/* NamingSecurityException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public abstract class NamingSecurityException extends NamingException +{ + private static final long serialVersionUID = 5855287647294685775L; + + public NamingSecurityException () + { + super (); + } + + public NamingSecurityException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/NoInitialContextException.java b/libjava/classpath/javax/naming/NoInitialContextException.java new file mode 100644 index 0000000..d12dfcb --- /dev/null +++ b/libjava/classpath/javax/naming/NoInitialContextException.java @@ -0,0 +1,53 @@ +/* NoInitialContextException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class NoInitialContextException extends NamingException +{ + public NoInitialContextException() + { + super(); + } + + public NoInitialContextException(String msg) + { + super(msg); + } +} diff --git a/libjava/classpath/javax/naming/NoPermissionException.java b/libjava/classpath/javax/naming/NoPermissionException.java new file mode 100644 index 0000000..ddc4393 --- /dev/null +++ b/libjava/classpath/javax/naming/NoPermissionException.java @@ -0,0 +1,53 @@ +/* NoPermissionException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class NoPermissionException extends NamingSecurityException +{ + public NoPermissionException () + { + super (); + } + + public NoPermissionException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/NotContextException.java b/libjava/classpath/javax/naming/NotContextException.java new file mode 100644 index 0000000..b3d02cf --- /dev/null +++ b/libjava/classpath/javax/naming/NotContextException.java @@ -0,0 +1,53 @@ +/* NotContextException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class NotContextException extends NamingException +{ + public NotContextException () + { + super (); + } + + public NotContextException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/OperationNotSupportedException.java b/libjava/classpath/javax/naming/OperationNotSupportedException.java new file mode 100644 index 0000000..a4a4945 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +public class OperationNotSupportedException extends NamingException +{ + public OperationNotSupportedException() + { + super(); + } + + public OperationNotSupportedException(String msg) + { + super(msg); + } +} diff --git a/libjava/classpath/javax/naming/PartialResultException.java b/libjava/classpath/javax/naming/PartialResultException.java new file mode 100644 index 0000000..32f389d --- /dev/null +++ b/libjava/classpath/javax/naming/PartialResultException.java @@ -0,0 +1,53 @@ +/* PartialResultException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class PartialResultException extends NamingException +{ + public PartialResultException () + { + super (); + } + + public PartialResultException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/RefAddr.java b/libjava/classpath/javax/naming/RefAddr.java new file mode 100644 index 0000000..f345c88 --- /dev/null +++ b/libjava/classpath/javax/naming/RefAddr.java @@ -0,0 +1,142 @@ +/* RefAddr.java -- Abstract superclass of addresses used in References + 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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming; + +import java.io.Serializable; + +/** + * Abstract superclass of addresses used in References. + * A <code>Reference</code> object contains a <code>Vector</code> of + * <code>RefAddr</code>s which are used to reference/address the object. + * This abstract superclass keeps track of the type of address, which will be + * returned by <code>getType()</code>. And defines a abstract method + * <code>getContent()</code> which must be implemented in concrete subclasses + * such as <code>BinaryRefAddr</code> and <code>StringRefAddr</code>. + * + * @see Reference + * @see BinaryRefAddr + * @see StringRefAddr + * @since 1.3 + * @author Anthony Green (green@redhat.com) + * @author Mark Wielaard (mark@klomp.org) + */ +public abstract class RefAddr implements Serializable +{ + /** + * The string resprenstation of the type of address. + * Set by the constructor and returned by the getType() method. + */ + protected String addrType; + + /** + * Protected constructor for use by subclasses. + * Sets the addrType field of this object to the supplied String. + * + * @exception NullPointerException if the supplied String is null. + */ + protected RefAddr(String addrType) + { + if (addrType == null) + throw new NullPointerException("addrType cannot be null"); + + this.addrType = addrType; + } + + /** + * Returns the non-null address type given to the constructor. + */ + public String getType() + { + return addrType; + } + + /** + * Returns the possibly null content of this RefAddr. + * The actual value is defined by the non-abstract subclass. + */ + public abstract Object getContent(); + + /** + * Checks if the object is a RefAddr with the same type and content. + * + * @return true if the given object is an instance of RefAddr, the addrType + * is the same as this addrType and the content is equals to the + * content of this object. + */ + public boolean equals(Object o) + { + if (o instanceof RefAddr) + { + RefAddr refAddr = (RefAddr) o; + if (this.getType().equals(refAddr.getType())) + { + Object c1 = this.getContent(); + Object c2 = refAddr.getContent(); + if (c1 == null) + return c2 == null; + else + return c1.equals(c2); + } + } + return false; + } + + /** + * Returns the hashCode which is the hasCode of the String returned by + * <code>getType()</code> plus the hashCode of the Object returned by + * <code>getContent</code> (when not null). + */ + public int hashCode() + { + int result = getType().hashCode(); + Object o = getContent(); + if (o != null) + result += o.hashCode(); + + return result; + } + + /** + * Returns a String representation of the RefAddr. + * Should only be used for debugging purposes. + */ + public String toString() + { + return "[RefAddr type: " + getType() + " content: " + getContent() + ']'; + } +} diff --git a/libjava/classpath/javax/naming/Reference.java b/libjava/classpath/javax/naming/Reference.java new file mode 100644 index 0000000..6cc4d15 --- /dev/null +++ b/libjava/classpath/javax/naming/Reference.java @@ -0,0 +1,194 @@ +/* Reference.java -- + Copyright (C) 2000, 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import 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/libjava/classpath/javax/naming/Referenceable.java b/libjava/classpath/javax/naming/Referenceable.java new file mode 100644 index 0000000..cf1100a --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +public interface Referenceable +{ + Reference getReference() throws NamingException; +} diff --git a/libjava/classpath/javax/naming/ReferralException.java b/libjava/classpath/javax/naming/ReferralException.java new file mode 100644 index 0000000..ec2178e --- /dev/null +++ b/libjava/classpath/javax/naming/ReferralException.java @@ -0,0 +1,68 @@ +/* ReferralException.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + +import java.util.Hashtable; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 14, 2001 + */ + +public abstract class ReferralException extends NamingException +{ + private static final long serialVersionUID = -2881363844695698876L; + + 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/libjava/classpath/javax/naming/ServiceUnavailableException.java b/libjava/classpath/javax/naming/ServiceUnavailableException.java new file mode 100644 index 0000000..678eb13 --- /dev/null +++ b/libjava/classpath/javax/naming/ServiceUnavailableException.java @@ -0,0 +1,53 @@ +/* ServiceUnavailableException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class ServiceUnavailableException extends NamingException +{ + public ServiceUnavailableException () + { + super (); + } + + public ServiceUnavailableException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/SizeLimitExceededException.java b/libjava/classpath/javax/naming/SizeLimitExceededException.java new file mode 100644 index 0000000..e23f4d2 --- /dev/null +++ b/libjava/classpath/javax/naming/SizeLimitExceededException.java @@ -0,0 +1,53 @@ +/* SizeLimitExceededException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class SizeLimitExceededException extends LimitExceededException +{ + public SizeLimitExceededException () + { + super (); + } + + public SizeLimitExceededException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/StringRefAddr.java b/libjava/classpath/javax/naming/StringRefAddr.java new file mode 100644 index 0000000..f40da8f --- /dev/null +++ b/libjava/classpath/javax/naming/StringRefAddr.java @@ -0,0 +1,75 @@ +/* StringRefAddr.java -- RefAddr that uses a String as content. + 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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming; + +/** + * RefAddr that uses a String as content. + * This can for example be used to address things through URLs. + * + * @see Reference + * @since 1.3 + * @author Anthony Green (green@redhat.com) + * @author Mark Wielaard (mark@klomp.org) + */ +public class StringRefAddr extends RefAddr +{ + private static final long serialVersionUID = -8913762495138505527L; + + /** + * The possibly null content of this RefAddr. + * Set by the constructor and returned by getContent. + */ + private final String contents; + + /** + * Contructs a new StringRefAddr with the given type and content. + */ + public StringRefAddr (String addrType, String contents) + { + super(addrType); + this.contents = contents; + } + + /** + * Returns the String contents as given to the constructor. + */ + public Object getContent () + { + return contents; + } +} diff --git a/libjava/classpath/javax/naming/TimeLimitExceededException.java b/libjava/classpath/javax/naming/TimeLimitExceededException.java new file mode 100644 index 0000000..f4be675 --- /dev/null +++ b/libjava/classpath/javax/naming/TimeLimitExceededException.java @@ -0,0 +1,53 @@ +/* TimeLimitExceededException.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming; + + +public class TimeLimitExceededException extends LimitExceededException +{ + public TimeLimitExceededException () + { + super (); + } + + public TimeLimitExceededException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/Attribute.java b/libjava/classpath/javax/naming/directory/Attribute.java new file mode 100644 index 0000000..59bf66d --- /dev/null +++ b/libjava/classpath/javax/naming/directory/Attribute.java @@ -0,0 +1,70 @@ +/* Attribute.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import java.io.Serializable; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 14, 2001 + */ +public interface Attribute extends Cloneable, Serializable +{ + long serialVersionUID = 8707690322213556804L; + + NamingEnumeration getAll() throws NamingException; + Object get() throws NamingException; + int size(); + String getID(); + boolean contains(Object attrVal); + boolean add(Object attrVal); + boolean remove(Object attrval); + void clear(); + DirContext getAttributeSyntaxDefinition() throws NamingException; + DirContext getAttributeDefinition() throws NamingException; + Object clone(); + boolean isOrdered(); + Object get(int ix) throws NamingException; + Object remove(int ix); + void add(int ix, Object attrVal); + Object set(int ix, Object attrVal); +} diff --git a/libjava/classpath/javax/naming/directory/AttributeInUseException.java b/libjava/classpath/javax/naming/directory/AttributeInUseException.java new file mode 100644 index 0000000..4661424 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class AttributeInUseException extends NamingException +{ + public AttributeInUseException () + { + super (); + } + + public AttributeInUseException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/AttributeModificationException.java b/libjava/classpath/javax/naming/directory/AttributeModificationException.java new file mode 100644 index 0000000..4ef6fc2 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/AttributeModificationException.java @@ -0,0 +1,77 @@ +/* AttributeModificationException.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.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/libjava/classpath/javax/naming/directory/Attributes.java b/libjava/classpath/javax/naming/directory/Attributes.java new file mode 100644 index 0000000..3d5ef9f --- /dev/null +++ b/libjava/classpath/javax/naming/directory/Attributes.java @@ -0,0 +1,62 @@ +/* Attributes.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import java.io.Serializable; + +import javax.naming.NamingEnumeration; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 14, 2001 + */ + +public interface Attributes extends Cloneable, Serializable +{ + boolean isCaseIgnored(); + int size(); + Attribute get(String attrID); + NamingEnumeration getAll(); + NamingEnumeration getIDs(); + Attribute put(String attrID, Object val); + Attribute put(Attribute attr); + Attribute remove(String attrID); + Object clone(); +} + diff --git a/libjava/classpath/javax/naming/directory/BasicAttribute.java b/libjava/classpath/javax/naming/directory/BasicAttribute.java new file mode 100644 index 0000000..0470365 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/BasicAttribute.java @@ -0,0 +1,337 @@ +/* BasicAttribute.java -- + Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import java.util.NoSuchElementException; +import java.util.Vector; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.OperationNotSupportedException; + +/** + * @author Tom Tromey (tromey@redhat.com) + * @date June 20, 2001 + */ +public class BasicAttribute implements Attribute +{ + private static final long serialVersionUID = 6743528196119291326L; + + /** 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 () + throws NamingException + { + if (values.size () == 0) + throw new NoSuchElementException ("no values"); + return get (0); + } + + public Object get (int index) + throws NamingException + { + return values.get (index); + } + + public NamingEnumeration getAll () + throws NamingException + { + 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/libjava/classpath/javax/naming/directory/BasicAttributes.java b/libjava/classpath/javax/naming/directory/BasicAttributes.java new file mode 100644 index 0000000..37ec195 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/BasicAttributes.java @@ -0,0 +1,238 @@ +/* BasicAttributes.java -- + Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import java.util.NoSuchElementException; +import java.util.Vector; + +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +/** + * @author Tom Tromey (tromey@redhat.com) + * @date June 22, 2001 + */ +public class BasicAttributes implements Attributes +{ + private static final long serialVersionUID = 4980164073184639448L; + + 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; + } + + /** + * Returns true if and only if the given Object is an instance of + * Attributes, the given attributes both do or don't ignore case for + * IDs and the collection of attributes is the same. + */ + public boolean equals (Object obj) + { + if (! (obj instanceof Attributes)) + return false; + + Attributes bs = (Attributes) obj; + if (ignoreCase != bs.isCaseIgnored() + || attributes.size () != bs.size ()) + return false; + + NamingEnumeration bas = bs.getAll(); + while (bas.hasMoreElements()) + { + Attribute a = (Attribute) bas.nextElement(); + Attribute b = get(a.getID ()); + if (! a.equals(b)) + 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; + // Package-private to avoid a trampoline. + transient Vector attributes; + + // Used when enumerating. + private class BasicAttributesEnumeration implements NamingEnumeration + { + int where = 0; + 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 >= attributes.size ()) + throw new NoSuchElementException ("no more elements"); + Attribute at = (Attribute) attributes.get (where); + ++where; + return id ? (Object) at.getID () : (Object) at; + } + } +} diff --git a/libjava/classpath/javax/naming/directory/DirContext.java b/libjava/classpath/javax/naming/directory/DirContext.java new file mode 100644 index 0000000..002cb78 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/DirContext.java @@ -0,0 +1,83 @@ +/* DirContext.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 13, 2001 + */ + +public interface DirContext extends Context +{ + int ADD_ATTRIBUTE = 1; + int REPLACE_ATTRIBUTE = 2; + int REMOVE_ATTRIBUTE = 3; + + Attributes getAttributes (String name) throws NamingException; + Attributes getAttributes (String name, String[] attrIds) throws NamingException; + Attributes getAttributes (Name name) throws NamingException; + Attributes getAttributes(Name name, String[] attrIds) throws NamingException; + void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException; + void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException; + void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException; + void modifyAttributes(String name, ModificationItem[] mods) throws NamingException; + void bind(Name name, Object obj, Attributes attrs) throws NamingException; + void bind(String name, Object obj, Attributes attrs) throws NamingException; + void rebind(Name name, Object obj, Attributes attrs) throws NamingException; + void rebind(String name, Object obj, Attributes attrs) throws NamingException; + DirContext createSubcontext(Name name, Attributes attrs) throws NamingException; + DirContext createSubcontext(String name, Attributes attrs) throws NamingException; + DirContext getSchema(Name name) throws NamingException; + DirContext getSchema(String name) throws NamingException; + DirContext getSchemaClassDefinition(Name name) throws NamingException; + DirContext getSchemaClassDefinition(String name) throws NamingException; + NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException; + NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException; + NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException; + NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException; + NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException; + NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException; + NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException; + NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException; +} diff --git a/libjava/classpath/javax/naming/directory/InitialDirContext.java b/libjava/classpath/javax/naming/directory/InitialDirContext.java new file mode 100644 index 0000000..c946f41 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/InitialDirContext.java @@ -0,0 +1,265 @@ +/* InitialDirContext.java -- + Copyright (C) 2000, 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.InitialContext; +import javax.naming.Name; +import javax.naming.NamingEnumeration; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; + +/** + * @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/libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java b/libjava/classpath/javax/naming/directory/InvalidAttributeIdentifierException.java new file mode 100644 index 0000000..af1a8c7 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class InvalidAttributeIdentifierException extends NamingException +{ + public InvalidAttributeIdentifierException () + { + super (); + } + + public InvalidAttributeIdentifierException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java b/libjava/classpath/javax/naming/directory/InvalidAttributeValueException.java new file mode 100644 index 0000000..b667fa9 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class InvalidAttributeValueException extends NamingException +{ + public InvalidAttributeValueException () + { + super (); + } + + public InvalidAttributeValueException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/InvalidAttributesException.java b/libjava/classpath/javax/naming/directory/InvalidAttributesException.java new file mode 100644 index 0000000..ad7f7c1 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class InvalidAttributesException extends NamingException +{ + public InvalidAttributesException () + { + super (); + } + + public InvalidAttributesException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java b/libjava/classpath/javax/naming/directory/InvalidSearchControlsException.java new file mode 100644 index 0000000..594e5d1 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class InvalidSearchControlsException extends NamingException +{ + public InvalidSearchControlsException () + { + super (); + } + + public InvalidSearchControlsException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java b/libjava/classpath/javax/naming/directory/InvalidSearchFilterException.java new file mode 100644 index 0000000..127b381 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class InvalidSearchFilterException extends NamingException +{ + public InvalidSearchFilterException () + { + super (); + } + + public InvalidSearchFilterException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/ModificationItem.java b/libjava/classpath/javax/naming/directory/ModificationItem.java new file mode 100644 index 0000000..f0a69f5 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/ModificationItem.java @@ -0,0 +1,80 @@ +/* ModificationItem.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.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/libjava/classpath/javax/naming/directory/NoSuchAttributeException.java b/libjava/classpath/javax/naming/directory/NoSuchAttributeException.java new file mode 100644 index 0000000..cff9f95 --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class NoSuchAttributeException extends NamingException +{ + public NoSuchAttributeException () + { + super (); + } + + public NoSuchAttributeException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/SchemaViolationException.java b/libjava/classpath/javax/naming/directory/SchemaViolationException.java new file mode 100644 index 0000000..a11e50f --- /dev/null +++ b/libjava/classpath/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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.NamingException; + +public class SchemaViolationException extends NamingException +{ + public SchemaViolationException () + { + super (); + } + + public SchemaViolationException (String msg) + { + super (msg); + } +} diff --git a/libjava/classpath/javax/naming/directory/SearchControls.java b/libjava/classpath/javax/naming/directory/SearchControls.java new file mode 100644 index 0000000..4cc789d --- /dev/null +++ b/libjava/classpath/javax/naming/directory/SearchControls.java @@ -0,0 +1,137 @@ +/* SearchControls.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import java.io.Serializable; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 5, 2001 + */ + +public class SearchControls 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/libjava/classpath/javax/naming/directory/SearchResult.java b/libjava/classpath/javax/naming/directory/SearchResult.java new file mode 100644 index 0000000..a6d5490 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/SearchResult.java @@ -0,0 +1,94 @@ +/* SearchResult.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.directory; + +import javax.naming.Binding; + +/** + * @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/libjava/classpath/javax/naming/directory/package.html b/libjava/classpath/javax/naming/directory/package.html new file mode 100644 index 0000000..6286dd2 --- /dev/null +++ b/libjava/classpath/javax/naming/directory/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.naming.directory package. + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.naming.directory</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/javax/naming/event/EventContext.java b/libjava/classpath/javax/naming/event/EventContext.java new file mode 100644 index 0000000..32629c0 --- /dev/null +++ b/libjava/classpath/javax/naming/event/EventContext.java @@ -0,0 +1,65 @@ +/* EventContext.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.event; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface EventContext extends Context +{ + int OBJECT_SCOPE = 0; + int ONELEVEL_SCOPE = 1; + int SUBTREE_SCOPE = 2; + + void addNamingListener (Name target, int scope, NamingListener l) + throws NamingException; + + void addNamingListener (String target, int scope, NamingListener l) + throws NamingException; + + void removeNamingListener (NamingListener l) throws NamingException; + + boolean targetMustExist() throws NamingException; +} diff --git a/libjava/classpath/javax/naming/event/EventDirContext.java b/libjava/classpath/javax/naming/event/EventDirContext.java new file mode 100644 index 0000000..d2883ae --- /dev/null +++ b/libjava/classpath/javax/naming/event/EventDirContext.java @@ -0,0 +1,65 @@ +/* EventDirContext.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.naming.event; + +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.DirContext; +import javax.naming.directory.SearchControls; + + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ +public interface EventDirContext extends EventContext, DirContext +{ + void addNamingListener(Name target, String filter, SearchControls ctls, + NamingListener l) throws NamingException; + + void addNamingListener(String target, String filter, SearchControls ctls, + NamingListener l) throws NamingException; + + void addNamingListener(Name target, String filter, Object[] filterArgs, + SearchControls ctls, NamingListener l) + throws NamingException; + + void addNamingListener(String target, String filter, Object[] filterArgs, + SearchControls ctls, NamingListener l) + throws NamingException; +} diff --git a/libjava/classpath/javax/naming/event/NamespaceChangeListener.java b/libjava/classpath/javax/naming/event/NamespaceChangeListener.java new file mode 100644 index 0000000..464b718 --- /dev/null +++ b/libjava/classpath/javax/naming/event/NamespaceChangeListener.java @@ -0,0 +1,51 @@ +/* NamespaceChangeListener.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.event; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface NamespaceChangeListener extends NamingListener +{ + void objectAdded(NamingEvent evt); + void objectRemoved(NamingEvent evt); + void objectRenamed(NamingEvent evt); +} diff --git a/libjava/classpath/javax/naming/event/NamingEvent.java b/libjava/classpath/javax/naming/event/NamingEvent.java new file mode 100644 index 0000000..a121b8e --- /dev/null +++ b/libjava/classpath/javax/naming/event/NamingEvent.java @@ -0,0 +1,120 @@ +/* NamingEvent.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.event; + +import java.util.EventObject; + +import javax.naming.Binding; + +/** + * @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/libjava/classpath/javax/naming/event/NamingExceptionEvent.java b/libjava/classpath/javax/naming/event/NamingExceptionEvent.java new file mode 100644 index 0000000..07896d4 --- /dev/null +++ b/libjava/classpath/javax/naming/event/NamingExceptionEvent.java @@ -0,0 +1,75 @@ +/* NamingExceptionEvent.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.event; + +import java.util.EventObject; + +import javax.naming.NamingException; + +/** + * @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/libjava/classpath/javax/naming/event/NamingListener.java b/libjava/classpath/javax/naming/event/NamingListener.java new file mode 100644 index 0000000..4f313a3 --- /dev/null +++ b/libjava/classpath/javax/naming/event/NamingListener.java @@ -0,0 +1,51 @@ +/* NamingListener.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.event; + +import java.util.EventListener; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface NamingListener extends EventListener +{ + void namingExceptionThrown(NamingExceptionEvent evt); +} diff --git a/libjava/classpath/javax/naming/event/ObjectChangeListener.java b/libjava/classpath/javax/naming/event/ObjectChangeListener.java new file mode 100644 index 0000000..00e8c4c --- /dev/null +++ b/libjava/classpath/javax/naming/event/ObjectChangeListener.java @@ -0,0 +1,49 @@ +/* ObjectChangeListener.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.event; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface ObjectChangeListener extends NamingListener +{ + void objectChanged(NamingEvent evt); +} diff --git a/libjava/classpath/javax/naming/event/package.html b/libjava/classpath/javax/naming/event/package.html new file mode 100644 index 0000000..a5d620e --- /dev/null +++ b/libjava/classpath/javax/naming/event/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.naming.event package. + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.naming.event</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/javax/naming/ldap/Control.java b/libjava/classpath/javax/naming/ldap/Control.java new file mode 100644 index 0000000..9f6409b --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/Control.java @@ -0,0 +1,56 @@ +/* Control.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.io.Serializable; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface Control extends Serializable +{ + boolean CRITICAL = true; + boolean NONCRITICAL = false; + + String getID(); + boolean isCritical(); + byte[] getEncodedValue(); +} diff --git a/libjava/classpath/javax/naming/ldap/ControlFactory.java b/libjava/classpath/javax/naming/ldap/ControlFactory.java new file mode 100644 index 0000000..f72e67a --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/ControlFactory.java @@ -0,0 +1,107 @@ +/* ControlFactory.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.util.Hashtable; +import java.util.StringTokenizer; + +import javax.naming.Context; +import javax.naming.NamingException; + +/** + * @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/libjava/classpath/javax/naming/ldap/ExtendedRequest.java b/libjava/classpath/javax/naming/ldap/ExtendedRequest.java new file mode 100644 index 0000000..e6379c0 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/ExtendedRequest.java @@ -0,0 +1,57 @@ +/* ExtendedRequest.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.io.Serializable; + +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ +public interface ExtendedRequest extends Serializable +{ + String getID(); + byte[] getEncodedValue(); + ExtendedResponse createExtendedResponse(String id, + byte[] berValue, int offset, + int length) + throws NamingException; +} diff --git a/libjava/classpath/javax/naming/ldap/ExtendedResponse.java b/libjava/classpath/javax/naming/ldap/ExtendedResponse.java new file mode 100644 index 0000000..a3b6dd1 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/ExtendedResponse.java @@ -0,0 +1,52 @@ +/* ExtendedResponse.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.io.Serializable; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface ExtendedResponse extends Serializable +{ + String getID(); + byte[] getEncodedValue(); +} diff --git a/libjava/classpath/javax/naming/ldap/HasControls.java b/libjava/classpath/javax/naming/ldap/HasControls.java new file mode 100644 index 0000000..a169896 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/HasControls.java @@ -0,0 +1,51 @@ +/* HasControls.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface HasControls +{ + Control[] getControls() throws NamingException; +} diff --git a/libjava/classpath/javax/naming/ldap/InitialLdapContext.java b/libjava/classpath/javax/naming/ldap/InitialLdapContext.java new file mode 100644 index 0000000..45a9eae --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/InitialLdapContext.java @@ -0,0 +1,133 @@ +/* InitialLdapContext.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.NotContextException; +import javax.naming.directory.InitialDirContext; + +/** + * @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/libjava/classpath/javax/naming/ldap/LdapContext.java b/libjava/classpath/javax/naming/ldap/LdapContext.java new file mode 100644 index 0000000..10b72f7 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/LdapContext.java @@ -0,0 +1,63 @@ +/* LdapContext.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import javax.naming.NamingException; +import javax.naming.directory.DirContext; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface LdapContext extends DirContext +{ + String CONTROL_FACTORIES = "java.naming.factory.control"; + + ExtendedResponse extendedOperation(ExtendedRequest request) + throws NamingException; + LdapContext newInstance(Control[] requestControls) + throws NamingException; + void reconnect(Control[] connCtls) throws NamingException; + Control[] getConnectControls() throws NamingException; + void setRequestControls(Control[] requestControls) + throws NamingException; + Control[] getRequestControls() throws NamingException; + Control[] getResponseControls() throws NamingException; +} diff --git a/libjava/classpath/javax/naming/ldap/LdapReferralException.java b/libjava/classpath/javax/naming/ldap/LdapReferralException.java new file mode 100644 index 0000000..61a2b8e --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/LdapReferralException.java @@ -0,0 +1,68 @@ +/* LdapReferralException.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.NamingException; +import javax.naming.ReferralException; + +/** + * @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/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java b/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java new file mode 100644 index 0000000..0b6f9d7 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/UnsolicitedNotification.java @@ -0,0 +1,52 @@ +/* UnsolicitedNotification.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface UnsolicitedNotification extends ExtendedResponse, HasControls +{ + String[] getReferrals(); + NamingException getException(); +} diff --git a/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java b/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java new file mode 100644 index 0000000..f9946064 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationEvent.java @@ -0,0 +1,70 @@ +/* UnsolicitedNotificationEvent.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import java.util.EventObject; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 5, 2001 + */ +public class UnsolicitedNotificationEvent extends EventObject +{ + private static final long serialVersionUID = -2382603380799883705L; + + // 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/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java b/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java new file mode 100644 index 0000000..fd56f05 --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/UnsolicitedNotificationListener.java @@ -0,0 +1,51 @@ +/* UnsolicitedNotificationListener.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.ldap; + +import javax.naming.event.NamingListener; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface UnsolicitedNotificationListener extends NamingListener +{ + void notificationReceived(UnsolicitedNotificationEvent evt); +} diff --git a/libjava/classpath/javax/naming/ldap/package.html b/libjava/classpath/javax/naming/ldap/package.html new file mode 100644 index 0000000..0a4e45e --- /dev/null +++ b/libjava/classpath/javax/naming/ldap/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.naming.ldap package. + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.naming.ldap</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/javax/naming/package.html b/libjava/classpath/javax/naming/package.html new file mode 100644 index 0000000..0794d3d --- /dev/null +++ b/libjava/classpath/javax/naming/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.naming package. + Copyright (C) 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., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.naming</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/libjava/classpath/javax/naming/spi/DirObjectFactory.java b/libjava/classpath/javax/naming/spi/DirObjectFactory.java new file mode 100644 index 0000000..ea0e697 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/DirObjectFactory.java @@ -0,0 +1,56 @@ +/* DirObjectFactory.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.directory.Attributes; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ +public interface DirObjectFactory extends ObjectFactory +{ + Object getObjectInstance(Object obj, Name name, Context nameCtx, + Hashtable environment, Attributes attrs) + throws Exception; +} diff --git a/libjava/classpath/javax/naming/spi/DirStateFactory.java b/libjava/classpath/javax/naming/spi/DirStateFactory.java new file mode 100644 index 0000000..b5add91 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/DirStateFactory.java @@ -0,0 +1,83 @@ +/* DirStateFactory.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.directory.Attributes; + +/** + * @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; + } + } + + DirStateFactory.Result getStateToBind(Object obj, Name name, + Context nameCtx, + Hashtable environment, + Attributes inAttrs) + throws NamingException; +} diff --git a/libjava/classpath/javax/naming/spi/DirectoryManager.java b/libjava/classpath/javax/naming/spi/DirectoryManager.java new file mode 100644 index 0000000..fd482ef --- /dev/null +++ b/libjava/classpath/javax/naming/spi/DirectoryManager.java @@ -0,0 +1,243 @@ +/* DirectoryManager.java -- + Copyright (C) 2000, 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.StringTokenizer; + +import javax.naming.CannotProceedException; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.RefAddr; +import javax.naming.Reference; +import javax.naming.Referenceable; +import javax.naming.StringRefAddr; +import javax.naming.directory.Attributes; +import javax.naming.directory.DirContext; + +/** + * @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/libjava/classpath/javax/naming/spi/InitialContextFactory.java b/libjava/classpath/javax/naming/spi/InitialContextFactory.java new file mode 100644 index 0000000..7bfcf09 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/InitialContextFactory.java @@ -0,0 +1,49 @@ +/* InitialContextFactory.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.NamingException; + +public interface InitialContextFactory +{ + Context getInitialContext (Hashtable environment) throws NamingException; +} diff --git a/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java b/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java new file mode 100644 index 0000000..76564ab --- /dev/null +++ b/libjava/classpath/javax/naming/spi/InitialContextFactoryBuilder.java @@ -0,0 +1,49 @@ +/* InitialContextFactoryBuilder.java -- + Copyright (C) 2000, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.NamingException; + +public interface InitialContextFactoryBuilder +{ + InitialContextFactory createInitialContextFactory (Hashtable environment) + throws NamingException; +} diff --git a/libjava/classpath/javax/naming/spi/NamingManager.java b/libjava/classpath/javax/naming/spi/NamingManager.java new file mode 100644 index 0000000..cfc9dbd --- /dev/null +++ b/libjava/classpath/javax/naming/spi/NamingManager.java @@ -0,0 +1,398 @@ +/* NamingManager.java -- + Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Enumeration; +import java.util.Hashtable; +import java.util.StringTokenizer; + +import javax.naming.CannotProceedException; +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; +import javax.naming.NoInitialContextException; +import javax.naming.RefAddr; +import javax.naming.Reference; +import javax.naming.Referenceable; +import javax.naming.StringRefAddr; + +public class NamingManager +{ + public static final String CPE = "java.naming.spi.CannotProceedException"; + + private static InitialContextFactoryBuilder icfb; + + // Package private so DirectoryManager can access it. + static ObjectFactoryBuilder ofb; + + // 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, true, + Thread.currentThread().getContextClassLoader()) + .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 = scheme + "." + scheme + "URLContextFactory"; + + StringTokenizer tokens = new StringTokenizer (prefixes, ":"); + while (tokens.hasMoreTokens ()) + { + String aTry = tokens.nextToken (); + try + { + Class factoryClass = Class.forName (aTry + "." + scheme, + true, + Thread.currentThread().getContextClassLoader()); + 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, + true, + Thread.currentThread().getContextClassLoader()); + 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, + true, + Thread.currentThread().getContextClassLoader()); + 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 (cpe.getResolvedObj(), + cpe.getAltName (), + cpe.getAltNameCtx (), + env); + if (obj != null) + return (Context) obj; + } + catch (Exception _) + { + } + + // fix stack trace for re-thrown exception (message confusing otherwise) + cpe.fillInStackTrace(); + + 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, + true, + Thread.currentThread().getContextClassLoader()); + 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/libjava/classpath/javax/naming/spi/ObjectFactory.java b/libjava/classpath/javax/naming/spi/ObjectFactory.java new file mode 100644 index 0000000..81648d9 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/ObjectFactory.java @@ -0,0 +1,51 @@ +/* ObjectFactory.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; + +public interface ObjectFactory +{ + Object getObjectInstance (Object obj, Name name, Context nameCtx, + Hashtable environment) + throws Exception; +} diff --git a/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java b/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java new file mode 100644 index 0000000..a761393 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/ObjectFactoryBuilder.java @@ -0,0 +1,54 @@ +/* ObjectFactoryBuilder.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ +public interface ObjectFactoryBuilder +{ + ObjectFactory createObjectFactory(Object obj, + Hashtable environment) + throws NamingException; +} diff --git a/libjava/classpath/javax/naming/spi/ResolveResult.java b/libjava/classpath/javax/naming/spi/ResolveResult.java new file mode 100644 index 0000000..72a101e --- /dev/null +++ b/libjava/classpath/javax/naming/spi/ResolveResult.java @@ -0,0 +1,126 @@ +/* ResolveResult.java -- + Copyright (C) 2001, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.io.Serializable; + +import javax.naming.CompositeName; +import javax.naming.InvalidNameException; +import javax.naming.Name; + +/** + * @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/libjava/classpath/javax/naming/spi/Resolver.java b/libjava/classpath/javax/naming/spi/Resolver.java new file mode 100644 index 0000000..d80fb61 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/Resolver.java @@ -0,0 +1,55 @@ +/* Resolver.java -- + Copyright (C) 2001, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import javax.naming.Name; +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ + +public interface Resolver +{ + ResolveResult resolveToClass(Name name, Class contextType) + throws NamingException; + ResolveResult resolveToClass(String name, Class contextType) + throws NamingException; +} diff --git a/libjava/classpath/javax/naming/spi/StateFactory.java b/libjava/classpath/javax/naming/spi/StateFactory.java new file mode 100644 index 0000000..1fbdeb1 --- /dev/null +++ b/libjava/classpath/javax/naming/spi/StateFactory.java @@ -0,0 +1,55 @@ +/* StateFactory.java -- + Copyright (C) 2001, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.naming.spi; + +import java.util.Hashtable; + +import javax.naming.Context; +import javax.naming.Name; +import javax.naming.NamingException; + +/** + * @author Warren Levy (warrenl@redhat.com) + * @date June 1, 2001 + */ +public interface StateFactory +{ + Object getStateToBind(Object obj, Name name, Context nameCtx, + Hashtable environment) throws NamingException; +} diff --git a/libjava/classpath/javax/naming/spi/package.html b/libjava/classpath/javax/naming/spi/package.html new file mode 100644 index 0000000..b55e97a --- /dev/null +++ b/libjava/classpath/javax/naming/spi/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.naming.spi package. + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.naming.spi</title></head> + +<body> +<p></p> + +</body> +</html> |