From ff1b2fa686af641d4d25f1e8ed0f99566ee7991b Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Fri, 19 Oct 2001 17:49:52 +0000 Subject: * configure.in (AC_OUTPUT): removed gnu/classpath/tools/Makefile, added javax/naming/Makefile, javax/naming/directory/Makefile and javax/naming/spi/Makefile * gnu/java/text/Makefile.in: removed * javax/Makefile.am (SUBDIRS): add naming * javax/naming/.cvsignore: new file * javax/naming/BinaryRefAddr.java: ditto * javax/naming/InvalidNameException.java: ditto * javax/naming/Makefile.am: ditto * javax/naming/Name.java: ditto * javax/naming/NamingException.java: ditto * javax/naming/RefAddr.java: ditto * javax/naming/StringRefAddr.java: ditto * javax/naming/directory/.cvsignore: ditto * javax/naming/directory/Makefile.am: ditto * javax/naming/spi/.cvsignore: ditto * javax/naming/spi/Makefile.am: ditto * lib/.cvsignore: add javax * lib/gen-classlist.sh.in: ditto * lib/standard.omit: removed java/net, java/lang, java/text and java/util/jar classes, added javax/accessibility and javax/swing --- ChangeLog | 24 +++ configure.in | 4 +- gnu/java/text/Makefile.in | 227 ------------------------ javax/Makefile.am | 3 + javax/naming/.cvsignore | 2 + javax/naming/BinaryRefAddr.java | 144 ++++++++++++++++ javax/naming/InvalidNameException.java | 55 ++++++ javax/naming/Makefile.am | 11 ++ javax/naming/Name.java | 185 ++++++++++++++++++++ javax/naming/NamingException.java | 303 +++++++++++++++++++++++++++++++++ javax/naming/RefAddr.java | 131 ++++++++++++++ javax/naming/StringRefAddr.java | 63 +++++++ javax/naming/directory/.cvsignore | 2 + javax/naming/directory/Makefile.am | 2 + javax/naming/spi/.cvsignore | 2 + javax/naming/spi/Makefile.am | 2 + lib/.cvsignore | 1 + lib/gen-classlist.sh.in | 2 +- lib/standard.omit | 11 +- 19 files changed, 936 insertions(+), 238 deletions(-) delete mode 100644 gnu/java/text/Makefile.in create mode 100644 javax/naming/.cvsignore create mode 100644 javax/naming/BinaryRefAddr.java create mode 100644 javax/naming/InvalidNameException.java create mode 100644 javax/naming/Makefile.am create mode 100644 javax/naming/Name.java create mode 100644 javax/naming/NamingException.java create mode 100644 javax/naming/RefAddr.java create mode 100644 javax/naming/StringRefAddr.java create mode 100644 javax/naming/directory/.cvsignore create mode 100644 javax/naming/directory/Makefile.am create mode 100644 javax/naming/spi/.cvsignore create mode 100644 javax/naming/spi/Makefile.am diff --git a/ChangeLog b/ChangeLog index 3fcf0d7e7..aa53048f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,27 @@ +2001-10-19 Mark Wielaard + + * configure.in (AC_OUTPUT): removed gnu/classpath/tools/Makefile, + added javax/naming/Makefile, javax/naming/directory/Makefile and + javax/naming/spi/Makefile + * gnu/java/text/Makefile.in: removed + * javax/Makefile.am (SUBDIRS): add naming + * javax/naming/.cvsignore: new file + * javax/naming/BinaryRefAddr.java: ditto + * javax/naming/InvalidNameException.java: ditto + * javax/naming/Makefile.am: ditto + * javax/naming/Name.java: ditto + * javax/naming/NamingException.java: ditto + * javax/naming/RefAddr.java: ditto + * javax/naming/StringRefAddr.java: ditto + * javax/naming/directory/.cvsignore: ditto + * javax/naming/directory/Makefile.am: ditto + * javax/naming/spi/.cvsignore: ditto + * javax/naming/spi/Makefile.am: ditto + * lib/.cvsignore: add javax + * lib/gen-classlist.sh.in: ditto + * lib/standard.omit: removed java/net, java/lang, java/text and + java/util/jar classes, added javax/accessibility and javax/swing + 2001-10-19 Eric Blake * java/util/IdentityHashMap.java: Improve javadoc, fix member diff --git a/configure.in b/configure.in index 6131b176c..90ac06cbc 100644 --- a/configure.in +++ b/configure.in @@ -316,7 +316,6 @@ doc/Makefile gnu/Makefile gnu/classpath/Makefile gnu/classpath/Configuration.java -gnu/classpath/tools/Makefile gnu/java/Makefile gnu/java/awt/Makefile gnu/java/awt/image/Makefile @@ -382,6 +381,9 @@ java/util/jar/Makefile java/util/prefs/Makefile java/util/zip/Makefile javax/Makefile +javax/naming/Makefile +javax/naming/directory/Makefile +javax/naming/spi/Makefile native/Makefile native/jni/Makefile native/jni/awt/Makefile diff --git a/gnu/java/text/Makefile.in b/gnu/java/text/Makefile.in deleted file mode 100644 index 061bb32c6..000000000 --- a/gnu/java/text/Makefile.in +++ /dev/null @@ -1,227 +0,0 @@ -# Makefile.in generated automatically by automake 1.4 from Makefile.am - -# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -DESTDIR = - -pkgdatadir = $(datadir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ - -top_builddir = ../../.. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -transform = @program_transform_name@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ -AS = @AS@ -AWK = @AWK@ -CC = @CC@ -CPP = @CPP@ -DEVEL = @DEVEL@ -DLLTOOL = @DLLTOOL@ -EXTRA_INCLUDES = @EXTRA_INCLUDES@ -FIND = @FIND@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_CONFIG = @GLIB_CONFIG@ -GLIB_LIBS = @GLIB_LIBS@ -GTK_CFLAGS = @GTK_CFLAGS@ -GTK_CONFIG = @GTK_CONFIG@ -GTK_LIBS = @GTK_LIBS@ -INIT_LOAD_LIBRARY = @INIT_LOAD_LIBRARY@ -JAPHAR_CFLAGS = @JAPHAR_CFLAGS@ -JAPHAR_CLASSLIB = @JAPHAR_CLASSLIB@ -JAPHAR_CONFIG = @JAPHAR_CONFIG@ -JAPHAR_JABBA = @JAPHAR_JABBA@ -JAPHAR_JAVAC = @JAPHAR_JAVAC@ -JAPHAR_JAVAH = @JAPHAR_JAVAH@ -JAPHAR_LIBS = @JAPHAR_LIBS@ -JAPHAR_PREFIX = @JAPHAR_PREFIX@ -JIKES = @JIKES@ -JVM = @JVM@ -JVM_REFERENCE = @JVM_REFERENCE@ -KAFFE_CFLAGS = @KAFFE_CFLAGS@ -KAFFE_CLASSLIB = @KAFFE_CLASSLIB@ -KAFFE_CONFIG = @KAFFE_CONFIG@ -KAFFE_JABBA = @KAFFE_JABBA@ -KAFFE_JAVAH = @KAFFE_JAVAH@ -KAFFE_LIBS = @KAFFE_LIBS@ -KAFFE_PREFIX = @KAFFE_PREFIX@ -KJC_CLASSPATH = @KJC_CLASSPATH@ -LIBART_CFLAGS = @LIBART_CFLAGS@ -LIBART_CONFIG = @LIBART_CONFIG@ -LIBART_LIBS = @LIBART_LIBS@ -LIBDEBUG = @LIBDEBUG@ -LIBTOOL = @LIBTOOL@ -LIBVERSION = @LIBVERSION@ -LN_S = @LN_S@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -OBJDUMP = @OBJDUMP@ -PACKAGE = @PACKAGE@ -PERL = @PERL@ -RANLIB = @RANLIB@ -REMOVE = @REMOVE@ -SH = @SH@ -USER_CLASSLIB = @USER_CLASSLIB@ -USER_JABBA = @USER_JABBA@ -USER_JAVAH = @USER_JAVAH@ -VERSION = @VERSION@ -ZIP = @ZIP@ -prefix = @prefix@ - -EXTRA_DIST = BaseBreakIterator.java CharacterBreakIterator.java LineBreakIterator.java SentenceBreakIterator.java WordBreakIterator.java - -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = ../../../include/config.h -CONFIG_CLEAN_FILES = -DIST_COMMON = Makefile.am Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) - -TAR = gtar -GZIP_ENV = --best -all: all-redirect -.SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) - cd $(top_srcdir) && $(AUTOMAKE) --gnu gnu/java/text/Makefile - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -tags: TAGS -TAGS: - - -distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) - -subdir = gnu/java/text - -distdir: $(DISTFILES) - here=`cd $(top_builddir) && pwd`; \ - top_distdir=`cd $(top_distdir) && pwd`; \ - distdir=`cd $(distdir) && pwd`; \ - cd $(top_srcdir) \ - && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu gnu/java/text/Makefile - @for file in $(DISTFILES); do \ - d=$(srcdir); \ - if test -d $$d/$$file; then \ - cp -pr $$d/$$file $(distdir)/$$file; \ - else \ - test -f $(distdir)/$$file \ - || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ - || cp -p $$d/$$file $(distdir)/$$file || :; \ - fi; \ - done -info-am: -info: info-am -dvi-am: -dvi: dvi-am -check-am: all-am -check: check-am -installcheck-am: -installcheck: installcheck-am -install-exec-am: -install-exec: install-exec-am - -install-data-am: -install-data: install-data-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am -install: install-am -uninstall-am: -uninstall: uninstall-am -all-am: Makefile -all-redirect: all-am -install-strip: - $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install -installdirs: - - -mostlyclean-generic: - -clean-generic: - -distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) - -rm -f config.cache config.log stamp-h stamp-h[0-9]* - -maintainer-clean-generic: -mostlyclean-am: mostlyclean-generic - -mostlyclean: mostlyclean-am - -clean-am: clean-generic mostlyclean-am - -clean: clean-am - -distclean-am: distclean-generic clean-am - -rm -f libtool - -distclean: distclean-am - -maintainer-clean-am: maintainer-clean-generic distclean-am - @echo "This command is intended for maintainers to use;" - @echo "it deletes files that may require special tools to rebuild." - -maintainer-clean: maintainer-clean-am - -.PHONY: tags distdir info-am info dvi-am dvi check check-am \ -installcheck-am installcheck install-exec-am install-exec \ -install-data-am install-data install-am install uninstall-am uninstall \ -all-redirect all-am all installdirs mostlyclean-generic \ -distclean-generic clean-generic maintainer-clean-generic clean \ -mostlyclean distclean maintainer-clean - - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/javax/Makefile.am b/javax/Makefile.am index e69de29bb..2ffefe474 100644 --- a/javax/Makefile.am +++ b/javax/Makefile.am @@ -0,0 +1,3 @@ +## Input file for automake to generate the Makefile.in used by configure + +SUBDIRS = naming diff --git a/javax/naming/.cvsignore b/javax/naming/.cvsignore new file mode 100644 index 000000000..3dda72986 --- /dev/null +++ b/javax/naming/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/javax/naming/BinaryRefAddr.java b/javax/naming/BinaryRefAddr.java new file mode 100644 index 000000000..f44e43fd0 --- /dev/null +++ b/javax/naming/BinaryRefAddr.java @@ -0,0 +1,144 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. */ + +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 +{ + + /** + * 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 equal(Object o) + { + if (o instanceof BinaryRefAddr) + { + BinaryRefAddr refAddr = (BinaryRefAddr) o; + if (this.getType().equals(refAddr.getType())) + { + byte[] c1 = (byte[]) this.getContent(); + byte[] c2 = (byte[]) refAddr.getContent(); + return Arrays.equals(c1, c2); + } + } + return false; + } + + /** + * Returns the hashCode which is the hasCode of the String returned by + * getType() plus the hashCode of the byte array returned by + * getContent. The hashCode of the byte array is calculated + * by taking the xor of all the bytes in the array, or zero when there are + * no bytes in the array. + */ + public int hashCode() + { + int result = 0; + byte[] b = (byte[]) getContent(); + for (int i=0; i < b.length; i++) + result = result^b[i]; + + return getType().hashCode() + result; + } + + private static char[] hex = {'0', '1', '2', '3', '4', '5', '6', '7', + '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + /** + * Returns a String representation of the RefAddr. Only the first 32 bytes + * of the content are added as hex encoded characters. + * Should only be used for debugging purposes. + */ + public String toString() + { + 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/javax/naming/InvalidNameException.java b/javax/naming/InvalidNameException.java new file mode 100644 index 000000000..cedce55e1 --- /dev/null +++ b/javax/naming/InvalidNameException.java @@ -0,0 +1,55 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. */ + +package javax.naming; + +/** + * Exception indicating an invalid component or Name. + * Thrown when a Name or component of a name is encountered that + * does not follow the syntactic rules of a particular Name 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/javax/naming/Makefile.am b/javax/naming/Makefile.am new file mode 100644 index 000000000..097974a79 --- /dev/null +++ b/javax/naming/Makefile.am @@ -0,0 +1,11 @@ +## input for automake + +SUBDIRS = directory spi + +EXTRA_DIST = \ +BinaryRefAddr.java \ +InvalidNameException.java \ +Name.java \ +NamingException.java \ +RefAddr.java \ +StringRefAddr.java diff --git a/javax/naming/Name.java b/javax/naming/Name.java new file mode 100644 index 000000000..1f13e3ce3 --- /dev/null +++ b/javax/naming/Name.java @@ -0,0 +1,185 @@ +/* Name.java -- Name build up from different components + Copyright (C) 2000, 2001 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. */ + +package javax.naming; + +import java.util.Enumeration; +import java.io.Serializable; + +/** + * Interface descriping a name build up from different components. + * The components are represented as Strings 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 Strings or + * Names and a component can be removed from any position in the + * Name. + * A Name can be compared to another Name and it can + * be checked if a particular Name starts or ends with the same + * components as another Name. Finally Names can be + * serialized and cloned. + *

+ * Since Names can be empty (have no components) methods that + * return a Name will never return null. + * + * @since 1.3 + * @author Anthony Green (green@redhat.com) + * @author Mark Wielaard (mark@klomp.org) + */ +public interface Name extends Cloneable, Serializable +{ + /** + * Returns the number of components of this Name. + * The returned number can be zero. + */ + public int size(); + + /** + * Returns true if the number of components of this + * Name is zero, false otherwise. + */ + public boolean isEmpty(); + + /** + * Returns a non-null (but possibly empty) Enumeration of the + * components of the Name as Strings. + */ + public 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 size(). + */ + public String get(int i); + + /** + * Returns the components till the given index as a Name. + * The returned Name can be modified without changing the + * original. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to size(). + */ + public Name getPrefix(int i); + + /** + * Returns the components from the given index till the end as a + * Name. + * The returned Name can be modified without changing the + * original. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to size(). + */ + public Name getSuffix(int i); + + /** + * Adds the given String component to the end of this + * Name. The method modifies the current Name and + * then returns it. + * + * @exception InvalidNameException if the given String is not a + * valid component for this Name. + */ + public Name add(String comp) throws InvalidNameException; + + /** + * Inserts the given String component to this Name + * at the given index. The method modifies the current Name and + * then returns it. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to size(). + * @exception InvalidNameException if the given String is not a + * valid component for this Name. + */ + public Name add(int posn, String comp) throws InvalidNameException; + + /** + * Adds all the components of the given Name to the end of this + * Name. The method modifies the current Name and + * then returns it. + * + * @exception InvalidNameException if any of the given components is not a + * valid component for this Name. + */ + public Name addAll(Name suffix) throws InvalidNameException; + + /** + * Inserts all the components of the given Name to this + * Name at the given index. The method modifies the current + * Name and then returns it. + * + * @exception ArrayIndexOutOfBoundsException if the given index is smaller + * then zero or greater then or equal to size(). + * @exception InvalidNameException if any of the given components is not a + * valid component for this Name. + */ + public Name addAll(int posn, Name n) throws InvalidNameException; + + /** + * Removes the component at the given index from this Name. + * The method modifies the current Name and then returns it. + * + * @exception InvalidNameException if the given String is not a + * valid component for this Name. + */ + public Object remove(int posn) throws InvalidNameException; + + /** + * Returns true if this Name starts with the + * components of the given Name, false otherwise. + */ + public boolean startsWith(Name name); + + /** + * Returns true if this Name ends with the + * components of the given Name, false otherwise. + */ + public boolean endsWith(Name name); + + /** + * Compares the given object to this Name. + * Returns a negative value if the given Object is smaller then + * this Name, a positive value if the Object is + * bigger, and zero if the are equal. If the Object is not of + * a class that can be compared to the class of this Name then + * a ClassCastException is thrown. Note that it is not + * guaranteed that Names implemented in different classes can + * be compared. The definition of smaller, bigger and equal is up to the + * actual implementing class. + */ + public int compareTo(Object obj); + + /** + * Returns a clone of this Name. It will be a deep copy of + * all the components of the Name so that changes to components + * of the components does not change the component in this Name. + */ + public Object clone(); +} diff --git a/javax/naming/NamingException.java b/javax/naming/NamingException.java new file mode 100644 index 000000000..b214f19f5 --- /dev/null +++ b/javax/naming/NamingException.java @@ -0,0 +1,303 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. */ + +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 + * NamingException), the part of the Name that + * could be resolved (including the Object it resolved to) + * and the part of the Name 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 +{ + + /** + * The root cause of this exception. Might be null. Set by calling + * setRootCause(), can be accessed by calling + * getRootCause(). + */ + protected Throwable rootException; + + /** + * If the exception was caused while resolving a Name then + * this field contains that part of the name that could be resolved. + * Field might be null. Set by calling setResolvedName(). + * Can be accessed by calling getResolvedName. + */ + protected Name resolvedName; + + /** + * If the exception was caused while resolving a Name then + * this field contains the object that part of the name could be resolved to. + * Field might be null. Set by calling setResolvedObj(). + * Can be accessed by calling getResolvedObj. + */ + protected Object resolvedObj; + + /** + * If the exception was caused while resolving a Name then + * this field contains that part of the name that could not be resolved. + * Field might be null. Set by calling setRemainingName(). + * The field can be extended by calling appendRemainingName() + * or appendRemainingComponent(). + * Can be accessed by calling getRemainingName. + */ + protected Name remainingName; + + /** + * Creates a new NamingException without a message. Does not set any of the + * rootException, resolvedName, + * resolvedObj or remainingObject, fields. + * These fields can be set later. + */ + public NamingException () + { + super(); + } + + /** + * Creates a new NamingException with a detailed message. Does not set + * the rootException, resolvedName, + * resolvedObj or remainingObject, fields. + * These fields can be set later. + */ + public NamingException (String msg) + { + super(msg); + } + + /** + * Gets the root cause field rootException of this Exception. + */ + public Throwable getRootCause () + { + return rootException; + } + + /** + * Sets the root cause field rootException 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 resolvedName 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 resolvedName 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 resolvedObj 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 resolvedObj 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 remainingName 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 resolvedName field of this Exception. + * The field can be extended by calling appendRemainingName() + * or appendRemainingComponent(). + */ + public void setRemainingName (Name name) + { + remainingName = name; + } + + /** + * Adds the given Name to the remainingName field. + * Does nothing when name is null or when a + * InvalidNameException 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 String to the remainingName field. + * Does nothing when name is null or when a + * InvalidNameException 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 toString(false). + */ + 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 PrintStream. + */ + 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 PrintWriter. + */ + public void printStackTrace(PrintWriter pw) + { + Throwable cause = getRootCause(); + if (cause != null) + cause.printStackTrace(pw); + else + super.printStackTrace(pw); + } +} + diff --git a/javax/naming/RefAddr.java b/javax/naming/RefAddr.java new file mode 100644 index 000000000..4c1659cbc --- /dev/null +++ b/javax/naming/RefAddr.java @@ -0,0 +1,131 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. */ + +package javax.naming; + +import java.io.Serializable; + +/** + * Abstract superclass of addresses used in References. + * A Reference object contains a Vector of + * RefAddrs which are used to reference/address the object. + * This abstract superclass keeps track of the type of address, which will be + * returned by getType(). And defines a abstract method + * getContent() which must be implemented in concrete subclasses + * such as BinaryRefAddr and StringRefAddr. + * + * @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 final 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 equal(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 + * getType() plus the hashCode of the Object returned by + * getContent (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/javax/naming/StringRefAddr.java b/javax/naming/StringRefAddr.java new file mode 100644 index 000000000..b813be720 --- /dev/null +++ b/javax/naming/StringRefAddr.java @@ -0,0 +1,63 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +As a special exception, if you link this library with other files to +produce an executable, this library does not by itself cause the +resulting executable to be covered by the GNU General Public License. +This exception does not however invalidate any other reasons why the +executable file might be covered by the GNU General Public License. */ + +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 +{ + + /** + * 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/javax/naming/directory/.cvsignore b/javax/naming/directory/.cvsignore new file mode 100644 index 000000000..3dda72986 --- /dev/null +++ b/javax/naming/directory/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/javax/naming/directory/Makefile.am b/javax/naming/directory/Makefile.am new file mode 100644 index 000000000..978e3deb9 --- /dev/null +++ b/javax/naming/directory/Makefile.am @@ -0,0 +1,2 @@ +## input for automake + diff --git a/javax/naming/spi/.cvsignore b/javax/naming/spi/.cvsignore new file mode 100644 index 000000000..3dda72986 --- /dev/null +++ b/javax/naming/spi/.cvsignore @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff --git a/javax/naming/spi/Makefile.am b/javax/naming/spi/Makefile.am new file mode 100644 index 000000000..978e3deb9 --- /dev/null +++ b/javax/naming/spi/Makefile.am @@ -0,0 +1,2 @@ +## input for automake + diff --git a/lib/.cvsignore b/lib/.cvsignore index 3420f39bd..418a1aea6 100644 --- a/lib/.cvsignore +++ b/lib/.cvsignore @@ -2,6 +2,7 @@ Makefile Makefile.in gnu java +javax kaffe classes glibj.zip diff --git a/lib/gen-classlist.sh.in b/lib/gen-classlist.sh.in index 572290190..cd9b4f5ae 100755 --- a/lib/gen-classlist.sh.in +++ b/lib/gen-classlist.sh.in @@ -1,4 +1,4 @@ #! @SH@ # @configure_input@ -@FIND@ @top_srcdir@/java @top_srcdir@/gnu ${top_builddir}/java ${top_builddir}/gnu ${top_builddir}/vm/current -follow -type f -print | grep '\.java$' > ${top_builddir}/lib/classes +@FIND@ @top_srcdir@/java @top_srcdir@/javax @top_srcdir@/gnu ${top_builddir}/java ${top_builddir}/javax ${top_builddir}/gnu ${top_builddir}/vm/current -follow -type f -print | grep '\.java$' > ${top_builddir}/lib/classes for filexp in `cat @top_srcdir@/lib/$1.omit` ; do { grep -v ${filexp} < ${top_builddir}/lib/classes > ${top_builddir}/lib/classes.new ; mv ${top_builddir}/lib/classes.new ${top_builddir}/lib/classes ; } ; done diff --git a/lib/standard.omit b/lib/standard.omit index 4e3bf27b9..e9814df11 100644 --- a/lib/standard.omit +++ b/lib/standard.omit @@ -1,8 +1,3 @@ -../java/net/Authenticator.java$ -../java/net/JarURLConnection.java$ -../java/net/URLClassLoader.java$ -../java/lang/RuntimePermission.java$ -../java/text/MessageFormat.java$ ../gnu/test/.*$ ../gnu/java/awt/peer/gtk/TestAWT.java$ ../gnu/java/awt/peer/gtk/Test.java$ @@ -15,10 +10,8 @@ ../java/awt/event/InputMethodEvent.java$ ../java/awt/event/InputMethodListener.java$ ../java/awt/event/InvocationEvent.java$ -../java/util/jar/JarEntry.java$ -../java/util/jar/JarFile.java$ -../java/util/jar/JarInputStream.java$ -../java/util/jar/JarOutputStream.java$ ../java/util/prefs/.*$ ../gnu/java/util/prefs/.*$ ../gnu/classpath/tools/.*$ +../javax/accessibility/.*$ +../javax/swing/.*$ -- cgit v1.2.1