diff options
author | Michael Koch <mkoch@gcc.gnu.org> | 2005-02-19 18:47:29 +0000 |
---|---|---|
committer | Michael Koch <mkoch@gcc.gnu.org> | 2005-02-19 18:47:29 +0000 |
commit | 6ca84a804a7378e79bbb1d5a6d646ead7e6cfa46 (patch) | |
tree | 55ebacd491a20d362082021ef37660e30d015575 /libjava | |
parent | 2cdc207340d10fdbf643ae6b83cb289af1ba32d6 (diff) | |
download | gcc-6ca84a804a7378e79bbb1d5a6d646ead7e6cfa46.zip gcc-6ca84a804a7378e79bbb1d5a6d646ead7e6cfa46.tar.gz gcc-6ca84a804a7378e79bbb1d5a6d646ead7e6cfa46.tar.bz2 |
[multiple changes]
2005-02-19 Michael Koch <konqueror@gmx.de>
* Makefile.am: Added new files in gnu/java/beans and
java/beans/XMLDecoder.java.
* Makefile.in: Regenerated.
2005-02-19 Robert Schuster <thebohemian@gmx.net>
* gnu/java/beans/decoder/GrowableArrayContext.java: Fixed
assignment behavior by using java.lang.reflect.Array.set()
directly.
2005-02-19 Dalibor Topic <robilad@kaffe.org>
* gnu/java/beans/EmptyBeanInfo.java,
gnu/java/beans/info/ComponentBeanInfo.java:
Removed unused files.
2005-02-19 Robert Schuster <thebohemian@gmx.net>
* gnu/java/beans/DummyAppletStub.java: Add dummy implementation
of AppletStub for java.beans.Beans.instantiate.
* gnu/java/beans/DummyAppletContext.java: Add dummy implementation
of AppletContext.
* java/beans/Beans: Added 1.4 functionality, fixed user documentation
to be conformant with Javadoc guidelines.
(instantiate): Added two more overloaded variants, reworked user
documentation, fixed exception behavior, fixed behavior when
deserializing null.
2005-02-19 Mark Wielaard <mark@klomp.org>
* gnu/java/beans/decoder/DummyHandler.java: Add return statements for
failing methods.
* gnu/java/beans/decoder/DummyContext.java: Likewise.
2005-02-19 Robert Schuster <theBohemian@gmx.net>
* gnu/java/beans/decoder/AbstractContext.java,
gnu/java/beans/decoder/AbstractCreatableContext.java,
gnu/java/beans/decoder/AbstractElementHandler.java,
gnu/java/beans/decoder/AbstractObjectContext.java,
gnu/java/beans/decoder/ArrayContext.java,
gnu/java/beans/decoder/ArrayHandler.java,
gnu/java/beans/decoder/AssemblyException.java,
gnu/java/beans/decoder/BooleanHandler.java,
gnu/java/beans/decoder/ByteHandler.java,
gnu/java/beans/decoder/CharHandler.java,
gnu/java/beans/decoder/ClassHandler.java,
gnu/java/beans/decoder/ConstructorContext.java,
gnu/java/beans/decoder/Context.java,
gnu/java/beans/decoder/DecoderContext.java,
gnu/java/beans/decoder/DefaultExceptionListener.java,
gnu/java/beans/decoder/DoubleHandler.java,
gnu/java/beans/decoder/DummyContext.java,
gnu/java/beans/decoder/DummyHandler.java,
gnu/java/beans/decoder/ElementHandler.java,
gnu/java/beans/decoder/FloatHandler.java,
gnu/java/beans/decoder/GrowableArrayContext.java,
gnu/java/beans/decoder/IndexContext.java,
gnu/java/beans/decoder/IntHandler.java,
gnu/java/beans/decoder/JavaHandler.java,
gnu/java/beans/decoder/LongHandler.java,
gnu/java/beans/decoder/MethodContext.java,
gnu/java/beans/decoder/MethodFinder.java,
gnu/java/beans/decoder/NullHandler.java,
gnu/java/beans/decoder/ObjectContext.java,
gnu/java/beans/decoder/ObjectHandler.java,
gnu/java/beans/decoder/PersistenceParser.java,
gnu/java/beans/decoder/PropertyContext.java,
gnu/java/beans/decoder/ShortHandler.java,
gnu/java/beans/decoder/SimpleHandler.java,
gnu/java/beans/decoder/StaticMethodContext.java,
gnu/java/beans/decoder/StringHandler.java,
gnu/java/beans/decoder/VoidHandler.java: New class
implementing java.beans.XMLDecoder decoding functionality.
* java/beans/XMLDecoder.java: New class.
From-SVN: r95287
Diffstat (limited to 'libjava')
44 files changed, 5611 insertions, 282 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 2b9d160..dbd10f5 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,83 @@ 2005-02-19 Michael Koch <konqueror@gmx.de> + * Makefile.am: Added new files in gnu/java/beans and + java/beans/XMLDecoder.java. + * Makefile.in: Regenerated. + +2005-02-19 Robert Schuster <thebohemian@gmx.net> + + * gnu/java/beans/decoder/GrowableArrayContext.java: Fixed + assignment behavior by using java.lang.reflect.Array.set() + directly. + +2005-02-19 Dalibor Topic <robilad@kaffe.org> + + * gnu/java/beans/EmptyBeanInfo.java, + gnu/java/beans/info/ComponentBeanInfo.java: + Removed unused files. + +2005-02-19 Robert Schuster <thebohemian@gmx.net> + + * gnu/java/beans/DummyAppletStub.java: Add dummy implementation + of AppletStub for java.beans.Beans.instantiate. + * gnu/java/beans/DummyAppletContext.java: Add dummy implementation + of AppletContext. + * java/beans/Beans: Added 1.4 functionality, fixed user documentation + to be conformant with Javadoc guidelines. + (instantiate): Added two more overloaded variants, reworked user + documentation, fixed exception behavior, fixed behavior when + deserializing null. + +2005-02-19 Mark Wielaard <mark@klomp.org> + + * gnu/java/beans/decoder/DummyHandler.java: Add return statements for + failing methods. + * gnu/java/beans/decoder/DummyContext.java: Likewise. + +2005-02-19 Robert Schuster <theBohemian@gmx.net> + + * gnu/java/beans/decoder/AbstractContext.java, + gnu/java/beans/decoder/AbstractCreatableContext.java, + gnu/java/beans/decoder/AbstractElementHandler.java, + gnu/java/beans/decoder/AbstractObjectContext.java, + gnu/java/beans/decoder/ArrayContext.java, + gnu/java/beans/decoder/ArrayHandler.java, + gnu/java/beans/decoder/AssemblyException.java, + gnu/java/beans/decoder/BooleanHandler.java, + gnu/java/beans/decoder/ByteHandler.java, + gnu/java/beans/decoder/CharHandler.java, + gnu/java/beans/decoder/ClassHandler.java, + gnu/java/beans/decoder/ConstructorContext.java, + gnu/java/beans/decoder/Context.java, + gnu/java/beans/decoder/DecoderContext.java, + gnu/java/beans/decoder/DefaultExceptionListener.java, + gnu/java/beans/decoder/DoubleHandler.java, + gnu/java/beans/decoder/DummyContext.java, + gnu/java/beans/decoder/DummyHandler.java, + gnu/java/beans/decoder/ElementHandler.java, + gnu/java/beans/decoder/FloatHandler.java, + gnu/java/beans/decoder/GrowableArrayContext.java, + gnu/java/beans/decoder/IndexContext.java, + gnu/java/beans/decoder/IntHandler.java, + gnu/java/beans/decoder/JavaHandler.java, + gnu/java/beans/decoder/LongHandler.java, + gnu/java/beans/decoder/MethodContext.java, + gnu/java/beans/decoder/MethodFinder.java, + gnu/java/beans/decoder/NullHandler.java, + gnu/java/beans/decoder/ObjectContext.java, + gnu/java/beans/decoder/ObjectHandler.java, + gnu/java/beans/decoder/PersistenceParser.java, + gnu/java/beans/decoder/PropertyContext.java, + gnu/java/beans/decoder/ShortHandler.java, + gnu/java/beans/decoder/SimpleHandler.java, + gnu/java/beans/decoder/StaticMethodContext.java, + gnu/java/beans/decoder/StringHandler.java, + gnu/java/beans/decoder/VoidHandler.java: New class + implementing java.beans.XMLDecoder decoding functionality. + * java/beans/XMLDecoder.java: New class. + +2005-02-19 Michael Koch <konqueror@gmx.de> + * javax/swing/JTextField.java (notfiyAction): Added javadoc. diff --git a/libjava/Makefile.am b/libjava/Makefile.am index f686db7..bd8c4d1 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -1077,6 +1077,43 @@ gnu/java/awt/peer/EmbeddedWindowPeer.java \ gnu/java/awt/peer/GLightweightPeer.java \ gnu/java/awt/peer/ClasspathFontPeer.java \ gnu/java/awt/peer/ClasspathTextLayoutPeer.java \ +gnu/java/beans/decoder/AbstractContext.java \ +gnu/java/beans/decoder/AbstractCreatableObjectContext.java \ +gnu/java/beans/decoder/AbstractElementHandler.java \ +gnu/java/beans/decoder/AbstractObjectContext.java \ +gnu/java/beans/decoder/ArrayContext.java \ +gnu/java/beans/decoder/ArrayHandler.java \ +gnu/java/beans/decoder/AssemblyException.java \ +gnu/java/beans/decoder/BooleanHandler.java \ +gnu/java/beans/decoder/ByteHandler.java \ +gnu/java/beans/decoder/CharHandler.java \ +gnu/java/beans/decoder/ClassHandler.java \ +gnu/java/beans/decoder/ConstructorContext.java \ +gnu/java/beans/decoder/Context.java \ +gnu/java/beans/decoder/DecoderContext.java \ +gnu/java/beans/decoder/DefaultExceptionListener.java \ +gnu/java/beans/decoder/DoubleHandler.java \ +gnu/java/beans/decoder/DummyContext.java \ +gnu/java/beans/decoder/DummyHandler.java \ +gnu/java/beans/decoder/ElementHandler.java \ +gnu/java/beans/decoder/FloatHandler.java \ +gnu/java/beans/decoder/GrowableArrayContext.java \ +gnu/java/beans/decoder/IndexContext.java \ +gnu/java/beans/decoder/IntHandler.java \ +gnu/java/beans/decoder/JavaHandler.java \ +gnu/java/beans/decoder/LongHandler.java \ +gnu/java/beans/decoder/MethodContext.java \ +gnu/java/beans/decoder/MethodFinder.java \ +gnu/java/beans/decoder/NullHandler.java \ +gnu/java/beans/decoder/ObjectContext.java \ +gnu/java/beans/decoder/ObjectHandler.java \ +gnu/java/beans/decoder/PersistenceParser.java \ +gnu/java/beans/decoder/PropertyContext.java \ +gnu/java/beans/decoder/ShortHandler.java \ +gnu/java/beans/decoder/SimpleHandler.java \ +gnu/java/beans/decoder/StaticMethodContext.java \ +gnu/java/beans/decoder/StringHandler.java \ +gnu/java/beans/decoder/VoidHandler.java \ gnu/java/beans/editors/ColorEditor.java \ gnu/java/beans/editors/FontEditor.java \ gnu/java/beans/editors/NativeBooleanEditor.java \ @@ -1087,9 +1124,9 @@ gnu/java/beans/editors/NativeIntEditor.java \ gnu/java/beans/editors/NativeLongEditor.java \ gnu/java/beans/editors/NativeShortEditor.java \ gnu/java/beans/editors/StringEditor.java \ -gnu/java/beans/info/ComponentBeanInfo.java \ gnu/java/beans/BeanInfoEmbryo.java \ -gnu/java/beans/EmptyBeanInfo.java \ +gnu/java/beans/DummyAppletContext.java \ +gnu/java/beans/DummyAppletStub.java \ gnu/java/beans/ExplicitBeanInfo.java \ gnu/java/beans/IntrospectionIncubator.java \ java/applet/Applet.java \ @@ -1469,6 +1506,7 @@ java/beans/VetoableChangeListenerProxy.java \ java/beans/VetoableChangeSupport.java \ java/beans/Visibility.java \ java/beans/AppletInitializer.java \ +java/beans/XMLDecoder.java \ javax/swing/border/AbstractBorder.java \ javax/swing/border/BevelBorder.java \ javax/swing/border/Border.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index ed9942b..38d21a7 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -1312,6 +1312,43 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ gnu/java/awt/peer/GLightweightPeer.java \ gnu/java/awt/peer/ClasspathFontPeer.java \ gnu/java/awt/peer/ClasspathTextLayoutPeer.java \ + gnu/java/beans/decoder/AbstractContext.java \ + gnu/java/beans/decoder/AbstractCreatableObjectContext.java \ + gnu/java/beans/decoder/AbstractElementHandler.java \ + gnu/java/beans/decoder/AbstractObjectContext.java \ + gnu/java/beans/decoder/ArrayContext.java \ + gnu/java/beans/decoder/ArrayHandler.java \ + gnu/java/beans/decoder/AssemblyException.java \ + gnu/java/beans/decoder/BooleanHandler.java \ + gnu/java/beans/decoder/ByteHandler.java \ + gnu/java/beans/decoder/CharHandler.java \ + gnu/java/beans/decoder/ClassHandler.java \ + gnu/java/beans/decoder/ConstructorContext.java \ + gnu/java/beans/decoder/Context.java \ + gnu/java/beans/decoder/DecoderContext.java \ + gnu/java/beans/decoder/DefaultExceptionListener.java \ + gnu/java/beans/decoder/DoubleHandler.java \ + gnu/java/beans/decoder/DummyContext.java \ + gnu/java/beans/decoder/DummyHandler.java \ + gnu/java/beans/decoder/ElementHandler.java \ + gnu/java/beans/decoder/FloatHandler.java \ + gnu/java/beans/decoder/GrowableArrayContext.java \ + gnu/java/beans/decoder/IndexContext.java \ + gnu/java/beans/decoder/IntHandler.java \ + gnu/java/beans/decoder/JavaHandler.java \ + gnu/java/beans/decoder/LongHandler.java \ + gnu/java/beans/decoder/MethodContext.java \ + gnu/java/beans/decoder/MethodFinder.java \ + gnu/java/beans/decoder/NullHandler.java \ + gnu/java/beans/decoder/ObjectContext.java \ + gnu/java/beans/decoder/ObjectHandler.java \ + gnu/java/beans/decoder/PersistenceParser.java \ + gnu/java/beans/decoder/PropertyContext.java \ + gnu/java/beans/decoder/ShortHandler.java \ + gnu/java/beans/decoder/SimpleHandler.java \ + gnu/java/beans/decoder/StaticMethodContext.java \ + gnu/java/beans/decoder/StringHandler.java \ + gnu/java/beans/decoder/VoidHandler.java \ gnu/java/beans/editors/ColorEditor.java \ gnu/java/beans/editors/FontEditor.java \ gnu/java/beans/editors/NativeBooleanEditor.java \ @@ -1322,9 +1359,9 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ gnu/java/beans/editors/NativeLongEditor.java \ gnu/java/beans/editors/NativeShortEditor.java \ gnu/java/beans/editors/StringEditor.java \ - gnu/java/beans/info/ComponentBeanInfo.java \ gnu/java/beans/BeanInfoEmbryo.java \ - gnu/java/beans/EmptyBeanInfo.java \ + gnu/java/beans/DummyAppletContext.java \ + gnu/java/beans/DummyAppletStub.java \ gnu/java/beans/ExplicitBeanInfo.java \ gnu/java/beans/IntrospectionIncubator.java \ java/applet/Applet.java java/applet/AppletStub.java \ @@ -1622,6 +1659,7 @@ am__libgcj0_convenience_la_SOURCES_DIST = prims.cc jni.cc exception.cc \ java/beans/VetoableChangeListenerProxy.java \ java/beans/VetoableChangeSupport.java \ java/beans/Visibility.java java/beans/AppletInitializer.java \ + java/beans/XMLDecoder.java \ javax/swing/border/AbstractBorder.java \ javax/swing/border/BevelBorder.java \ javax/swing/border/Border.java \ @@ -2877,6 +2915,43 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \ gnu/java/awt/peer/GLightweightPeer.lo \ gnu/java/awt/peer/ClasspathFontPeer.lo \ gnu/java/awt/peer/ClasspathTextLayoutPeer.lo \ + gnu/java/beans/decoder/AbstractContext.lo \ + gnu/java/beans/decoder/AbstractCreatableObjectContext.lo \ + gnu/java/beans/decoder/AbstractElementHandler.lo \ + gnu/java/beans/decoder/AbstractObjectContext.lo \ + gnu/java/beans/decoder/ArrayContext.lo \ + gnu/java/beans/decoder/ArrayHandler.lo \ + gnu/java/beans/decoder/AssemblyException.lo \ + gnu/java/beans/decoder/BooleanHandler.lo \ + gnu/java/beans/decoder/ByteHandler.lo \ + gnu/java/beans/decoder/CharHandler.lo \ + gnu/java/beans/decoder/ClassHandler.lo \ + gnu/java/beans/decoder/ConstructorContext.lo \ + gnu/java/beans/decoder/Context.lo \ + gnu/java/beans/decoder/DecoderContext.lo \ + gnu/java/beans/decoder/DefaultExceptionListener.lo \ + gnu/java/beans/decoder/DoubleHandler.lo \ + gnu/java/beans/decoder/DummyContext.lo \ + gnu/java/beans/decoder/DummyHandler.lo \ + gnu/java/beans/decoder/ElementHandler.lo \ + gnu/java/beans/decoder/FloatHandler.lo \ + gnu/java/beans/decoder/GrowableArrayContext.lo \ + gnu/java/beans/decoder/IndexContext.lo \ + gnu/java/beans/decoder/IntHandler.lo \ + gnu/java/beans/decoder/JavaHandler.lo \ + gnu/java/beans/decoder/LongHandler.lo \ + gnu/java/beans/decoder/MethodContext.lo \ + gnu/java/beans/decoder/MethodFinder.lo \ + gnu/java/beans/decoder/NullHandler.lo \ + gnu/java/beans/decoder/ObjectContext.lo \ + gnu/java/beans/decoder/ObjectHandler.lo \ + gnu/java/beans/decoder/PersistenceParser.lo \ + gnu/java/beans/decoder/PropertyContext.lo \ + gnu/java/beans/decoder/ShortHandler.lo \ + gnu/java/beans/decoder/SimpleHandler.lo \ + gnu/java/beans/decoder/StaticMethodContext.lo \ + gnu/java/beans/decoder/StringHandler.lo \ + gnu/java/beans/decoder/VoidHandler.lo \ gnu/java/beans/editors/ColorEditor.lo \ gnu/java/beans/editors/FontEditor.lo \ gnu/java/beans/editors/NativeBooleanEditor.lo \ @@ -2887,9 +2962,9 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \ gnu/java/beans/editors/NativeLongEditor.lo \ gnu/java/beans/editors/NativeShortEditor.lo \ gnu/java/beans/editors/StringEditor.lo \ - gnu/java/beans/info/ComponentBeanInfo.lo \ gnu/java/beans/BeanInfoEmbryo.lo \ - gnu/java/beans/EmptyBeanInfo.lo \ + gnu/java/beans/DummyAppletContext.lo \ + gnu/java/beans/DummyAppletStub.lo \ gnu/java/beans/ExplicitBeanInfo.lo \ gnu/java/beans/IntrospectionIncubator.lo java/applet/Applet.lo \ java/applet/AppletStub.lo java/applet/AppletContext.lo \ @@ -3161,7 +3236,7 @@ am__objects_11 = gnu/awt/LightweightRedirector.lo \ java/beans/VetoableChangeListener.lo \ java/beans/VetoableChangeListenerProxy.lo \ java/beans/VetoableChangeSupport.lo java/beans/Visibility.lo \ - java/beans/AppletInitializer.lo \ + java/beans/AppletInitializer.lo java/beans/XMLDecoder.lo \ javax/swing/border/AbstractBorder.lo \ javax/swing/border/BevelBorder.lo javax/swing/border/Border.lo \ javax/swing/border/CompoundBorder.lo \ @@ -5402,6 +5477,43 @@ gnu/java/awt/peer/EmbeddedWindowPeer.java \ gnu/java/awt/peer/GLightweightPeer.java \ gnu/java/awt/peer/ClasspathFontPeer.java \ gnu/java/awt/peer/ClasspathTextLayoutPeer.java \ +gnu/java/beans/decoder/AbstractContext.java \ +gnu/java/beans/decoder/AbstractCreatableObjectContext.java \ +gnu/java/beans/decoder/AbstractElementHandler.java \ +gnu/java/beans/decoder/AbstractObjectContext.java \ +gnu/java/beans/decoder/ArrayContext.java \ +gnu/java/beans/decoder/ArrayHandler.java \ +gnu/java/beans/decoder/AssemblyException.java \ +gnu/java/beans/decoder/BooleanHandler.java \ +gnu/java/beans/decoder/ByteHandler.java \ +gnu/java/beans/decoder/CharHandler.java \ +gnu/java/beans/decoder/ClassHandler.java \ +gnu/java/beans/decoder/ConstructorContext.java \ +gnu/java/beans/decoder/Context.java \ +gnu/java/beans/decoder/DecoderContext.java \ +gnu/java/beans/decoder/DefaultExceptionListener.java \ +gnu/java/beans/decoder/DoubleHandler.java \ +gnu/java/beans/decoder/DummyContext.java \ +gnu/java/beans/decoder/DummyHandler.java \ +gnu/java/beans/decoder/ElementHandler.java \ +gnu/java/beans/decoder/FloatHandler.java \ +gnu/java/beans/decoder/GrowableArrayContext.java \ +gnu/java/beans/decoder/IndexContext.java \ +gnu/java/beans/decoder/IntHandler.java \ +gnu/java/beans/decoder/JavaHandler.java \ +gnu/java/beans/decoder/LongHandler.java \ +gnu/java/beans/decoder/MethodContext.java \ +gnu/java/beans/decoder/MethodFinder.java \ +gnu/java/beans/decoder/NullHandler.java \ +gnu/java/beans/decoder/ObjectContext.java \ +gnu/java/beans/decoder/ObjectHandler.java \ +gnu/java/beans/decoder/PersistenceParser.java \ +gnu/java/beans/decoder/PropertyContext.java \ +gnu/java/beans/decoder/ShortHandler.java \ +gnu/java/beans/decoder/SimpleHandler.java \ +gnu/java/beans/decoder/StaticMethodContext.java \ +gnu/java/beans/decoder/StringHandler.java \ +gnu/java/beans/decoder/VoidHandler.java \ gnu/java/beans/editors/ColorEditor.java \ gnu/java/beans/editors/FontEditor.java \ gnu/java/beans/editors/NativeBooleanEditor.java \ @@ -5412,9 +5524,9 @@ gnu/java/beans/editors/NativeIntEditor.java \ gnu/java/beans/editors/NativeLongEditor.java \ gnu/java/beans/editors/NativeShortEditor.java \ gnu/java/beans/editors/StringEditor.java \ -gnu/java/beans/info/ComponentBeanInfo.java \ gnu/java/beans/BeanInfoEmbryo.java \ -gnu/java/beans/EmptyBeanInfo.java \ +gnu/java/beans/DummyAppletContext.java \ +gnu/java/beans/DummyAppletStub.java \ gnu/java/beans/ExplicitBeanInfo.java \ gnu/java/beans/IntrospectionIncubator.java \ java/applet/Applet.java \ @@ -5794,6 +5906,7 @@ java/beans/VetoableChangeListenerProxy.java \ java/beans/VetoableChangeSupport.java \ java/beans/Visibility.java \ java/beans/AppletInitializer.java \ +java/beans/XMLDecoder.java \ javax/swing/border/AbstractBorder.java \ javax/swing/border/BevelBorder.java \ javax/swing/border/Border.java \ @@ -11950,6 +12063,123 @@ gnu/java/awt/peer/ClasspathFontPeer.lo: \ gnu/java/awt/peer/ClasspathTextLayoutPeer.lo: \ gnu/java/awt/peer/$(am__dirstamp) \ gnu/java/awt/peer/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/$(am__dirstamp): + @$(mkdir_p) gnu/java/beans/decoder + @: > gnu/java/beans/decoder/$(am__dirstamp) +gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp): + @$(mkdir_p) gnu/java/beans/decoder/$(DEPDIR) + @: > gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/AbstractContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/AbstractCreatableObjectContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/AbstractElementHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/AbstractObjectContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ArrayContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ArrayHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/AssemblyException.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/BooleanHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ByteHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/CharHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ClassHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ConstructorContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/Context.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/DecoderContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/DefaultExceptionListener.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/DoubleHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/DummyContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/DummyHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ElementHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/FloatHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/GrowableArrayContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/IndexContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/IntHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/JavaHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/LongHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/MethodContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/MethodFinder.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/NullHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ObjectContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ObjectHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/PersistenceParser.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/PropertyContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/ShortHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/SimpleHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/StaticMethodContext.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/StringHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/decoder/VoidHandler.lo: \ + gnu/java/beans/decoder/$(am__dirstamp) \ + gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) gnu/java/beans/editors/$(am__dirstamp): @$(mkdir_p) gnu/java/beans/editors @: > gnu/java/beans/editors/$(am__dirstamp) @@ -11986,15 +12216,6 @@ gnu/java/beans/editors/NativeShortEditor.lo: \ gnu/java/beans/editors/StringEditor.lo: \ gnu/java/beans/editors/$(am__dirstamp) \ gnu/java/beans/editors/$(DEPDIR)/$(am__dirstamp) -gnu/java/beans/info/$(am__dirstamp): - @$(mkdir_p) gnu/java/beans/info - @: > gnu/java/beans/info/$(am__dirstamp) -gnu/java/beans/info/$(DEPDIR)/$(am__dirstamp): - @$(mkdir_p) gnu/java/beans/info/$(DEPDIR) - @: > gnu/java/beans/info/$(DEPDIR)/$(am__dirstamp) -gnu/java/beans/info/ComponentBeanInfo.lo: \ - gnu/java/beans/info/$(am__dirstamp) \ - gnu/java/beans/info/$(DEPDIR)/$(am__dirstamp) gnu/java/beans/$(am__dirstamp): @$(mkdir_p) gnu/java/beans @: > gnu/java/beans/$(am__dirstamp) @@ -12003,7 +12224,9 @@ gnu/java/beans/$(DEPDIR)/$(am__dirstamp): @: > gnu/java/beans/$(DEPDIR)/$(am__dirstamp) gnu/java/beans/BeanInfoEmbryo.lo: gnu/java/beans/$(am__dirstamp) \ gnu/java/beans/$(DEPDIR)/$(am__dirstamp) -gnu/java/beans/EmptyBeanInfo.lo: gnu/java/beans/$(am__dirstamp) \ +gnu/java/beans/DummyAppletContext.lo: gnu/java/beans/$(am__dirstamp) \ + gnu/java/beans/$(DEPDIR)/$(am__dirstamp) +gnu/java/beans/DummyAppletStub.lo: gnu/java/beans/$(am__dirstamp) \ gnu/java/beans/$(DEPDIR)/$(am__dirstamp) gnu/java/beans/ExplicitBeanInfo.lo: gnu/java/beans/$(am__dirstamp) \ gnu/java/beans/$(DEPDIR)/$(am__dirstamp) @@ -12926,6 +13149,8 @@ java/beans/Visibility.lo: java/beans/$(am__dirstamp) \ java/beans/$(DEPDIR)/$(am__dirstamp) java/beans/AppletInitializer.lo: java/beans/$(am__dirstamp) \ java/beans/$(DEPDIR)/$(am__dirstamp) +java/beans/XMLDecoder.lo: java/beans/$(am__dirstamp) \ + java/beans/$(DEPDIR)/$(am__dirstamp) javax/swing/border/$(am__dirstamp): @$(mkdir_p) javax/swing/border @: > javax/swing/border/$(am__dirstamp) @@ -16393,12 +16618,88 @@ mostlyclean-compile: -rm -f gnu/java/awt/peer/gtk/lib_gnu_java_awt_peer_gtk_la-GtkWindowPeer.lo -rm -f gnu/java/beans/BeanInfoEmbryo.$(OBJEXT) -rm -f gnu/java/beans/BeanInfoEmbryo.lo - -rm -f gnu/java/beans/EmptyBeanInfo.$(OBJEXT) - -rm -f gnu/java/beans/EmptyBeanInfo.lo + -rm -f gnu/java/beans/DummyAppletContext.$(OBJEXT) + -rm -f gnu/java/beans/DummyAppletContext.lo + -rm -f gnu/java/beans/DummyAppletStub.$(OBJEXT) + -rm -f gnu/java/beans/DummyAppletStub.lo -rm -f gnu/java/beans/ExplicitBeanInfo.$(OBJEXT) -rm -f gnu/java/beans/ExplicitBeanInfo.lo -rm -f gnu/java/beans/IntrospectionIncubator.$(OBJEXT) -rm -f gnu/java/beans/IntrospectionIncubator.lo + -rm -f gnu/java/beans/decoder/AbstractContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/AbstractContext.lo + -rm -f gnu/java/beans/decoder/AbstractCreatableObjectContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/AbstractCreatableObjectContext.lo + -rm -f gnu/java/beans/decoder/AbstractElementHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/AbstractElementHandler.lo + -rm -f gnu/java/beans/decoder/AbstractObjectContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/AbstractObjectContext.lo + -rm -f gnu/java/beans/decoder/ArrayContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ArrayContext.lo + -rm -f gnu/java/beans/decoder/ArrayHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ArrayHandler.lo + -rm -f gnu/java/beans/decoder/AssemblyException.$(OBJEXT) + -rm -f gnu/java/beans/decoder/AssemblyException.lo + -rm -f gnu/java/beans/decoder/BooleanHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/BooleanHandler.lo + -rm -f gnu/java/beans/decoder/ByteHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ByteHandler.lo + -rm -f gnu/java/beans/decoder/CharHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/CharHandler.lo + -rm -f gnu/java/beans/decoder/ClassHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ClassHandler.lo + -rm -f gnu/java/beans/decoder/ConstructorContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ConstructorContext.lo + -rm -f gnu/java/beans/decoder/Context.$(OBJEXT) + -rm -f gnu/java/beans/decoder/Context.lo + -rm -f gnu/java/beans/decoder/DecoderContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/DecoderContext.lo + -rm -f gnu/java/beans/decoder/DefaultExceptionListener.$(OBJEXT) + -rm -f gnu/java/beans/decoder/DefaultExceptionListener.lo + -rm -f gnu/java/beans/decoder/DoubleHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/DoubleHandler.lo + -rm -f gnu/java/beans/decoder/DummyContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/DummyContext.lo + -rm -f gnu/java/beans/decoder/DummyHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/DummyHandler.lo + -rm -f gnu/java/beans/decoder/ElementHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ElementHandler.lo + -rm -f gnu/java/beans/decoder/FloatHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/FloatHandler.lo + -rm -f gnu/java/beans/decoder/GrowableArrayContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/GrowableArrayContext.lo + -rm -f gnu/java/beans/decoder/IndexContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/IndexContext.lo + -rm -f gnu/java/beans/decoder/IntHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/IntHandler.lo + -rm -f gnu/java/beans/decoder/JavaHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/JavaHandler.lo + -rm -f gnu/java/beans/decoder/LongHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/LongHandler.lo + -rm -f gnu/java/beans/decoder/MethodContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/MethodContext.lo + -rm -f gnu/java/beans/decoder/MethodFinder.$(OBJEXT) + -rm -f gnu/java/beans/decoder/MethodFinder.lo + -rm -f gnu/java/beans/decoder/NullHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/NullHandler.lo + -rm -f gnu/java/beans/decoder/ObjectContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ObjectContext.lo + -rm -f gnu/java/beans/decoder/ObjectHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ObjectHandler.lo + -rm -f gnu/java/beans/decoder/PersistenceParser.$(OBJEXT) + -rm -f gnu/java/beans/decoder/PersistenceParser.lo + -rm -f gnu/java/beans/decoder/PropertyContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/PropertyContext.lo + -rm -f gnu/java/beans/decoder/ShortHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/ShortHandler.lo + -rm -f gnu/java/beans/decoder/SimpleHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/SimpleHandler.lo + -rm -f gnu/java/beans/decoder/StaticMethodContext.$(OBJEXT) + -rm -f gnu/java/beans/decoder/StaticMethodContext.lo + -rm -f gnu/java/beans/decoder/StringHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/StringHandler.lo + -rm -f gnu/java/beans/decoder/VoidHandler.$(OBJEXT) + -rm -f gnu/java/beans/decoder/VoidHandler.lo -rm -f gnu/java/beans/editors/ColorEditor.$(OBJEXT) -rm -f gnu/java/beans/editors/ColorEditor.lo -rm -f gnu/java/beans/editors/FontEditor.$(OBJEXT) @@ -16419,8 +16720,6 @@ mostlyclean-compile: -rm -f gnu/java/beans/editors/NativeShortEditor.lo -rm -f gnu/java/beans/editors/StringEditor.$(OBJEXT) -rm -f gnu/java/beans/editors/StringEditor.lo - -rm -f gnu/java/beans/info/ComponentBeanInfo.$(OBJEXT) - -rm -f gnu/java/beans/info/ComponentBeanInfo.lo -rm -f gnu/java/io/ASN1ParsingException.$(OBJEXT) -rm -f gnu/java/io/ASN1ParsingException.lo -rm -f gnu/java/io/Base64InputStream.$(OBJEXT) @@ -18261,6 +18560,8 @@ mostlyclean-compile: -rm -f java/beans/VetoableChangeSupport.lo -rm -f java/beans/Visibility.$(OBJEXT) -rm -f java/beans/Visibility.lo + -rm -f java/beans/XMLDecoder.$(OBJEXT) + -rm -f java/beans/XMLDecoder.lo -rm -f java/beans/beancontext/BeanContext.$(OBJEXT) -rm -f java/beans/beancontext/BeanContext.lo -rm -f java/beans/beancontext/BeanContextChild.$(OBJEXT) @@ -21809,9 +22110,47 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkToolkit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/awt/peer/gtk/$(DEPDIR)/lib_gnu_java_awt_peer_gtk_la-GtkWindowPeer.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/$(DEPDIR)/BeanInfoEmbryo.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/$(DEPDIR)/EmptyBeanInfo.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/$(DEPDIR)/DummyAppletContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/$(DEPDIR)/DummyAppletStub.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/$(DEPDIR)/ExplicitBeanInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/$(DEPDIR)/IntrospectionIncubator.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/AbstractContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/AbstractCreatableObjectContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/AbstractElementHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/AbstractObjectContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ArrayContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ArrayHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/AssemblyException.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/BooleanHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ByteHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/CharHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ClassHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ConstructorContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/Context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/DecoderContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/DefaultExceptionListener.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/DoubleHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/DummyContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/DummyHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ElementHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/FloatHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/GrowableArrayContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/IndexContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/IntHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/JavaHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/LongHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/MethodContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/MethodFinder.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/NullHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ObjectContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ObjectHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/PersistenceParser.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/PropertyContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/ShortHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/SimpleHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/StaticMethodContext.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/StringHandler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/decoder/$(DEPDIR)/VoidHandler.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/editors/$(DEPDIR)/ColorEditor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/editors/$(DEPDIR)/FontEditor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/editors/$(DEPDIR)/NativeBooleanEditor.Plo@am__quote@ @@ -21822,7 +22161,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/editors/$(DEPDIR)/NativeLongEditor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/editors/$(DEPDIR)/NativeShortEditor.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/editors/$(DEPDIR)/StringEditor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@gnu/java/beans/info/$(DEPDIR)/ComponentBeanInfo.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/io/$(DEPDIR)/ASN1ParsingException.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/io/$(DEPDIR)/Base64InputStream.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@gnu/java/io/$(DEPDIR)/ClassLoaderObjectInputStream.Plo@am__quote@ @@ -22743,6 +23081,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@java/beans/$(DEPDIR)/VetoableChangeListenerProxy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/beans/$(DEPDIR)/VetoableChangeSupport.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/beans/$(DEPDIR)/Visibility.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@java/beans/$(DEPDIR)/XMLDecoder.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/beans/beancontext/$(DEPDIR)/BeanContext.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/beans/beancontext/$(DEPDIR)/BeanContextChild.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@java/beans/beancontext/$(DEPDIR)/BeanContextChildComponentProxy.Plo@am__quote@ @@ -25265,8 +25604,8 @@ clean-libtool: -rm -rf gnu/java/awt/peer/.libs gnu/java/awt/peer/_libs -rm -rf gnu/java/awt/peer/gtk/.libs gnu/java/awt/peer/gtk/_libs -rm -rf gnu/java/beans/.libs gnu/java/beans/_libs + -rm -rf gnu/java/beans/decoder/.libs gnu/java/beans/decoder/_libs -rm -rf gnu/java/beans/editors/.libs gnu/java/beans/editors/_libs - -rm -rf gnu/java/beans/info/.libs gnu/java/beans/info/_libs -rm -rf gnu/java/io/.libs gnu/java/io/_libs -rm -rf gnu/java/lang/.libs gnu/java/lang/_libs -rm -rf gnu/java/lang/reflect/.libs gnu/java/lang/reflect/_libs @@ -25793,10 +26132,10 @@ distclean-generic: -rm -f gnu/java/awt/peer/gtk/$(am__dirstamp) -rm -f gnu/java/beans/$(DEPDIR)/$(am__dirstamp) -rm -f gnu/java/beans/$(am__dirstamp) + -rm -f gnu/java/beans/decoder/$(DEPDIR)/$(am__dirstamp) + -rm -f gnu/java/beans/decoder/$(am__dirstamp) -rm -f gnu/java/beans/editors/$(DEPDIR)/$(am__dirstamp) -rm -f gnu/java/beans/editors/$(am__dirstamp) - -rm -f gnu/java/beans/info/$(DEPDIR)/$(am__dirstamp) - -rm -f gnu/java/beans/info/$(am__dirstamp) -rm -f gnu/java/io/$(DEPDIR)/$(am__dirstamp) -rm -f gnu/java/io/$(am__dirstamp) -rm -f gnu/java/lang/$(DEPDIR)/$(am__dirstamp) @@ -26099,7 +26438,7 @@ clean-am: clean-binPROGRAMS clean-generic clean-libtool clean-local \ distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) - -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/beans/info/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) gnu/xml/aelfred2/$(DEPDIR) gnu/xml/dom/$(DEPDIR) gnu/xml/dom/ls/$(DEPDIR) gnu/xml/pipeline/$(DEPDIR) gnu/xml/transform/$(DEPDIR) gnu/xml/util/$(DEPDIR) gnu/xml/xpath/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) javax/xml/$(DEPDIR) javax/xml/datatype/$(DEPDIR) javax/xml/namespace/$(DEPDIR) javax/xml/parsers/$(DEPDIR) javax/xml/transform/$(DEPDIR) javax/xml/transform/dom/$(DEPDIR) javax/xml/transform/sax/$(DEPDIR) javax/xml/transform/stream/$(DEPDIR) javax/xml/validation/$(DEPDIR) javax/xml/xpath/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) + -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/decoder/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) gnu/xml/aelfred2/$(DEPDIR) gnu/xml/dom/$(DEPDIR) gnu/xml/dom/ls/$(DEPDIR) gnu/xml/pipeline/$(DEPDIR) gnu/xml/transform/$(DEPDIR) gnu/xml/util/$(DEPDIR) gnu/xml/xpath/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) javax/xml/$(DEPDIR) javax/xml/datatype/$(DEPDIR) javax/xml/namespace/$(DEPDIR) javax/xml/parsers/$(DEPDIR) javax/xml/transform/$(DEPDIR) javax/xml/transform/dom/$(DEPDIR) javax/xml/transform/sax/$(DEPDIR) javax/xml/transform/stream/$(DEPDIR) javax/xml/validation/$(DEPDIR) javax/xml/xpath/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-libtool distclean-local distclean-tags @@ -26129,7 +26468,7 @@ installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache - -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/beans/info/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) gnu/xml/aelfred2/$(DEPDIR) gnu/xml/dom/$(DEPDIR) gnu/xml/dom/ls/$(DEPDIR) gnu/xml/pipeline/$(DEPDIR) gnu/xml/transform/$(DEPDIR) gnu/xml/util/$(DEPDIR) gnu/xml/xpath/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) javax/xml/$(DEPDIR) javax/xml/datatype/$(DEPDIR) javax/xml/namespace/$(DEPDIR) javax/xml/parsers/$(DEPDIR) javax/xml/transform/$(DEPDIR) javax/xml/transform/dom/$(DEPDIR) javax/xml/transform/sax/$(DEPDIR) javax/xml/transform/stream/$(DEPDIR) javax/xml/validation/$(DEPDIR) javax/xml/xpath/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) + -rm -rf ./$(DEPDIR) gnu/awt/$(DEPDIR) gnu/awt/j2d/$(DEPDIR) gnu/awt/xlib/$(DEPDIR) gnu/classpath/$(DEPDIR) gnu/gcj/$(DEPDIR) gnu/gcj/convert/$(DEPDIR) gnu/gcj/io/$(DEPDIR) gnu/gcj/runtime/$(DEPDIR) gnu/gcj/tools/gcj_dbtool/$(DEPDIR) gnu/gcj/util/$(DEPDIR) gnu/gcj/xlib/$(DEPDIR) gnu/java/awt/$(DEPDIR) gnu/java/awt/color/$(DEPDIR) gnu/java/awt/image/$(DEPDIR) gnu/java/awt/peer/$(DEPDIR) gnu/java/awt/peer/gtk/$(DEPDIR) gnu/java/beans/$(DEPDIR) gnu/java/beans/decoder/$(DEPDIR) gnu/java/beans/editors/$(DEPDIR) gnu/java/io/$(DEPDIR) gnu/java/lang/$(DEPDIR) gnu/java/lang/reflect/$(DEPDIR) gnu/java/locale/$(DEPDIR) gnu/java/math/$(DEPDIR) gnu/java/net/$(DEPDIR) gnu/java/net/protocol/core/$(DEPDIR) gnu/java/net/protocol/file/$(DEPDIR) gnu/java/net/protocol/ftp/$(DEPDIR) gnu/java/net/protocol/gcjlib/$(DEPDIR) gnu/java/net/protocol/http/$(DEPDIR) gnu/java/net/protocol/http/event/$(DEPDIR) gnu/java/net/protocol/jar/$(DEPDIR) gnu/java/nio/$(DEPDIR) gnu/java/nio/channels/$(DEPDIR) gnu/java/nio/charset/$(DEPDIR) gnu/java/rmi/$(DEPDIR) gnu/java/rmi/dgc/$(DEPDIR) gnu/java/rmi/registry/$(DEPDIR) gnu/java/rmi/rmic/$(DEPDIR) gnu/java/rmi/server/$(DEPDIR) gnu/java/security/$(DEPDIR) gnu/java/security/action/$(DEPDIR) gnu/java/security/ber/$(DEPDIR) gnu/java/security/der/$(DEPDIR) gnu/java/security/pkcs/$(DEPDIR) gnu/java/security/provider/$(DEPDIR) gnu/java/security/util/$(DEPDIR) gnu/java/security/x509/$(DEPDIR) gnu/java/security/x509/ext/$(DEPDIR) gnu/java/text/$(DEPDIR) gnu/java/util/$(DEPDIR) gnu/java/util/prefs/$(DEPDIR) gnu/regexp/$(DEPDIR) gnu/xml/aelfred2/$(DEPDIR) gnu/xml/dom/$(DEPDIR) gnu/xml/dom/ls/$(DEPDIR) gnu/xml/pipeline/$(DEPDIR) gnu/xml/transform/$(DEPDIR) gnu/xml/util/$(DEPDIR) gnu/xml/xpath/$(DEPDIR) java/applet/$(DEPDIR) java/awt/$(DEPDIR) java/awt/color/$(DEPDIR) java/awt/datatransfer/$(DEPDIR) java/awt/dnd/$(DEPDIR) java/awt/dnd/peer/$(DEPDIR) java/awt/event/$(DEPDIR) java/awt/font/$(DEPDIR) java/awt/geom/$(DEPDIR) java/awt/im/$(DEPDIR) java/awt/im/spi/$(DEPDIR) java/awt/image/$(DEPDIR) java/awt/image/renderable/$(DEPDIR) java/awt/peer/$(DEPDIR) java/awt/print/$(DEPDIR) java/beans/$(DEPDIR) java/beans/beancontext/$(DEPDIR) java/io/$(DEPDIR) java/lang/$(DEPDIR) java/lang/ref/$(DEPDIR) java/lang/reflect/$(DEPDIR) java/math/$(DEPDIR) java/net/$(DEPDIR) java/nio/$(DEPDIR) java/nio/channels/$(DEPDIR) java/nio/channels/spi/$(DEPDIR) java/nio/charset/$(DEPDIR) java/nio/charset/spi/$(DEPDIR) java/rmi/$(DEPDIR) java/rmi/activation/$(DEPDIR) java/rmi/dgc/$(DEPDIR) java/rmi/registry/$(DEPDIR) java/rmi/server/$(DEPDIR) java/security/$(DEPDIR) java/security/acl/$(DEPDIR) java/security/cert/$(DEPDIR) java/security/interfaces/$(DEPDIR) java/security/spec/$(DEPDIR) java/sql/$(DEPDIR) java/text/$(DEPDIR) java/util/$(DEPDIR) java/util/jar/$(DEPDIR) java/util/logging/$(DEPDIR) java/util/prefs/$(DEPDIR) java/util/regex/$(DEPDIR) java/util/zip/$(DEPDIR) javax/accessibility/$(DEPDIR) javax/crypto/$(DEPDIR) javax/crypto/interfaces/$(DEPDIR) javax/crypto/spec/$(DEPDIR) javax/imageio/$(DEPDIR) javax/imageio/event/$(DEPDIR) javax/imageio/metadata/$(DEPDIR) javax/imageio/spi/$(DEPDIR) javax/imageio/stream/$(DEPDIR) javax/naming/$(DEPDIR) javax/naming/directory/$(DEPDIR) javax/naming/event/$(DEPDIR) javax/naming/ldap/$(DEPDIR) javax/naming/spi/$(DEPDIR) javax/net/$(DEPDIR) javax/net/ssl/$(DEPDIR) javax/print/$(DEPDIR) javax/print/attribute/$(DEPDIR) javax/print/attribute/standard/$(DEPDIR) javax/print/event/$(DEPDIR) javax/security/auth/$(DEPDIR) javax/security/auth/callback/$(DEPDIR) javax/security/auth/login/$(DEPDIR) javax/security/auth/spi/$(DEPDIR) javax/security/auth/x500/$(DEPDIR) javax/security/cert/$(DEPDIR) javax/security/sasl/$(DEPDIR) javax/sql/$(DEPDIR) javax/swing/$(DEPDIR) javax/swing/border/$(DEPDIR) javax/swing/colorchooser/$(DEPDIR) javax/swing/event/$(DEPDIR) javax/swing/filechooser/$(DEPDIR) javax/swing/plaf/$(DEPDIR) javax/swing/plaf/basic/$(DEPDIR) javax/swing/plaf/metal/$(DEPDIR) javax/swing/table/$(DEPDIR) javax/swing/text/$(DEPDIR) javax/swing/text/html/$(DEPDIR) javax/swing/text/html/parser/$(DEPDIR) javax/swing/tree/$(DEPDIR) javax/swing/undo/$(DEPDIR) javax/transaction/$(DEPDIR) javax/transaction/xa/$(DEPDIR) javax/xml/$(DEPDIR) javax/xml/datatype/$(DEPDIR) javax/xml/namespace/$(DEPDIR) javax/xml/parsers/$(DEPDIR) javax/xml/transform/$(DEPDIR) javax/xml/transform/dom/$(DEPDIR) javax/xml/transform/sax/$(DEPDIR) javax/xml/transform/stream/$(DEPDIR) javax/xml/validation/$(DEPDIR) javax/xml/xpath/$(DEPDIR) jni/classpath/$(DEPDIR) jni/gtk-peer/$(DEPDIR) org/ietf/jgss/$(DEPDIR) sysdep/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic diff --git a/libjava/gnu/java/beans/DummyAppletContext.java b/libjava/gnu/java/beans/DummyAppletContext.java new file mode 100644 index 0000000..e10a907 --- /dev/null +++ b/libjava/gnu/java/beans/DummyAppletContext.java @@ -0,0 +1,200 @@ +/* gnu.java.beans.DummyAppletContext + Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.beans; + +import java.applet.Applet; +import java.applet.AppletContext; +import java.applet.AudioClip; +import java.awt.Image; +import java.awt.Toolkit; +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Collections; +import java.util.Enumeration; +import java.util.Iterator; + +/** A placeholder <code>AppletContext</code> implementation that does nothing. + * + * <p>This is the default implementation for GNU Classpath and is used for <code>Applet</code> + * beans being created with {@link java.beans.Beans.instantiate}.</p> + * + * <p>It has no functionality in order to allow it to be used without any dependencies + * (e.g. sound, network access, ...).</p> + * + * @author Robert Schuster + */ +class DummyAppletContext implements AppletContext +{ + private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.EMPTY_SET); + private static final AudioClip DUMMY_CLIP = new DummyAudioClip(); + + DummyAppletContext() + { + } + + /** Implementation is VM neutral and returns a dummy {@link AudioClip} instance + * for every URL that returns a non-<code>null</code> object on + * <code>URL.openConnection()</code>. + * + * @see java.applet.AppletContext#getAudioClip(java.net.URL) + * + * FIXME: When Java Sound API (javax.sound) is included in Classpath or URL is able to handle + * sampled sound this should be adjusted. + */ + public AudioClip getAudioClip(URL url) + { + try + { + return (url.openConnection() != null ? DUMMY_CLIP : null); + } + catch (IOException ioe) + { + return null; + } + } + + /** Loads the <code>Image</code> instance by delegating to + * {@link java.awt.Toolkit.createImage(URL) }. + * + * @see java.applet.AppletContext#getImage(java.net.URL) + * @see java.awt.Toolkit#createImage(java.net.URL) + */ + public Image getImage(URL url) + { + return Toolkit.getDefaultToolkit().createImage(url); + } + + /** Returns <code>null</code> for every argument. + * + * @see java.applet.AppletContext#getApplet(java.lang.String) + */ + public Applet getApplet(String name) + { + return null; + } + + /** Returns always an empty <code>Enumeration</code>. + * + * @see java.applet.AppletContext#getApplets() + */ + public Enumeration getApplets() + { + return EMPTY_ENUMERATION; + } + + /** Does nothing. + * + * @see java.applet.AppletContext#showDocument(java.net.URL) + */ + public void showDocument(URL url) + { + } + + /** Does nothing. + * + * @see java.applet.AppletContext#showDocument(java.net.URL, java.lang.String) + */ + public void showDocument(URL url, String target) + { + } + + /** Does nothing. + * + * @see java.applet.AppletContext#showStatus(java.lang.String) + */ + public void showStatus(String message) + { + } + + /** Does nothing. + * + * @see java.applet.AppletContext#setStream(java.lang.String, java.io.InputStream) + */ + public void setStream(String key, InputStream stream) + throws IOException + { + throw new IOException("Dummy implementation imposes zero InputStream associations."); + } + + /** Returns <code>null</code> for every argument. + * + * @see java.applet.AppletContext#getStream(java.lang.String) + */ + public InputStream getStream(String key) + { + return null; + } + + /** Returns always an empty iterator. + * + * @see java.applet.AppletContext#getStreamKeys() + */ + public Iterator getStreamKeys() + { + return Collections.EMPTY_SET.iterator(); + } + + /** Dummy <code>AudioClip</code> implementation that does nothing but + * preventing <code>NullPointerException</code>S being thrown in programs + * that expect a valid <code>AudioClip</code> instance to be returned by + * their Applet. + * + * @author Robert Schuster + */ + static class DummyAudioClip implements AudioClip + { + public void play() + { + } + + public void stop() + { + } + + public void loop() + { + } + + public String toString() + { + return "DummyAudioClip never plays anything - implement javax.sound and make us happy :)"; + } + } +} diff --git a/libjava/gnu/java/beans/DummyAppletStub.java b/libjava/gnu/java/beans/DummyAppletStub.java new file mode 100644 index 0000000..ff99e98 --- /dev/null +++ b/libjava/gnu/java/beans/DummyAppletStub.java @@ -0,0 +1,115 @@ +/* gnu.java.beans.DummyAppletStub + Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.java.beans; + +import java.applet.AppletContext; +import java.applet.AppletStub; +import java.net.URL; + +/** Placeholder implementation of <code>AppletStub</code> providing no functionality. + * <p>This class is used for <code>Applet</code> being created with + * {@link java.beans.Bean.instantiate}.</p> + * + * @author Robert Schuster + */ +public class DummyAppletStub implements AppletStub +{ + private URL documentBase; + private URL codeBase; + private DummyAppletContext context; + + public DummyAppletStub(URL newCodeBase, URL newDocumentBase) + { + codeBase = newCodeBase; + documentBase = newDocumentBase; + + context = new DummyAppletContext(); + } + + /** Returns always <code>true</code>. + * + * @see java.applet.AppletStub#isActive() + */ + public boolean isActive() + { + return true; + } + + /** + * @see java.applet.AppletStub#getDocumentBase() + */ + public URL getDocumentBase() + { + return documentBase; + } + + /** + * @see java.applet.AppletStub#getCodeBase() + */ + public URL getCodeBase() + { + return codeBase; + } + + /** Implementation returns <code>null</code> for every parameter name. + * + * @see java.applet.AppletStub#getParameter(java.lang.String) + */ + public String getParameter(String name) + { + return null; + } + + /** Returns a non-functional context instance. + * + * @see java.applet.AppletStub#getAppletContext() + */ + public AppletContext getAppletContext() + { + return context; + } + + /** Does nothing. + * + * @see java.applet.AppletStub#appletResize(int, int) + */ + public void appletResize(int width, int height) + { + } +} diff --git a/libjava/gnu/java/beans/EmptyBeanInfo.java b/libjava/gnu/java/beans/decoder/AbstractContext.java index 97cdf0a..ae945c2 100644 --- a/libjava/gnu/java/beans/EmptyBeanInfo.java +++ b/libjava/gnu/java/beans/decoder/AbstractContext.java @@ -1,5 +1,5 @@ -/* gnu.java.beans.EmptyBeanInfo - Copyright (C) 1998 Free Software Foundation, Inc. +/* gnu.java.beans.decoder.AbstractContext + Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,36 +35,36 @@ 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 gnu.java.beans.decoder; -package gnu.java.beans; -import java.beans.*; +/** AbstractContext implements some basic functionality of the Context + * interface and is therefore the base of all Context implementations. + * + * @author Robert Schuster + */ +abstract class AbstractContext implements Context +{ + private boolean isStatement; + private String id; -/** - ** EmptyBeanInfo is a BeanInfo that discloses no - ** information about the Bean and does not allow - ** Introspection. The Introspector uses instances of this - ** class to create empty BeanInfos, but it could also be - ** used as a base class for BeanInfos that do not allow - ** Introspection and provide only a little bit of - ** information.<P> - ** - ** @author John Keiser - ** @version 1.1.0, 30 Jul 1998 - ** @see gnu.java.beans.ExplicitBeanInfo - ** @see java.beans.BeanInfo - **/ + public String getId() + { + return id; + } -public class EmptyBeanInfo extends ExplicitBeanInfo { - /** Create a new EmptyBeanInfo. **/ - public EmptyBeanInfo(Class beanClass) { - super(new BeanDescriptor(beanClass,null), - new BeanInfo[0], - new PropertyDescriptor[0], - -1, - new EventSetDescriptor[0], - -1, - new MethodDescriptor[0], - null); - } + public void setId(String newId) + { + id = newId; + } + + public boolean isStatement() + { + return isStatement; + } + + public void setStatement(boolean b) + { + isStatement = b; + } } diff --git a/libjava/gnu/java/beans/decoder/AbstractCreatableObjectContext.java b/libjava/gnu/java/beans/decoder/AbstractCreatableObjectContext.java new file mode 100644 index 0000000..e2943e2 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/AbstractCreatableObjectContext.java @@ -0,0 +1,113 @@ +/* gnu.java.beans.decoder.AbstractCreatableContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ +package gnu.java.beans.decoder; + + +/** AbstractCreatableObjectContext is the base class for all Context implementations + * which create a result object in their lifetime. It provides means for preventing + * to create the object twice. + * + * @author Robert Schuster + * + */ +abstract class AbstractCreatableObjectContext extends AbstractObjectContext +{ + AbstractCreatableObjectContext() + { + } + + /** Adds a parameter object to this Context if the result object has not been + * created yet. Otherwise an AssemblyException is thrown that indicates a wrong + * behavior of the decoder. + */ + public final void addParameterObject(Object o) throws AssemblyException + { + if (object == null) + addParameterObjectImpl(o); + else + throw new AssemblyException(new IllegalStateException("No more parameter objects are allowed when the object as already been created.")); + } + + /** Adds a parameter object to this Context. Implement this without caring + * for illegal states because this has been done already. + * + * @param obj The parameter object to be added. + */ + protected abstract void addParameterObjectImpl(Object obj); + + /** Creates the result object if it does not exist already. + */ + public final void notifyStatement(Context outerContext) + throws AssemblyException + { + if (object != null) + return; + + object = createObject(outerContext); + } + + /** Creates the result object. This method is called only once. Implement this + * without checking for double invocations as this is already being prevented. + * + * @param outerContext The Context that exists around this one. + * @return The result object. + * @throws AssemblerException if the object creation fails somehow. + */ + protected abstract Object createObject(Context outerContext) + throws AssemblyException; + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public final Object endContext(Context outerContext) + throws AssemblyException + { + notifyStatement(outerContext); + return object; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + /* Returns true when the AbstractCreatableObjectContext has not created the result object yet + * (A failed subcontext automatically lets this context fail too.) + */ + return object == null; + } +} diff --git a/libjava/gnu/java/beans/decoder/AbstractElementHandler.java b/libjava/gnu/java/beans/decoder/AbstractElementHandler.java new file mode 100644 index 0000000..a097a75 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/AbstractElementHandler.java @@ -0,0 +1,316 @@ +/* gnu.java.beans.decoder.AbstractElementHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +import org.xml.sax.Attributes; + +/** ElementHandler manages a Context instance and interacts with + * its parent and child handlers. + * + * @author Robert Schuster + */ +abstract class AbstractElementHandler implements ElementHandler +{ + /** The Context instance of this handler. The instance is available after the startElement() + * method was called. Otherwise the handler is marked as failed. + */ + private Context context; + + /** The parent handler. */ + private ElementHandler parent; + + /** Stores whether this handler is marked as failed. */ + private boolean hasFailed; + + /** Stores the character data which is contained in the body of the XML tag. */ + private StringBuffer buffer = new StringBuffer(); + + /** Stores whether this ElementHandler can have subelements. The information for this is taken from + * javabeans.dtd which can be found here: + * <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3/">Java Persistence Article</a> + */ + private boolean allowsSubelements; + + /** Creates a new ElementHandler with the given ElementHandler instance + * as parent. + * + * @param parentHandler The parent handler. + */ + protected AbstractElementHandler(ElementHandler parentHandler, + boolean allowsSubs) + { + parent = parentHandler; + allowsSubelements = allowsSubs; + } + + /** Evaluates the attributes and creates a Context instance. + * If the creation of the Context instance fails the ElementHandler + * is marked as failed which may affect the parent handler other. + * + * @param attributes Attributes of the XML tag. + */ + public final void start(Attributes attributes, + ExceptionListener exceptionListener) + { + try + { + // lets the subclass create the appropriate Context instance + context = startElement(attributes, exceptionListener); + } + catch (AssemblyException pe) + { + Throwable t = pe.getCause(); + + if (t instanceof Exception) + exceptionListener.exceptionThrown((Exception) t); + else + throw new InternalError("Unexpected Throwable type in AssemblerException. Please file a bug report."); + + notifyContextFailed(); + + return; + } + } + + /** Analyses the content of the Attributes instance and creates a Context + * object accordingly. + * An AssemblerException is thrown when the Context instance could not + * be created. + * + * @param attributes Attributes of the XML tag. + * @return A Context instance. + * @throws AssemblerException when Context instance could not be created. + */ + protected abstract Context startElement(Attributes attributes, ExceptionListener exceptionListener) + throws AssemblyException; + + /** Post-processes the Context. + */ + public final void end(ExceptionListener exceptionListener) + { + // skips processing if the handler is marked as failed (because the Context + // is then invalid or may not exist at all) + if (!hasFailed) + { + try + { + // note: the order of operations is very important here + // sends the stored character data to the Context + endElement(buffer.toString()); + + // reports to the parent handler if this handler's Context is a + // statement (returning no value BACK to the parent's Context) + if (context.isStatement()) + { + // This may create a valid result in the parent's Context + // or let it fail + parent.notifyStatement(exceptionListener); + + // skips any further processing if the parent handler is now marked + // as failed + if (parent.hasFailed()) + return; + } + + // processes the Context and stores the result + putObject(context.getId(), context.endContext(parent.getContext())); + + // transfers the Context's results to the parent's Context + // if it is an expression (rather than a statement) + if (! context.isStatement()) + parent.getContext().addParameterObject(context.getResult()); + } + catch (AssemblyException pe) + { + // notifies that an exception was thrown in this handler's Context + Throwable t = pe.getCause(); + + if (t instanceof Exception) + exceptionListener.exceptionThrown((Exception) t); + else + throw (InternalError) new InternalError("Severe problem while decoding XML data.") + .initCause(t); + + // marks the handler as failed + notifyContextFailed(); + } + } + } + + /** Notifies the handler's Context that its child Context will not return + * a value back. Some Context variants need this information to know when + * a method or a constructor call can be made. + * + * This method is called by a child handler. + */ + public void notifyStatement(ExceptionListener exceptionListener) + { + try + { + + // propagates to parent handler first to generate objects + // needed by this Context instance + if(context.isStatement()) + { + parent.notifyStatement(exceptionListener); + } + + // Some Context instances do stuff which can fail now. If that + // happens this handler is marked as failed. + context.notifyStatement(parent.getContext()); + } + catch (AssemblyException ae) + { + // notifies that an exception was thrown in this handler's Context + Throwable t = ae.getCause(); + + if (t instanceof Exception) + exceptionListener.exceptionThrown((Exception) t); + else + throw (InternalError) new InternalError("Severe problem while decoding XML data.") + .initCause(t); + + // marks the handler as failed + notifyContextFailed(); + } + } + + /** Marks this and any depending parent handlers as failed. Which means that on their end + * no result is calculated. + * + * When a handler has failed no more handlers are accepted within it. + */ + public final void notifyContextFailed() + { + hasFailed = true; + + // marks the parent handler as failed if its Context + // is affected by the failure of this handler's Context + if (parent.getContext().subContextFailed()) + parent.notifyContextFailed(); + } + + /** Returns whether this handler has failed. + * + * This is used to skip child elements. + * + * @return Whether this handler has failed. + */ + public final boolean hasFailed() + { + return hasFailed; + } + + /** Processes the character data when the element ends. + * + * The default implementation does nothing for convenience. + * + * @param characters + * @throws AssemblerException + */ + protected void endElement(String characters) throws AssemblyException + { + // XXX: throw an exception when unexpected character data is available? + } + + /** Adds characters from the body of the XML tag to the buffer. + * + * @param ch + * @param start + * @param length + * @throws SAXException + */ + public final void characters(char[] ch, int start, int length) + { + // simply appends character data + buffer.append(ch, start, length); + } + + /** Stores an object globally under a unique id. If the id is + * null the object is not stored. + * + * @param objectId + * @param o + */ + public void putObject(String objectId, Object o) + { + if (objectId != null) + parent.putObject(objectId, o); + } + + /** Returns a previously stored object. If the id is null the + * result is null, too. + * + * @param objectId + * @return Returns a previously stored object or null. + */ + public Object getObject(String objectId) throws AssemblyException + { + return objectId == null ? null : parent.getObject(objectId); + } + + /** Returns the Class instance as if called Class.forName() but + * uses a ClassLoader given by the user. + * + * @param className + * @return + * @throws ClassNotFoundException + */ + public Class instantiateClass(String className) + throws ClassNotFoundException + { + return parent.instantiateClass(className); + } + + public final boolean isSubelementAllowed(String subElementName) + { + return allowsSubelements && ! subElementName.equals("java"); + } + + public final Context getContext() + { + return context; + } + + public final ElementHandler getParent() + { + return parent; + } +} diff --git a/libjava/gnu/java/beans/decoder/AbstractObjectContext.java b/libjava/gnu/java/beans/decoder/AbstractObjectContext.java new file mode 100644 index 0000000..3e32279 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/AbstractObjectContext.java @@ -0,0 +1,127 @@ +/* gnu.java.beans.decoder.AbstractObjectContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ +package gnu.java.beans.decoder; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** AbstractObjectContext is the base for all Context implementations which + * create or provide a result object during their lifetime. + * + * <p>This class provides the implementation for an indexed get and set method. + * But this does not mean that the result object supports these operation.</p> + * + * @author Robert Schuster + * + */ +abstract class AbstractObjectContext extends AbstractContext +{ + protected Object object; + + AbstractObjectContext() + {} + + /** Sets the result object of the Context. + * + * @param obj The result object to be set. + */ + protected final void setObject(Object obj) + { + object = obj; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object) + */ + public final void set(int index, Object o) throws AssemblyException + { + try + { + Method method = + object.getClass().getMethod( + "set", + new Class[] { Integer.TYPE, Object.class }); + + method.invoke(object, new Object[] { new Integer(index), o }); + } + catch (NoSuchMethodException nsme) + { + throw new AssemblyException(nsme); + } + catch (InvocationTargetException ite) + { + throw new AssemblyException(ite.getCause()); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#get(int) + */ + public final Object get(int index) throws AssemblyException + { + try + { + Method method = + object.getClass().getMethod( + "get", + new Class[] { Integer.TYPE }); + + return method.invoke(object, new Object[] { new Integer(index)}); + } + catch (NoSuchMethodException nsme) + { + throw new AssemblyException(nsme); + } + catch (InvocationTargetException ite) + { + throw new AssemblyException(ite.getCause()); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } + + public final Object getResult() + { + return object; + } +} diff --git a/libjava/gnu/java/beans/decoder/ArrayContext.java b/libjava/gnu/java/beans/decoder/ArrayContext.java new file mode 100644 index 0000000..73b8731 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ArrayContext.java @@ -0,0 +1,122 @@ +/* gnu.java.beans.decoder.ArrayContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.lang.reflect.Array; + +/** A Context implementation for a fixed size array. The array + * elements have to be set using IndexContext instances. + * + * @author Robert Schuster + */ +class ArrayContext extends AbstractContext +{ + private Object array; + + ArrayContext(String id, Class klass, int length) + { + setId(id); + array = Array.newInstance(klass, length); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + throw new AssemblyException(new IllegalStateException("Adding objects without an index to a fixed array is not possible.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#reportStatement() + */ + public void notifyStatement(Context outerContext) + { + // method call intentionally ignored because there is not any useful effect + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public Object endContext(Context outerContext) throws AssemblyException + { + return array; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + // returns false to indicate that assembling the array does not fail only because + // a subelement failed. + return false; + } + + public void set(int index, Object o) throws AssemblyException + { + try + { + Array.set(array, index, o); + } + catch (ArrayIndexOutOfBoundsException aioobe) + { + throw new AssemblyException(aioobe); + } + } + + public Object get(int index) throws AssemblyException + { + try + { + return Array.get(array, index); + } + catch (ArrayIndexOutOfBoundsException aioobe) + { + throw new AssemblyException(aioobe); + } + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#getResult() + */ + public Object getResult() + { + return array; + } +} diff --git a/libjava/gnu/java/beans/decoder/ArrayHandler.java b/libjava/gnu/java/beans/decoder/ArrayHandler.java new file mode 100644 index 0000000..ac8f486 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ArrayHandler.java @@ -0,0 +1,118 @@ +/* gnu.java.beans.decoder.ArrayHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; +import java.util.HashMap; + +import org.xml.sax.Attributes; + +/** ArrayHandler processes the <array> tag. Depending on the existance of the 'length' attribute a Context for + * a fixed-size or growable array is created. + * + * @author Robert Schuster + */ +class ArrayHandler extends AbstractElementHandler +{ + /** Contains a mapping between a textual description of a primitive type (like "byte") and + * its corresponding wrapper class. This allows it to easily construct Array objects for + * primitive data types. + */ + private static HashMap typeMap = new HashMap(); + + static + { + typeMap.put("byte", Byte.TYPE); + typeMap.put("short", Short.TYPE); + typeMap.put("int", Integer.TYPE); + typeMap.put("long", Long.TYPE); + + typeMap.put("float", Float.TYPE); + typeMap.put("double", Double.TYPE); + + typeMap.put("boolean", Boolean.TYPE); + + typeMap.put("char", Character.TYPE); + } + + /** + * @param PersistenceParser + */ + ArrayHandler(ElementHandler parent) + { + super(parent, true); + } + + protected Context startElement(Attributes attributes, ExceptionListener exceptionListener) + throws AssemblyException, AssemblyException + { + String id = attributes.getValue("id"); + String className = attributes.getValue("class"); + + if (className != null) + { + try + { + Class klass; + + if (typeMap.containsKey(className)) + klass = (Class) typeMap.get(className); + else + klass = instantiateClass(className); + + String length = attributes.getValue("length"); + if (length != null) + // creates Array with predefined length + return new ArrayContext(id, klass, Integer.parseInt(length)); + else + // creates Array without length restriction + return new GrowableArrayContext(id, klass); + } + catch (ClassNotFoundException cnfe) + { + throw new AssemblyException(cnfe); + } + catch (NumberFormatException nfe) + { + throw new AssemblyException(nfe); + } + } + + throw new AssemblyException(new IllegalArgumentException("Missing 'class' attribute in <array> tag.")); + } +} diff --git a/libjava/gnu/java/beans/decoder/AssemblyException.java b/libjava/gnu/java/beans/decoder/AssemblyException.java new file mode 100644 index 0000000..0b5075b --- /dev/null +++ b/libjava/gnu/java/beans/decoder/AssemblyException.java @@ -0,0 +1,57 @@ +/* gnu.java.beans.decoder.AssemblyException + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** The AssemblyException is used to wrap the cause of problems when assembling objects. + * In all cases only the wrapped exception is given to the PersistenceParser's + * ExceptionListener instance (never the AssemblyException itself). + * + * <p>Note: Often multiple steps are needed to construct a fully usuable object instance. + * Such a construction can be called assembly and thats why this exception was + * named AssemblyException.</p> + * + * @author Robert Schuster + */ +class AssemblyException extends Exception +{ + AssemblyException(Throwable cause) + { + super(cause); + } +} diff --git a/libjava/gnu/java/beans/info/ComponentBeanInfo.java b/libjava/gnu/java/beans/decoder/BooleanHandler.java index 877a18d..2cb1e04 100644 --- a/libjava/gnu/java/beans/info/ComponentBeanInfo.java +++ b/libjava/gnu/java/beans/decoder/BooleanHandler.java @@ -1,5 +1,5 @@ -/* gnu.java.beans.info.ComponentBeanInfo - Copyright (C) 1998 Free Software Foundation, Inc. +/* gnu.java.beans.decoder.BooleanHandler + Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,41 +35,33 @@ 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 gnu.java.beans.decoder; -package gnu.java.beans.info; -import java.beans.IntrospectionException; -import java.beans.PropertyDescriptor; -import java.beans.SimpleBeanInfo; +/** Creates a Boolean instance from the character data in a <boolean> tag. + * + * @author Robert Schuster + */ +class BooleanHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + BooleanHandler(ElementHandler parent) + { + super(parent); -/** BeanInfo class for java.awt.Component. - ** This provides a few properties, but that's - ** it. - ** @author John Keiser - ** @version 1.1.0, Aug 1 1998 - **/ -public class ComponentBeanInfo extends SimpleBeanInfo { - static PropertyDescriptor[] properties; - static { - try { - properties = new PropertyDescriptor[6]; - properties[0] = new PropertyDescriptor("name",java.awt.Component.class); - properties[1] = new PropertyDescriptor("background",java.awt.Component.class); - properties[2] = new PropertyDescriptor("foreground",java.awt.Component.class); - properties[3] = new PropertyDescriptor("font",java.awt.Component.class); - properties[4] = new PropertyDescriptor("enabled",java.awt.Component.class); - properties[5] = new PropertyDescriptor("visible",java.awt.Component.class); - } catch(IntrospectionException E) { - properties = null; - throw new UnknownError("Could not introspect some java.awt.Component properties."); - } - } - public ComponentBeanInfo() { - super(); - } + // TODO Auto-generated constructor stub + } - public PropertyDescriptor[] getPropertyDescriptors() { - return properties; - } -} + protected Object parse(String number) throws AssemblyException + { + if (number.equals("true")) + return new Boolean(true); + + if (number.equals("false")) + return new Boolean(false); + throw new AssemblyException(new IllegalArgumentException("Element contained no valid boolean value.")); + } +} diff --git a/libjava/gnu/java/beans/decoder/ByteHandler.java b/libjava/gnu/java/beans/decoder/ByteHandler.java new file mode 100644 index 0000000..f21b280 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ByteHandler.java @@ -0,0 +1,59 @@ +/* gnu.java.beans.decoder.ByteHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Byte instance from the character data in a <byte> tag. + * + * @author Robert Schuster + */ +class ByteHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + ByteHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws NumberFormatException + { + return Byte.valueOf(number); + } +} diff --git a/libjava/gnu/java/beans/decoder/CharHandler.java b/libjava/gnu/java/beans/decoder/CharHandler.java new file mode 100644 index 0000000..269c250 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/CharHandler.java @@ -0,0 +1,62 @@ +/* gnu.java.beans.decoder.CharHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Character instance from the character data in a <char> tag. + * + * @author Robert Schuster + */ +class CharHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + CharHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws AssemblyException + { + if (number.length() > 1) + throw new AssemblyException(new IllegalArgumentException("Element contained no valid character.")); + + return new Character(number.charAt(0)); + } +} diff --git a/libjava/gnu/java/beans/decoder/ClassHandler.java b/libjava/gnu/java/beans/decoder/ClassHandler.java new file mode 100644 index 0000000..1c8aebd --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ClassHandler.java @@ -0,0 +1,66 @@ +/* gnu.java.beans.decoder.ClassHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Class instance from the character data in a <class> tag. + * + * @author Robert Schuster + */ +class ClassHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + ClassHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String characters) throws AssemblyException + { + try + { + return instantiateClass(characters); + } + catch (ClassNotFoundException cnfe) + { + throw new AssemblyException(cnfe); + } + } +} diff --git a/libjava/gnu/java/beans/decoder/ConstructorContext.java b/libjava/gnu/java/beans/decoder/ConstructorContext.java new file mode 100644 index 0000000..e2e6ef0 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ConstructorContext.java @@ -0,0 +1,102 @@ +/* gnu.java.beans.decoder.ConstructorContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; + +/** A ConstructorContext is a {@link Context} implementation which collects the parameters for a constructor + * call and instantiates the result object using that constructor. After that sub-contexts can invoke + * methods on the result object. + * + * <p>The constructor is invoked when a sub-context is a statement or the Context ends.</p> + * + * @author Robert Schuster + */ +class ConstructorContext extends AbstractCreatableObjectContext +{ + private ArrayList arguments = new ArrayList(); + private Class klass; + + ConstructorContext(String id, Class newClass) + { + setId(id); + // sets superclass field + klass = newClass; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + protected void addParameterObjectImpl(Object o) + { + arguments.add(o); + } + + protected Object createObject(Context outerContext) + throws AssemblyException + { + Object[] args = arguments.toArray(); + + try + { + Constructor constructor = MethodFinder.getConstructor(klass, args); + + // instantiates object (klass field gets re-set by superclass) + return constructor.newInstance(args); + } + catch (NoSuchMethodException nsme) + { + throw new AssemblyException(nsme); + } + catch (InvocationTargetException ite) + { + throw new AssemblyException(ite.getCause()); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + catch (InstantiationException ie) + { + throw new AssemblyException(ie); + } + } + +} diff --git a/libjava/gnu/java/beans/decoder/Context.java b/libjava/gnu/java/beans/decoder/Context.java new file mode 100644 index 0000000..55746c8 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/Context.java @@ -0,0 +1,137 @@ +/* gnu.java.beans.decoder.Context + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +/** A Context is the environment for an object which is being assembler. If there + * are no errors each handler creates one Context. + * <p>Depending on the result of isStatement() a Context can be statement or an + * expression. An expression returns a value to the Context of its parent handler, + * a statement does not. Whenever a Context is a statement the parent handler's + * Context is informed about that through the {@link notifyStatement}-method.</p> + * + * @author Robert Schuster + */ +interface Context +{ + /** Adds a parameter object to the context. This method is used when + * sub-Contexts return their result. + * + * Some Contexts do not accept more than a certain amount of objects + * and throw an AssemblerException if the amount is exceeded. + * + * @param o The object added to this context. + */ + void addParameterObject(Object o) throws AssemblyException; + + /** Notifies that the next element is a statement. This can mean + * that an argument list is complete to be called. + * + */ + void notifyStatement(Context outerContext) throws AssemblyException; + + /** Notifies that the context ends and the returns the appropriate result + * object. + * + * @param outerContext + * @return + */ + Object endContext(Context outerContext) throws AssemblyException; + + /** Notifies that the assembly of a subcontext failed and returns + * whether this Context is affected in a way that it fails too. + * + * @return Whether the failure of a subcontext lets this context fail, too. + */ + boolean subContextFailed(); + + /** Calls an appropriate indexed set method if it is available or + * throws an AssemblerException if that is not allowed on this Context. + * + * The behaviour of this method is equal to List.set(int, Object). + * + * @param index Index position to be set. + * @param o Object to be set at the given index position. + * @throws AssemblerException Indexed set is not allowed or otherwise failed. + */ + void set(int index, Object o) throws AssemblyException; + + /** Calls an appropriate indexed get method if it is available or + * throws an AssemblerException if that is not allowed on this Context. + * + * The behaviour of this method is equal to List.get(int). + * + * @param index Index position of the object return. + * @throws AssemblerException Indexed get is not allowed or otherwise failed. + */ + Object get(int index) throws AssemblyException; + + /** Returns the result which was calculated by calling endContext() or reportStatement(). + * Its the handler's responsibility to care that any of these two methods was called. + * + * This is used by sub-Contexts to access this Context's result. + * + * @return + */ + Object getResult(); + + /** Gives this Context a unique id. For convenience the id may be null which means + * that no id exists at all. + * + * @param id + */ + void setId(String id); + + /** Returns this Context's unique id or null if does not have such an id. + * + * @return This Context's id or null. + */ + String getId(); + + /** Returns whether this Context is a statement (not returning result back + * to parent handler's Context) or not (= expression). + * + * @return + */ + boolean isStatement(); + + /** Sets whether this Context is a statement or not. + * + * @param b + */ + void setStatement(boolean b); +} diff --git a/libjava/gnu/java/beans/decoder/DecoderContext.java b/libjava/gnu/java/beans/decoder/DecoderContext.java new file mode 100644 index 0000000..42700e6 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/DecoderContext.java @@ -0,0 +1,124 @@ +/* gnu.java.beans.decoder.DecoderContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.XMLDecoder; +import java.util.ArrayList; +import java.util.Iterator; + +/** DecoderContext is a Context implementation which allows access to + * the XMLDecoder instance itself. This is used for the <java> tag. + * + * @author Robert Schuster + */ +public class DecoderContext extends AbstractContext +{ + private XMLDecoder decoder; + + public DecoderContext(XMLDecoder xmlDecoder) + { + decoder = xmlDecoder; + } + + private ArrayList objects = new ArrayList(); + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + objects.add(o); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#reportStatement() + */ + public void notifyStatement(Context outerContext) throws AssemblyException + { + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public Object endContext(Context outerContext) throws AssemblyException + { + return decoder; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + return false; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object) + */ + public void set(int index, Object o) throws AssemblyException + { + throw new AssemblyException(new IllegalArgumentException("Set method is not allowed in decoder context.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#get(int) + */ + public Object get(int index) throws AssemblyException + { + throw new AssemblyException(new IllegalArgumentException("Get method is not allowed in decoder context.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#getResult() + */ + public Object getResult() + { + return decoder; + } + + /** Returns an Iterator that retrieves the assembled objects. + * + * @return An Iterator retrieving assembled objects. + */ + public Iterator iterator() + { + return objects.iterator(); + } + +} diff --git a/libjava/gnu/java/beans/decoder/DefaultExceptionListener.java b/libjava/gnu/java/beans/decoder/DefaultExceptionListener.java new file mode 100644 index 0000000..bb20095 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/DefaultExceptionListener.java @@ -0,0 +1,57 @@ +/* gnu.java.beans.DefaultExceptionListener + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +/** The DefaultExceptionListener is the default implementation of the ExceptionListener + * interface. An instance of this class is used whenever the user provided no + * ExceptionListener instance on its own. + * + * <p>The implementation just writes the exception's message to <code>System.err</code>.</p> + * + * @author Robert Schuster + */ +public class DefaultExceptionListener implements ExceptionListener +{ + public void exceptionThrown(Exception e) + { + System.err.println("non-critical exception: " + e + " - message: " + + e.getMessage()); + } +} diff --git a/libjava/gnu/java/beans/decoder/DoubleHandler.java b/libjava/gnu/java/beans/decoder/DoubleHandler.java new file mode 100644 index 0000000..ae0f18f --- /dev/null +++ b/libjava/gnu/java/beans/decoder/DoubleHandler.java @@ -0,0 +1,59 @@ +/* gnu.java.beans.decoder.DoubleHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Double instance from the character data in a <double> tag. + * + * @author Robert Schuster + */ +class DoubleHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + DoubleHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws NumberFormatException + { + return Double.valueOf(number); + } +} diff --git a/libjava/gnu/java/beans/decoder/DummyContext.java b/libjava/gnu/java/beans/decoder/DummyContext.java new file mode 100644 index 0000000..55851dd --- /dev/null +++ b/libjava/gnu/java/beans/decoder/DummyContext.java @@ -0,0 +1,116 @@ +/* gnu.java.beans.decoder.DummyContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +/** The DummyContext is used as the Context implementation for the DummyHandler. It + * just prevents having a null-reference. + * + * <p>When the implementation is correct none of this class' methods + * (except <code>notifyStatement()</code>) is called.</p> + * + * @author Robert Schuster + */ +public class DummyContext extends AbstractContext +{ + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#reportStatement() + */ + public void notifyStatement(Context outerContext) throws AssemblyException + { + // intentionally ignored + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public Object endContext(Context outerContext) throws AssemblyException + { + fail(); + return null; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + fail(); + return false; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object) + */ + public void set(int index, Object o) throws AssemblyException + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#get(int) + */ + public Object get(int index) throws AssemblyException + { + fail(); + return null; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#getResult() + */ + public Object getResult() + { + fail(); + return null; + } + + private void fail() + { + throw new InternalError("Invoking the DummyContext is not expected" + + " - Please file a bug report at" + + " http://www/gnu.org/software/classpath/."); + } +} diff --git a/libjava/gnu/java/beans/decoder/DummyHandler.java b/libjava/gnu/java/beans/decoder/DummyHandler.java new file mode 100644 index 0000000..81fb2f8 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/DummyHandler.java @@ -0,0 +1,156 @@ +/* gnu.java.beans.decoder.DummyHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +import org.xml.sax.Attributes; + +/** An ElementHandler implementation that is used as an artificial root + * element. This avoids having to check for a null element. + * + * @author Robert Schuster + */ +class DummyHandler implements ElementHandler +{ + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#start(org.xml.sax.Attributes, java.beans.ExceptionListener) + */ + public void start( + Attributes attributes, + ExceptionListener exceptionListener) + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#end(java.beans.ExceptionListener) + */ + public void end(ExceptionListener exceptionListener) + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#characters(char[], int, int) + */ + public void characters(char[] ch, int start, int length) + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#isSubelementAllowed(java.lang.String) + */ + public boolean isSubelementAllowed(String subElementName) + { + return true; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#instantiateClass(java.lang.String) + */ + public Class instantiateClass(String className) + throws ClassNotFoundException + { + fail(); + return null; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#reportStatement(java.beans.ExceptionListener) + */ + public void notifyStatement(ExceptionListener exceptionListener) + { + // ignore + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#hasFailed() + */ + public boolean hasFailed() + { + return false; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#getContext() + */ + public Context getContext() + { + return new DummyContext(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#contextFailed() + */ + public void notifyContextFailed() + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#putObject(java.lang.String, java.lang.Object) + */ + public void putObject(String objectId, Object o) + { + fail(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.ElementHandler#getObject(java.lang.String) + */ + public Object getObject(String objectId) + { + fail(); + return null; + } + + public ElementHandler getParent() + { + fail(); + return null; + } + + private void fail() + { + throw new InternalError("Invoking the DummyHandler is not expected" + + " - Please file a bug report at " + + " http://www.gnu.org/software/classpath/."); + } +} diff --git a/libjava/gnu/java/beans/decoder/ElementHandler.java b/libjava/gnu/java/beans/decoder/ElementHandler.java new file mode 100644 index 0000000..b3d720c --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ElementHandler.java @@ -0,0 +1,130 @@ +/* gnu.java.beans.decoder.ElementHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +import org.xml.sax.Attributes; + +/** ElementHandler manages a Context instance and interacts with + * its parent and child handlers. + * + * @author Robert Schuster + */ +interface ElementHandler +{ + /** Evaluates the attributes and creates a Context instance. + * If the creation of the Context instance fails the ElementHandler + * is marked as failed which may affect the parent handler other. + * + * @param attributes Attributes of the XML tag. + */ + void start(Attributes attributes, ExceptionListener exceptionListener); + + /** Post-processes the Context. + */ + void end(ExceptionListener exceptionListener); + + /** Adds characters from the body of the XML tag to the buffer. + * + * @param ch + * @param start + * @param length + * @throws SAXException + */ + void characters(char[] ch, int start, int length); + + /** Returns whether a subelement of the given name is allowed. The rules + * for evaluating this are derived from the javabeans.dtd which can be found + * here: <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3">Java Persistence Article</a>. + * + * @param subElementName + * @return + */ + boolean isSubelementAllowed(String subElementName); + + /** Provides the same functionality as Class.forName() but allows the decoder + * to use a different class loader. + * + * @param className + * @return + * @throws ClassNotFoundException + */ + Class instantiateClass(String className) throws ClassNotFoundException; + + /** Notifies the handler's Context that its child Context will not return + * a value back. Some Context variants need this information to know when + * a method or a constructor call can be made. + * + * This method is called by a child handler. + */ + void notifyStatement(ExceptionListener exceptionListener); + + /** Returns whether this handler has failed. + * + * This is used to skip child elements. + * + * @return Whether this handler has failed. + */ + boolean hasFailed(); + + /** Returns the Context instance this handler is working on. + * + * @return The handler's Context instance. + */ + Context getContext(); + + /** Notifies the handler that its Context failed and starts a recursive + * invocation of the parent handler if it is affected by that failure. + * + * Although the method is a public API member it is only used internally. + */ + void notifyContextFailed(); + + /** Stores the object under the given id. The object is not stored if the + * id is null. + * + * @param objectId + * @param o + */ + void putObject(String objectId, Object o); + + Object getObject(String objectId) throws AssemblyException; + + ElementHandler getParent(); +} diff --git a/libjava/gnu/java/beans/decoder/FloatHandler.java b/libjava/gnu/java/beans/decoder/FloatHandler.java new file mode 100644 index 0000000..d930aea --- /dev/null +++ b/libjava/gnu/java/beans/decoder/FloatHandler.java @@ -0,0 +1,59 @@ +/* gnu.java.beans.decoder.FloatHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Float instance from the character data in a <float> tag. + * + * @author Robert Schuster + */ +class FloatHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + FloatHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws NumberFormatException + { + return Float.valueOf(number); + } +} diff --git a/libjava/gnu/java/beans/decoder/GrowableArrayContext.java b/libjava/gnu/java/beans/decoder/GrowableArrayContext.java new file mode 100644 index 0000000..9719890 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/GrowableArrayContext.java @@ -0,0 +1,138 @@ +/* gnu.java.beans.decoder.GrowableArrayContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ +package gnu.java.beans.decoder; + +import java.lang.reflect.Array; + +/** A Context implementation for a growable array. The array + * elements have to be set using expressions. + * + * @author Robert Schuster + */ +class GrowableArrayContext extends AbstractContext +{ + private static final int INITIAL_SIZE = 16; + + private Class klass; + private Object array; + private int length; + + GrowableArrayContext(String id, Class newClass) + { + setId(id); + klass = newClass; + array = Array.newInstance(klass, INITIAL_SIZE); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + if (length == Array.getLength(array)) + { + Object tmp = Array.newInstance(klass, length * 2); + System.arraycopy(array, 0, tmp, 0, length); + array = tmp; + } + + try { + Array.set(array, length++, o); + } catch(IllegalArgumentException iae) { + throw new AssemblyException(iae); + } + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#reportStatement() + */ + public void notifyStatement(Context outerContext) throws AssemblyException + { + throw new AssemblyException( + new IllegalArgumentException("Statements inside a growable array are not allowed.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public Object endContext(Context outerContext) throws AssemblyException + { + if (length != Array.getLength(array)) + { + Object tmp = Array.newInstance(klass, length); + System.arraycopy(array, 0, tmp, 0, length); + array = tmp; + } + + return array; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + // returns false to indicate that assembling the array does not fail only because + // a subelement failed + return false; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object) + */ + public void set(int index, Object o) throws AssemblyException + { + try { + Array.set(array, index, o); + } catch(IllegalArgumentException iae) { + throw new AssemblyException(iae); + } + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#get(int) + */ + public Object get(int index) throws AssemblyException + { + return Array.get(array, index); + } + + public Object getResult() + { + return array; + } +} diff --git a/libjava/gnu/java/beans/decoder/IndexContext.java b/libjava/gnu/java/beans/decoder/IndexContext.java new file mode 100644 index 0000000..be67ee5 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/IndexContext.java @@ -0,0 +1,130 @@ +/* gnu.java.beans.decoder.IndexContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +/** IndexContext is Context implementation that senses whether it is an indexed get or set + * operation and invokes this operation. + * + * <p>An IndexContent is a get operation when no argument is provided and a set operation if one + * argument is provided.</p> + * + * @author Robert Schuster + */ +class IndexContext extends AbstractContext +{ + private Object result; + private Object argument; + private int index; + private boolean isSetter; + + IndexContext(String id, int newIndex) + { + setId(id); + index = newIndex; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + if (! isSetter) + { + argument = o; + isSetter = true; + } + else + throw new AssemblyException(new IllegalStateException("More than one argument for indiced access is not possible.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#reportStatement() + */ + public void notifyStatement(Context outerContext) throws AssemblyException + { + throw new AssemblyException(new IllegalStateException("Statements inside indiced access are not allowed.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public Object endContext(Context outerContext) throws AssemblyException + { + if (isSetter) + { + // setter + outerContext.set(index, argument); + + return null; + } + else + // getter + return result = outerContext.get(index); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + // returns true to indicate that indiced access assembly fails when one of its + // argument could not be assembled + return true; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#set(int, java.lang.Object) + */ + public void set(int index, Object o) throws AssemblyException + { + throw new AssemblyException(new IllegalStateException("Setter is not allowed inside indiced access.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#get(int) + */ + public Object get(int index) throws AssemblyException + { + throw new AssemblyException(new IllegalStateException("getter is not allowed insided indiced access.")); + } + + public Object getResult() + { + return result; + } +} diff --git a/libjava/gnu/java/beans/decoder/IntHandler.java b/libjava/gnu/java/beans/decoder/IntHandler.java new file mode 100644 index 0000000..e04f959 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/IntHandler.java @@ -0,0 +1,59 @@ +/* gnu.java.beans.decoder.IntHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Integer instance from the character data in a <int> tag. + * + * @author Robert Schuster + */ +class IntHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + IntHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws NumberFormatException + { + return Integer.valueOf(number); + } +} diff --git a/libjava/gnu/java/beans/decoder/JavaHandler.java b/libjava/gnu/java/beans/decoder/JavaHandler.java new file mode 100644 index 0000000..e0a7862 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/JavaHandler.java @@ -0,0 +1,93 @@ +/* gnu.java.beans.decoder.JavaHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; +import java.util.HashMap; + +import org.xml.sax.Attributes; + +/** Wraps a DecoderContext instance. + * + * @author Robert Schuster + */ +public class JavaHandler extends AbstractElementHandler +{ + private Context context; + private HashMap objectMap = new HashMap(); + private ClassLoader classLoader; + + /** + * @param PersistenceParser + */ + JavaHandler(DummyHandler parent, Context decoderContext, + ClassLoader cl) + { + super(parent, true); + + classLoader = cl; + + context = decoderContext; + + } + + protected Context startElement(Attributes attributes, ExceptionListener exceptionListener) + throws AssemblyException + { + // may expect version and class attribute but it not used in JDK + // so we do either + return context; + } + + public Object getObject(String objectId) + { + return objectMap.get(objectId); + } + + public void putObject(String objectId, Object o) + { + if (objectId != null) + objectMap.put(objectId, o); + } + + public Class instantiateClass(String className) + throws ClassNotFoundException + { + return Class.forName(className, false, classLoader); + } +} diff --git a/libjava/gnu/java/beans/decoder/LongHandler.java b/libjava/gnu/java/beans/decoder/LongHandler.java new file mode 100644 index 0000000..e61726c --- /dev/null +++ b/libjava/gnu/java/beans/decoder/LongHandler.java @@ -0,0 +1,59 @@ +/* gnu.java.beans.decoder.LongHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Creates a Long instance from the character data in a <long> tag. + * + * @author Robert Schuster + */ +class LongHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + LongHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws NumberFormatException + { + return Long.valueOf(number); + } +} diff --git a/libjava/gnu/java/beans/decoder/MethodContext.java b/libjava/gnu/java/beans/decoder/MethodContext.java new file mode 100644 index 0000000..2f951e4 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/MethodContext.java @@ -0,0 +1,107 @@ +/* gnu.java.beans.decoder.MethodContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ +package gnu.java.beans.decoder; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +/** MethodContext collects arguments for a method call and creates the result object + * using it. The method is called using the result object of the parent Context. + * + * <p>When the result object is available methods can be called on it using sub-Contexts.</p> + * + * @author Robert Schuster + */ +class MethodContext extends AbstractCreatableObjectContext +{ + private ArrayList arguments = new ArrayList(); + private String methodName; + + MethodContext(String id, String newMethodName) + { + setId(id); + setStatement(true); + methodName = newMethodName; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObjectImpl(Object o) + { + arguments.add(o); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + protected Object createObject(Context outerContext) + throws AssemblyException + { + Object outerObject = outerContext.getResult(); + + if (outerObject == null) + throw new AssemblyException( + new NullPointerException( + "No object to invoke method " + methodName)); + + Object[] args = arguments.toArray(); + + try + { + Method method = + MethodFinder.getMethod( + outerObject.getClass(), + methodName, + args); + return method.invoke(outerObject, args); + } + catch (NoSuchMethodException nsme) + { + throw new AssemblyException(nsme); + } + catch (InvocationTargetException ite) + { + throw new AssemblyException(ite.getCause()); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } +} diff --git a/libjava/gnu/java/beans/decoder/MethodFinder.java b/libjava/gnu/java/beans/decoder/MethodFinder.java new file mode 100644 index 0000000..ad3d222 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/MethodFinder.java @@ -0,0 +1,177 @@ +/* gnu.java.beans.decoder.MethodFinder + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.lang.reflect.Constructor; +import java.lang.reflect.Method; +import java.util.HashMap; + +class MethodFinder +{ + /** Provides a mapping between a wrapper class and its corresponding primitive's type. */ + private static HashMap typeMapping = new HashMap(); + + static { + typeMapping.put(Byte.class, Byte.TYPE); + typeMapping.put(Short.class, Short.TYPE); + typeMapping.put(Integer.class, Integer.TYPE); + typeMapping.put(Long.class, Long.TYPE); + typeMapping.put(Float.class, Float.TYPE); + typeMapping.put(Double.class, Double.TYPE); + + typeMapping.put(Character.class, Character.TYPE); + typeMapping.put(Boolean.class, Boolean.TYPE); + } + + private MethodFinder() + { + } + + /** Searches a Method which can accept the given arguments. + * + * @param klass + * @param name + * @param arguments + * @return + * @throws NoSuchMethodException + */ + static Method getMethod(Class klass, String name, Object[] arguments) + throws NoSuchMethodException + { + // prepares array containing the types of the arguments + Class[] argumentTypes = getArgumentTypes(arguments); + + Method[] methods = klass.getMethods(); + + // iterates over all public methods + for (int i = 0; i < methods.length; i++) + { + if (methods[i].getName().equals(name)) + { + if (matchingArgumentTypes(methods[i].getParameterTypes(), + argumentTypes)) + return methods[i]; + } + } + + throw new NoSuchMethodException( + "Could not find a matching method named " + + name + + "() in class " + + klass); + } + + static Constructor getConstructor(Class klass, Object[] arguments) + throws NoSuchMethodException + { + Class[] argumentTypes = getArgumentTypes(arguments); + Constructor[] constructors = klass.getConstructors(); + + // iterates over all public methods + for (int i = 0; i < constructors.length; i++) + { + if (matchingArgumentTypes(constructors[i].getParameterTypes(), + argumentTypes)) + return constructors[i]; + } + + throw new NoSuchMethodException( + "Could not find a matching constructor in class " + klass); + } + + /** Transforms an array of argument objects into an array of argument types. + * For each argument being null the argument is null, too. An argument type + * being null means: Accepts everything (although this can be ambigous). + * + * @param arguments + * @return + */ + private static Class[] getArgumentTypes(Object[] arguments) + { + if (arguments == null) + return new Class[0]; + + // prepares array containing the types of the arguments + Class[] argumentTypes = new Class[arguments.length]; + for (int i = 0; i < arguments.length; i++) + argumentTypes[i] = + (arguments[i] == null) ? null : arguments[i].getClass(); + return argumentTypes; + } + + /** Tests whether the argument types supplied to the method argument types + * are assignable. In addition to the assignment specifications this method + * handles the primitive's wrapper classes as if they were of their + * primitive type (e.g Boolean.class equals Boolean.TYPE). + * When a supplied argument type is null it is assumed that no argument + * object was supplied for it and the test for this particular parameter will + * pass. + * + * @param methodArgTypes + * @param suppliedArgTypes + * @return + */ + private static boolean matchingArgumentTypes( + Class[] methodArgTypes, + Class[] suppliedArgTypes) + { + if (methodArgTypes.length != suppliedArgTypes.length) + return false; + + for (int i = 0; i < methodArgTypes.length; i++) + { + if (suppliedArgTypes[i] == null) + { + // by definition a non-existant argument type (null) can be converted to everything + continue; + } + else if (typeMapping.containsKey(suppliedArgTypes[i])) + { + Class primitiveType = + (Class) typeMapping.get(suppliedArgTypes[i]); + if (!(methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i]) + || methodArgTypes[i].isAssignableFrom(primitiveType))) + return false; + } + else if (!methodArgTypes[i].isAssignableFrom(suppliedArgTypes[i])) + return false; + } + + return true; + } +} diff --git a/libjava/gnu/java/beans/decoder/NullHandler.java b/libjava/gnu/java/beans/decoder/NullHandler.java new file mode 100644 index 0000000..60a87c3 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/NullHandler.java @@ -0,0 +1,62 @@ +/* gnu.java.beans.decoder.NullHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + + +/** Just provides the 'null' object. + * + * @author Robert Schuster + */ +class NullHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + NullHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String characters) throws AssemblyException + { + if (! characters.equals("")) + throw new AssemblyException(new IllegalArgumentException("No characters inside <void> tag allowed.")); + + return null; + } +} diff --git a/libjava/gnu/java/beans/decoder/ObjectContext.java b/libjava/gnu/java/beans/decoder/ObjectContext.java new file mode 100644 index 0000000..81b270a --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ObjectContext.java @@ -0,0 +1,100 @@ +/* gnu.java.beans.decoder.ObjectHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +/** ObjectContext is a {@link Context} implementation that wraps a simple Object instance. + * The instance can be provided when the Context is created (due to an 'idref' + * attribute) or later (eg. <int> tag) + * + * <p>The ObjectContext does not accept any parameter object and ignores notifications + * about sub-contexts being statements.</p> + * + * @author Robert Schuster + */ +final class ObjectContext extends AbstractObjectContext +{ + ObjectContext(Object newObject) + { + setObject(newObject); + } + + ObjectContext(String id, Object newObject) + { + setId(id); + setObject(newObject); + } + + ObjectContext() + { + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + throw new AssemblyException(new IllegalArgumentException("Adding objects to an ObjectContext is not allowed.")); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#reportStatement() + */ + public void notifyStatement(Context outerContext) throws AssemblyException + { + // can ignore that + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public Object endContext(Context outerContext) throws AssemblyException + { + // just returns the object which is encapsuled (may be null) + return getResult(); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#subContextFailed() + */ + public boolean subContextFailed() + { + // this context will not fail when a subcontext fails because the result is + // already available when the context is created. + return false; + } +} diff --git a/libjava/gnu/java/beans/decoder/ObjectHandler.java b/libjava/gnu/java/beans/decoder/ObjectHandler.java new file mode 100644 index 0000000..801dc74 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ObjectHandler.java @@ -0,0 +1,169 @@ +/* gnu.java.beans.decoder.ObjectHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +import org.xml.sax.Attributes; + +/** An ObjectHandler parses the <object> tag and thereby creates various + * Context implementations. + * + * @author Robert Schuster + * + */ +public class ObjectHandler extends AbstractElementHandler +{ + /** + * XXX: Can all results be stored with an object id? + * + * + * @param PersistenceParser + */ + ObjectHandler(ElementHandler parent) + { + super(parent, true); + } + + protected Context startElement(Attributes attributes, ExceptionListener exceptionListener) + throws AssemblyException + { + String className = attributes.getValue("class"); + String methodName = attributes.getValue("method"); + String fieldName = attributes.getValue("field"); + String index = attributes.getValue("index"); + String propertyName = attributes.getValue("property"); + String id = attributes.getValue("id"); + String idRef = attributes.getValue("idref"); + + /* first check if we just want to access an existing object (idref present) + * + * note: <object idref="foo" method="bar"/> is not valid to call method "bar" + * on the object with id "foo". Instead this should return the object "foo" + * itself. The right way to this is: + * <object idref="foo"> + * <object method="bar"/> + * </object> + * + * This means that if idref is present class, method, field, index and + * property are obsolete. + */ + if (idRef != null) + // reactivates an existing object and giving it another name if id exists + return new ObjectContext(id, getObject(idRef)); + + // decides whether we are in a static (className present) or dynamic context + if (className != null) + { + try + { + Class klass = instantiateClass(className); + + // class name exists which means that we are in a static context. + // so we may want to ... + // access a static field if the fieldName exists + if (fieldName != null) + { + try + { + return new ObjectContext(id, + klass.getField(fieldName).get(null)); + } + catch (NoSuchFieldException nsfe) + { + throw new AssemblyException(nsfe); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } + + // (falling through is important!) + // run a constructor if methodName is "new" or null + if (methodName == null || methodName.equals("new")) + return new ConstructorContext(id, klass); + + // (falling through is important!) + // run a static method on the given class (if methodName exists, which is implied already) + return new StaticMethodContext(id, klass, methodName); + // XXX: should fail if unexpected attributes are present? + } + catch (ClassNotFoundException cnfe) + { + throw new AssemblyException(cnfe); + } + } + else + { + // className does not exist which means we are in the context of + // some object and want to ... + // access the get(int index) method if index != null + if (index != null) + { + try + { + // Note: http://java.sun.com/products/jfc/tsc/articles/persistence3/ says + // that <void index="4"/> will make up a get()-call. But this is wrong because + // <void/> tags never return values (to the surrounding context) + return new IndexContext(id, Integer.parseInt(index)); + } + catch (NumberFormatException nfe) + { + throw new AssemblyException(nfe); + } + } + + // access a method if methodName exists + if (methodName != null) + return new MethodContext(id, methodName); + + // (falling through is important!) + // access a property if a propertyName exists + if (propertyName != null && propertyName.length() > 0) + // this is reported as an ordinary method access where the propertyName is + // converted into a 'getter'-method name: convert first character of property name + // to upper case and prepend 'get' + // Note: This will be a getter-method because the <object> tag implies that a return + // value is expected. + return new PropertyContext(id, propertyName); + } + + throw new AssemblyException(new IllegalArgumentException("Wrong or missing attributes for <object> tag.")); + } +} diff --git a/libjava/gnu/java/beans/decoder/PersistenceParser.java b/libjava/gnu/java/beans/decoder/PersistenceParser.java new file mode 100644 index 0000000..3315478 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/PersistenceParser.java @@ -0,0 +1,484 @@ +/* gnu.java.beans.PersistenceParser + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; +import java.beans.XMLDecoder; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.parsers.SAXParser; +import javax.xml.parsers.SAXParserFactory; + +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +import org.xml.sax.helpers.DefaultHandler; + +/** The PersistenceParser parses an XML data stream and delegates actions to ElementHandler + * instances. The parser catches and recovers from all exception which reside from wrong usage + * of attributes and tags. + * + * @author Robert Schuster + */ +public class PersistenceParser extends DefaultHandler implements Context +{ + /** The ExceptionListener instance which is informed of non-critical parsing exceptions. + */ + private ExceptionListener exceptionListener; + + /** When an element was not usable all elements inside it should be skipped. + * This is done by skipping startElement() and endElement() invocations whenever + * this value is above 0. + */ + private int skipElement; + + /** Stores the Creator instances which can instantiate the appropriate handler implementation + * for a given element. + */ + private HashMap handlerCreators = new HashMap(); + + /** Denotes the current ElementHandler. To avoid checking for null-values it is pre-assigned + * with a DummyHandler instance which must not be used but acts as a root element. + */ + private ElementHandler currentHandler; + + /** The real root element that stores all objects created during parsing. + */ + private JavaHandler javaHandler; + + /** Stores the decoded objects. */ + private List objects = new LinkedList(); + + /** The XMLDecoder instance that started this PersistenceParser */ + private XMLDecoder decoder; + + /** Creates a PersistenceParser which reads XML data from the given InputStream, reports + * exceptions to ExceptionListener instance, stores resulting object in the DecoderContext + * and uses the given ClassLoader to resolve classes. + * + * @param inputStream + * @param exceptionListener + * @param decoderContext + * @param cl + */ + public PersistenceParser( + InputStream inputStream, + ExceptionListener exceptionListener, + ClassLoader cl, + XMLDecoder decoder) + { + + this.exceptionListener = exceptionListener; + this.decoder = decoder; + + DummyHandler dummyHandler = new DummyHandler(); + currentHandler = dummyHandler; + javaHandler = new JavaHandler(dummyHandler, this, cl); + + SAXParserFactory factory = SAXParserFactory.newInstance(); + + SAXParser parser; + try + { + parser = factory.newSAXParser(); + } + catch (ParserConfigurationException pce) + { + // should not happen when a parser is available because we did + // not request any requirements on the XML parser + throw (InternalError) new InternalError( + "No SAX Parser available.").initCause( + pce); + } + catch (SAXException saxe) + { + // should not happen when a parser is available because we did + // not request any requirements on the XML parser + throw (InternalError) new InternalError( + "No SAX Parser available.").initCause( + saxe); + } + + // prepares a map of Creator instances which can instantiate a handler which is + // appropriate for the tag that is used as a key for the Creator + handlerCreators.put("java", new JavaHandlerCreator()); + + // calls methods (properties), constructors, access fields + handlerCreators.put("object", new ObjectHandlerCreator()); + handlerCreators.put("void", new VoidHandlerCreator()); + + handlerCreators.put("array", new ArrayHandlerCreator()); + + // these handler directly create an Object (or null) + handlerCreators.put("class", new ClassHandlerCreator()); + handlerCreators.put("null", new NullHandlerCreator()); + + handlerCreators.put("char", new CharHandlerCreator()); + handlerCreators.put("string", new StringHandlerCreator()); + handlerCreators.put("boolean", new BooleanHandlerCreator()); + handlerCreators.put("byte", new ByteHandlerCreator()); + handlerCreators.put("short", new ShortHandlerCreator()); + handlerCreators.put("int", new IntHandlerCreator()); + handlerCreators.put("long", new LongHandlerCreator()); + handlerCreators.put("float", new FloatHandlerCreator()); + handlerCreators.put("double", new DoubleHandlerCreator()); + + // parses the data and sends all exceptions to the ExceptionListener + try + { + parser.parse(inputStream, this); + } + catch (SAXException saxe) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException("XML data not well-formed.")); + } + catch (IOException ioe) + { + exceptionListener.exceptionThrown(ioe); + } + } + + public void startElement( + String uri, + String localName, + String qName, + Attributes attributes) + throws SAXException + { + /* The element is skipped if + * a) the current handler has already failed or a previous error occured + * which makes all children obsolete + */ + if (currentHandler.hasFailed() || skipElement > 0) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException( + "Element unusable due to previous error: " + qName)); + + skipElement++; + + return; + } + + /* b) Subelements are not allowed within the current ElementHandler. + */ + if (!currentHandler.isSubelementAllowed(qName)) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException( + "Element is not allowed here: " + qName)); + + skipElement++; + + return; + } + + /* c) The tag name is not a key in the map of Creator instances. This means that + * either the XML data is of a newer version or simply contains a miss-spelled element. + */ + if (!handlerCreators.containsKey(qName)) + { + exceptionListener.exceptionThrown( + new IllegalArgumentException( + "Element unusable because tag is unknown: " + qName)); + + skipElement++; + + return; + } + + // creates a new handler for the new element + AbstractElementHandler handler = + ((Creator) handlerCreators.get(qName)).createHandler( + currentHandler); + + // makes it the current handler to receive character data + currentHandler = handler; + + // starts the handler + currentHandler.start(attributes, exceptionListener); + } + + public void endElement(String uri, String localName, String qName) + throws SAXException + { + // skips processing the current handler if we are parsing an element + // which was marked invalid (in startElement() ) + if (skipElement > 0) + { + skipElement--; + return; + } + + // invokes the handler's finishing method + currentHandler.end(exceptionListener); + + // removes the current handler and reactivates its parent + currentHandler = currentHandler.getParent(); + } + + /** Transfers character data to the current handler + */ + public void characters(char[] ch, int start, int length) + throws SAXException + { + // prevents sending character data of invalid elements + if (skipElement > 0) + return; + + currentHandler.characters(ch, start, length); + } + + /** Creator interface provided a mechanism to instantiate ElementHandler instances + * for the appropriate tag. + * + * @author Robert Schuster + */ + interface Creator + { + /** Creates an ElementHandler instance using the given ElementHandler as its parent. + * + * @param parent The parent ElementHandler of the result. + * @return A new ElementHandler instance. + */ + AbstractElementHandler createHandler(ElementHandler parent); + } + + class BooleanHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new BooleanHandler(parent); + } + } + + class ByteHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ByteHandler(parent); + } + } + + class ShortHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ShortHandler(parent); + } + } + + class IntHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new IntHandler(parent); + } + } + + class LongHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new LongHandler(parent); + } + } + + class FloatHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new FloatHandler(parent); + } + } + + class DoubleHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new DoubleHandler(parent); + } + } + + class CharHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new CharHandler(parent); + } + } + + class StringHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new StringHandler(parent); + } + } + + class JavaHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return javaHandler; + } + } + + class ObjectHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ObjectHandler(parent); + } + } + + class VoidHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new VoidHandler(parent); + } + } + + class ClassHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ClassHandler(parent); + } + } + + class NullHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new NullHandler(parent); + } + } + + class ArrayHandlerCreator implements Creator + { + public AbstractElementHandler createHandler(ElementHandler parent) + { + return new ArrayHandler(parent); + } + } + + /** Adds a decoded object to the Context. */ + public void addParameterObject(Object o) throws AssemblyException + { + objects.add(o); + } + + public void notifyStatement(Context outerContext) throws AssemblyException + { + // can be ignored because theis Context does not react to statement and expressions + // differently + } + + public Object endContext(Context outerContext) throws AssemblyException + { + return null; + } + + public boolean subContextFailed() + { + // failing of subcontexts is no problem for the mother of all contexts + return false; + } + + public void set(int index, Object o) throws AssemblyException + { + // not supported + throw new AssemblyException( + new IllegalArgumentException("Set method is not allowed in decoder context.")); + } + + public Object get(int index) throws AssemblyException + { + // not supported + throw new AssemblyException( + new IllegalArgumentException("Get method is not allowed in decoder context.")); + } + + public Object getResult() + { + // returns the XMLDecoder instance which is requested by child contexts this way. + // That is needed to invoke methods on the decoder. + return decoder; + } + + public void setId(String id) + { + exceptionListener.exceptionThrown(new IllegalArgumentException("id attribute is not allowed for <java> tag.")); + } + + public String getId() + { + // appears to have no id + return null; + } + + public boolean isStatement() + { + // this context is a statement by definition because it never returns anything to a parent because + // there is no such parent (DummyContext does not count!) + return true; + } + + public void setStatement(boolean b) + { + // ignores that because this Context is always a statement + } + + /** Returns an Iterator instance which returns the decoded objects. + * + * This method is used by the XMLDecoder directly. + */ + public Iterator iterator() + { + return objects.iterator(); + } + +} diff --git a/libjava/gnu/java/beans/decoder/PropertyContext.java b/libjava/gnu/java/beans/decoder/PropertyContext.java new file mode 100644 index 0000000..5478576 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/PropertyContext.java @@ -0,0 +1,137 @@ +/* gnu.java.beans.decoder.PropertyContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** PropertyContext is a Context implementation that is very similar to MethodContext + * and IndexContext. The sole purpose of PropertyContext to find out whether it should + * 'set' or 'get' a certain property. This decision is made using the number of + * arguments. + * <p>When the method call has to be made and there is no argument we 'get' the property. + * With one argument it is 'set'.</p> + * + * @author Robert Schuster + */ +class PropertyContext extends AbstractObjectContext +{ + private Object argument; + private String propertyName; + private String prefix = "get"; + private boolean methodCalled; + + PropertyContext(String id, String newPropertyName) + { + setId(id); + propertyName = newPropertyName; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObject(Object o) throws AssemblyException + { + if (methodCalled) + throw new AssemblyException(new IllegalArgumentException("Cannot add parameter object when method was already called.")); + + if (argument != null) + throw new AssemblyException(new IllegalArgumentException("Property attribut allows zero or one argument only.")); + + argument = o; + setStatement(true); + prefix = "set"; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + public void notifyStatement(Context outerContext) throws AssemblyException + { + if (methodCalled) + return; + methodCalled = true; + + Object outerObject = outerContext.getResult(); + + if (outerObject == null) + throw new AssemblyException(new NullPointerException("No object to access property " + + propertyName)); + + + // converts property name into a method name + String methodName = prefix + propertyName.substring(0, 1).toUpperCase() + + propertyName.substring(1); + + // prepares the argument + Object[] args = (argument != null) ? new Object[] { argument } : null; + + try + { + Method method = MethodFinder.getMethod(outerObject.getClass(), + methodName, args); + + // stores the result whether it is available or not + setObject(method.invoke(outerObject, args)); + } + catch (NoSuchMethodException nsme) + { + throw new AssemblyException(nsme); + } + catch (InvocationTargetException ite) + { + throw new AssemblyException(ite.getCause()); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } + + public Object endContext(Context outerContext) throws AssemblyException + { + notifyStatement(outerContext); + + return getResult(); + } + + public boolean subContextFailed() + { + return ! methodCalled; + } +} diff --git a/libjava/gnu/java/beans/decoder/ShortHandler.java b/libjava/gnu/java/beans/decoder/ShortHandler.java new file mode 100644 index 0000000..8ac74a1 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/ShortHandler.java @@ -0,0 +1,58 @@ +/* gnu.java.beans.decoder.ShortHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +/** Creates a Short instance from the character data in a <short> tag. + * + * @author Robert Schuster + */ +class ShortHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + ShortHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String number) throws NumberFormatException + { + return Short.valueOf(number); + } +} diff --git a/libjava/gnu/java/beans/decoder/SimpleHandler.java b/libjava/gnu/java/beans/decoder/SimpleHandler.java new file mode 100644 index 0000000..14b5b9a --- /dev/null +++ b/libjava/gnu/java/beans/decoder/SimpleHandler.java @@ -0,0 +1,111 @@ +/* gnu.java.beans.decoder.SimpleHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +import org.xml.sax.Attributes; + +/** XML element handler that is specialized on tags that contains a simple string in their + * body which has to be parsed in a specific way. + * <p>All of these tags have in common that they do not accept attributes. A warning is + * send to the parser's ExceptionListener when one or more attributes exist.</p> + * + * @author Robert Schuster + */ +abstract class SimpleHandler extends AbstractElementHandler +{ + private ObjectContext context; + + /** + * @param PersistenceParser + */ + SimpleHandler(ElementHandler parent) + { + super(parent, false); + + // SimpleHandler do not accept any subelements + } + + protected final Context startElement(Attributes attributes, ExceptionListener exceptionListener) + throws AssemblyException + { + + // note: simple elements should not have any attributes. We inform + // the user of this syntactical but uncritical problem by sending + // an IllegalArgumentException for each unneccessary attribute + int size = attributes.getLength(); + for (int i = 0; i < size; i++) { + String attributeName = attributes.getQName(i); + Exception e = + new IllegalArgumentException( + "Unneccessary attribute '" + + attributeName + + "' discarded."); + exceptionListener.exceptionThrown(e); + } + + return context = new ObjectContext(); + } + + public void endElement(String characters) + throws AssemblyException, AssemblyException + { + // reports the number when the character data can be parsed + try + { + context.setObject(parse(characters)); + } + catch (NumberFormatException nfe) + { + throw new AssemblyException(nfe); + } + } + + /** Returns an object that is created from the given characters. If the string is + * converted into a number a NumberFormatException is cathed and reported + * appropriately. + * + * @param characters A string of characters that has to be processed in some way. + * @return An Object instance generated from the given data. + * @throws AssemblerException When the string was invalid. + * @throws NumberFormatException When the string could not be parsed into a number. + */ + protected abstract Object parse(String characters) + throws AssemblyException, NumberFormatException; +} diff --git a/libjava/gnu/java/beans/decoder/StaticMethodContext.java b/libjava/gnu/java/beans/decoder/StaticMethodContext.java new file mode 100644 index 0000000..407a5d1 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/StaticMethodContext.java @@ -0,0 +1,95 @@ +/* gnu.java.beans.decoder.StaticMethodContext + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.ArrayList; + +/** + * @author Robert Schuster + */ +class StaticMethodContext extends AbstractCreatableObjectContext +{ + private ArrayList arguments = new ArrayList(); + private Class klass; + private String methodName; + + StaticMethodContext(String id, Class newClass, String newMethodName) + { + setId(id); + klass = newClass; + methodName = newMethodName; + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#addObject(java.lang.Object) + */ + public void addParameterObjectImpl(Object o) + { + arguments.add(o); + } + + /* (non-Javadoc) + * @see gnu.java.beans.decoder.Context#endContext(gnu.java.beans.decoder.Context) + */ + protected Object createObject(Context outerContext) + throws AssemblyException + { + Object[] args = arguments.toArray(); + + try + { + Method method = MethodFinder.getMethod(klass, methodName, args); + return method.invoke(null, args); + } + catch (NoSuchMethodException nsme) + { + throw new AssemblyException(nsme); + } + catch (InvocationTargetException ite) + { + // rethrows the reason for the InvocationTargetsException (ie. the exception in the called code) + throw new AssemblyException(ite.getCause()); + } + catch (IllegalAccessException iae) + { + throw new AssemblyException(iae); + } + } +} diff --git a/libjava/gnu/java/beans/decoder/StringHandler.java b/libjava/gnu/java/beans/decoder/StringHandler.java new file mode 100644 index 0000000..3154593 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/StringHandler.java @@ -0,0 +1,54 @@ +/* gnu.java.beans.decoder.StringHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +class StringHandler extends SimpleHandler +{ + /** + * @param PersistenceParser + */ + StringHandler(ElementHandler parent) + { + super(parent); + } + + protected Object parse(String characters) + { + return characters; + } +} diff --git a/libjava/gnu/java/beans/decoder/VoidHandler.java b/libjava/gnu/java/beans/decoder/VoidHandler.java new file mode 100644 index 0000000..cc291d6 --- /dev/null +++ b/libjava/gnu/java/beans/decoder/VoidHandler.java @@ -0,0 +1,140 @@ +/* gnu.java.beans.decoder.VoidHandler + 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.java.beans.decoder; + +import java.beans.ExceptionListener; + +import org.xml.sax.Attributes; + +public class VoidHandler extends AbstractElementHandler +{ + /** + * @param PersistenceParser + */ + VoidHandler(ElementHandler parent) + { + super(parent, true); + } + + protected Context startElement( + Attributes attributes, + ExceptionListener exceptionListener) + throws AssemblyException + { + Context ctx = startElementImpl(attributes); + ctx.setStatement(true); + + return ctx; + } + + private Context startElementImpl(Attributes attributes) + throws AssemblyException + { + String id = attributes.getValue("id"); + String className = attributes.getValue("class"); + String methodName = attributes.getValue("method"); + String propertyName = attributes.getValue("property"); + String index = attributes.getValue("index"); + + if (className != null) + { + try + { + Class klass = instantiateClass(className); + + // class name exists which means that we are in a static context. + // so we may want to ... + // run a constructor if methodName is "new" or null + if (methodName == null || methodName.equals("new")) + // if the id is null the result cannot be by the decoder accessed but the + // constructor may have side effects (e.g. registering itself in a global registry) + return new ConstructorContext(id, klass); + + // (falling through is important!) + // run a static method on the given class (if methodName exists, which is implied already) + return new StaticMethodContext(id, klass, methodName); + } + catch (ClassNotFoundException cnfe) + { + throw new AssemblyException(cnfe); + } + } + else + { + // className does not exist which means we are in the context of + // some object and want to ... + // access an element by index + if (index != null) + { + // note: whether this resolves into get(i) or set(i, o) depends on the + // number of arguments and is decided by the ObjectAssembler + try + { + return new IndexContext(id, Integer.parseInt(index)); + } + catch (NumberFormatException nfe) + { + throw new AssemblyException(nfe); + } + } + + // access a method if methodName exists + if (methodName != null) + return new MethodContext(id, methodName); + + // (falling through is important!) + // access a property if a propertyName exists + if (propertyName != null && propertyName.length() > 0) + // this is reported as an ordinary method invocation where the propertyName is + // converted into a 'setter'-method name: convert first character of property name + // to upper case and prepend 'set' + // Note: This will be a setter-method because the <void> tag implies that no return + // value is expected (but a side effect) + return new PropertyContext(id, propertyName); + } + + // if code reaches this point the tag has wrong attributes. The following test + // does not make it better but can provide are more specific error message for + // a common mistake: <void> tags are not allowed to have an idref attribute + throw new AssemblyException( + new IllegalArgumentException( + (attributes.getValue("idref") == null) + ? "Missing attributes for <void> tag" + : "<void> does not support 'idref' attribute.")); + } +} diff --git a/libjava/java/beans/Beans.java b/libjava/java/beans/Beans.java index 762e4d5..30f6642 100644 --- a/libjava/java/beans/Beans.java +++ b/libjava/java/beans/Beans.java @@ -1,5 +1,5 @@ /* java.beans.Beans - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,23 +35,26 @@ 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 java.beans; +import gnu.java.beans.DummyAppletStub; import gnu.java.io.ClassLoaderObjectInputStream; import java.applet.Applet; +import java.beans.beancontext.BeanContext; import java.io.IOException; -import java.io.InputStream; import java.io.ObjectInputStream; +import java.net.URL; /** * <code>Beans</code> provides some helper methods that allow the basic * operations of Bean-ness. * * @author John Keiser + * @author Robert Schuster + * * @since 1.1 - * @version 1.1.0, 29 Jul 1998 + * @status updated to 1.4 * */ public class Beans @@ -66,196 +69,300 @@ public class Beans */ public Beans() { - // Do nothing here. + // Does intentionally nothing here. } - /** - * Allows you to instantiate a Bean. This method takes - * a ClassLoader from which to read the Bean and the - * name of the Bean.<P> - * - * The Bean name should be a dotted name, like a class. - * It can represent several things. Beans will search - * for the Bean using the name like this:<P> - * <OL> - * <LI>Searches for a serialized instance of the Bean - * using getResource(), mangling the Bean name by - * replacing the dots with slashes and appending .ser - * (for example, gnu.beans.BlahDeBlah would cause - * Beans to search for gnu/beans/BlahDeBlah.ser using - * getResource()).</LI> - * <LI>Searches for the Bean class using the beanName, - * and then instantiates it with the no-arg constructor. - * At that point, if it is an Applet, it provides it - * with AppletContext and AppletStub, and then calls - * init().</LI> - * </OL> - * - * @param cl the ClassLoader to use, or <CODE>null</CODE> - * to use the default ClassLoader. - * @param beanName the name of the Bean. - * - * @return the Bean. - * - * @XXX - */ - public static Object instantiate (ClassLoader cl, String beanName) - throws IOException, ClassNotFoundException - { - Object bean; - InputStream serStream; - - if (cl == null) - { - serStream = ClassLoader.getSystemResourceAsStream - (beanName.replace ('.','/')+".ser"); - } - else - { - serStream = cl.getResourceAsStream (beanName.replace ('.', '/') - + ".ser"); - } - - if (serStream != null) - { - if(cl == null) - { - ObjectInputStream ois = new ObjectInputStream(serStream); - bean = ois.readObject(); - } - else - { - ClassLoaderObjectInputStream ois = - new ClassLoaderObjectInputStream (serStream, cl); + /** Creates a bean. + * <p>This is a convenience method that calls <code>instantiate(cl, beanName, null, null)</code>.</p> + * + * @see instantiate(ClassLoader, String, BeanContext, AppletInitializer) + * @param cl ClassLoader to be used or <code>null</code> for the system classloader. + * @param beanName Name of a serialized bean or class name. + * @return A newly created bean. + * @throws IOException If access of an IO resource failed. + * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class. + */ + public static Object instantiate(ClassLoader cl, String beanName) + throws IOException, ClassNotFoundException + { + return instantiate(cl, beanName, null, null); + } + + /** Creates a bean. + * + * <p>This is a convenience method that calls <code>instantiate(cl, beanName, beanContext, null)</code>.</p> + * + * @see instantiate(ClassLoader, String, BeanContext, AppletInitializer) + * @param cl ClassLoader to be used or <code>null</code> for the system classloader. + * @param beanName Name of a serialized bean or class name. + * @param beanContext Context to which the newly created Bean should be added. + * @return A newly created bean. + * @throws IOException If access of an IO resource failed. + * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class. + */ + public static Object instantiate( + ClassLoader cl, + String beanName, + BeanContext beanContext) + throws IOException, ClassNotFoundException + { + return instantiate(cl, beanName, beanContext, null); + } + + /** Instantiates a bean according to Beans 1.0. + * + * <p>In Beans 1.0 the instantiation scheme is as follows:</p> + * <p>The name should be dot-separated (e.g "place.for.beans.myBean") and indicate either a + * serialized object or a class name. In the first case all dots in the name are replaced with + * slashes ('/') and ".ser" is appended ("place.for.beans.myBean" becomes "place/for/beans/myBean.ser"). + * The bean is then loaded as an application or system resource depending on whether a + * <code>ClassLoader</code> was provided.</p> + * + * <p>If no such resource exists or if it contains no bean the name is interpreted as a class name of + * which an instance is then created.</p> + * + * <p>If a <code>BeanContext</code> instance is available the created bean is added to it.</p> + * + * <p>If the created Bean is an <code>Applet</code> or subclass and an <code>AppletInitializer</code> + * instance is available the applet is initialized and afterwards activated using the initializer. Additionally + * every instantiated <code>Applet</code> bean is initialized using the {@link Applet.init} method. + * Furthermore every applet gets a default <code>AppletStub</code>. The <code>Applet</code>'s + * document base is the location of the ".ser" file if it was deserialized or the location of its class + * file if it was instantiated.</p> + * + * <p>A <code>ClassNotFoundException</code> is not only thrown when a class name was unknown + * but even when the class has public no-argument constructor + * (<code>IllegalAccessException</code> is wrapped) or an exception is thrown while + * invoking such a constructor (causing exception is wrapped).</p> + * + * @param cl ClassLoader to be used or <code>null</code> for the system classloader. + * @param beanName Name of a serialized bean or class name. + * @param beanContext Context to which the newly created Bean should be added. + * @param initializer The AppletInitializer which is used for initializing <code>Applet</code> beans. + * @return A newly created bean. + * @throws IOException If access of an IO resource failed. + * @throws ClassNotFoundException If the class name is not known or does not lead to a proper bean class. + */ + public static Object instantiate( + ClassLoader cl, + String beanName, + BeanContext beanContext, + AppletInitializer initializer) + throws IOException, ClassNotFoundException + { + Object bean = null; + URL beanLocation = null; + URL classLocation = null; + + // Converts bean name into a resource name (eg. "a.b.c" -> "a/b/c"). + String resourceName = beanName.replace('.', '/'); + + /* Tries to get an input stream of the Bean, reading it as a system resource + * if no ClassLoader is present or as an application resource if a classloader + * is given. + */ + beanLocation = + (cl == null) + ? ClassLoader.getSystemResource(resourceName + ".ser") + : cl.getResource(resourceName + ".ser"); + + // Reads the serialized Bean from the returned URL. + if (beanLocation != null) + { + // Deserializes the bean instance. + ObjectInputStream ois = + (cl == null) + ? new ObjectInputStream(beanLocation.openStream()) + : new ClassLoaderObjectInputStream( + beanLocation.openStream(), + cl); + bean = ois.readObject(); - } - } - else if(cl == null) - { - Class beanClass = Class.forName(beanName); - try - { - bean = beanClass.newInstance(); - } - catch(IllegalAccessException E) - { - bean = null; - } - catch(InstantiationException E) - { - bean = null; - } - } - else - { - Class beanClass = cl.loadClass(beanName); - try - { - bean = beanClass.newInstance(); - } - catch(IllegalAccessException E) - { - bean = null; - } - catch(InstantiationException E) - { - bean = null; - } - } - - if(bean instanceof Applet) - { - Applet a = (Applet)bean; - //a.setAppletContext(???); - //a.setStub(???); - if(serStream == null) - { - a.init(); - } - } - - return bean; - } - /** - * Get the Bean as a different class type. - * This should be used instead of casting to get a new - * type view of a Bean, because in the future there may - * be new types of Bean, even Beans spanning multiple - * Objects. - * - * @param bean the Bean to cast. - * @param newClass the Class to cast it to. - * - * @return the Bean as a new view, or if the operation - * could not be performed, the Bean itself. - */ - public static Object getInstanceOf(Object bean, Class newClass) - { - return bean; - } + /* Implementation note: The result of ObjectInputStream.readObject() + * may have been null at this point (its a valid value to deserialize) + * and we explicitly want to try instantiation in such a case + * (this is important for compatibility). + */ + } - /** - * Determine whether the Bean can be cast to a different - * class type. - * This should be used instead of instanceof to determine - * a Bean's castability, because in the future there may - * be new types of Bean, even Beans spanning multiple - * Objects. - * - * @param bean the Bean to cast. - * @param newBeanClass the Class to cast it to. - * - * @return whether the Bean can be cast to the class type - * in question. - */ - public static boolean isInstanceOf(Object bean, Class newBeanClass) - { - return newBeanClass.isInstance(bean); - } + // Instantiates the Bean using reflective instantiation if it has not been created yet. + if (bean == null) + { + // Makes sure that the deserialization was NOT done. + beanLocation = null; - /** - * Find out whether the GUI is available to use. - * Defaults to true. - * - * @return whether the GUI is available to use. - */ - public static boolean isGuiAvailable() - { - return guiAvailable; - } + Class beanClass; + if (cl == null) + { + beanClass = Class.forName(beanName); + classLocation = + ClassLoader.getSystemResource(resourceName + ".class"); + } + else + { + beanClass = cl.loadClass(beanName); + classLocation = cl.getResource(resourceName + ".class"); + } - /** - * Find out whether it is design time. Design time means - * we are in a RAD tool. - * Defaults to false. - * - * @return whether it is design time. - */ - public static boolean isDesignTime() - { - return designTime; - } + // Instantiates and optionally registers the new bean. + try + { + bean = beanClass.newInstance(); + } + catch(Exception e) { + /* Wraps all kinds of Exceptions in a ClassNotFoundException (this behavior + * matches with official >= 1.5, this was different for <=1.4) + */ + throw new ClassNotFoundException(null, e); + } + } - /** - * Set whether the GUI is available to use. - * @param guiAvailable whether the GUI is available to use. - */ - public static void setGuiAvailable(boolean guiAvailable) - throws SecurityException - { - Beans.guiAvailable = guiAvailable; - } + /* Applet beans are treated in the following way: + * - all AppletS get a default AppletStub + * - all AppletS are initialized using the AppletInitializer instance (if it is available) + * - as every other Bean Applets are added to a BeanContext if one is available + * - each instantiated Applet is initialized using Applet.init() (this is not done for deserialized ones) + * - finally AppletS get activated using the AppletInitializerS activate-Method + * + * The order of operations is important for compatibility. + */ + Applet applet = null; + if (bean instanceof Applet) + { + // Makes a second instanceof call unneccessary (instanceof is expensive). + applet = (Applet) bean; + + /* The AppletStub's code and document base is set as follows: + * The code base is always the URL from where the class data originated + * (without the package name). + * If the Applet was deserialized the document base is the location of + * the serialized instance (usually the ".ser" file) otherwise its the URL + * from where the class data originated (usually the absolute directory + * location of the ".class" file). + */ + applet.setStub( + new DummyAppletStub( + applet + .getClass() + .getProtectionDomain() + .getCodeSource() + .getLocation(), + (beanLocation == null) ? classLocation : beanLocation)); + + // Runs the Applet's initialization using an AppletInitializer. + if (initializer != null) + { + initializer.initialize(applet, beanContext); + } + } + + // Adds the new bean to its BeanContext. + if (beanContext != null) + { + beanContext.add(bean); + } + + if (applet != null) + { + + // Initializes an instantiated (not deserialized) Applet using its own method. + if (beanLocation == null) + { + applet.init(); + } + + // Runs the Applet's activation using an AppletInitializer. + if (initializer != null) + { + initializer.activate(applet); + } + } + + return bean; + } + + /** + * Returns the Bean as a different class type. + * This should be used instead of casting to get a new + * type view of a Bean, because in the future there may + * be new types of Bean, even Beans spanning multiple + * Objects. + * + * @param bean the Bean to cast. + * @param newClass the Class to cast it to. + * + * @return the Bean as a new view, or if the operation + * could not be performed, the Bean itself. + */ + public static Object getInstanceOf(Object bean, Class newClass) + { + return bean; + } + + /** + * Determines whether the Bean can be cast to a different + * class type. + * This should be used instead of instanceof to determine + * a Bean's castability, because in the future there may + * be new types of Bean, even Beans spanning multiple + * Objects. + * + * @param bean the Bean to cast. + * @param newClass the Class to cast it to. + * + * @return whether the Bean can be cast to the class type + * in question. + */ + public static boolean isInstanceOf(Object bean, Class newBeanClass) + { + return newBeanClass.isInstance(bean); + } + + /** + * Returns whether the GUI is available to use. + * <p>Defaults to true.</p> + * + * @return whether the GUI is available to use. + */ + public static boolean isGuiAvailable() + { + return guiAvailable; + } + + /** + * Returns whether it is design time. Design time means + * we are in a RAD tool. + * <p>Defaults to false.</p> + * + * @return whether it is design time. + */ + public static boolean isDesignTime() + { + return designTime; + } + + /** + * Sets whether the GUI is available to use. + * + * @param guiAvailable whether the GUI is available to use. + */ + public static void setGuiAvailable(boolean guiAvailable) + throws SecurityException + { + Beans.guiAvailable = guiAvailable; + } + + /** + * Sets whether it is design time. Design time means we + * are in a RAD tool. + * + * @param designTime whether it is design time. + */ + public static void setDesignTime(boolean designTime) + throws SecurityException + { + Beans.designTime = designTime; + } - /** - * Set whether it is design time. Design time means we - * are in a RAD tool. - * - * @param designTime whether it is design time. - */ - public static void setDesignTime(boolean designTime) - throws SecurityException - { - Beans.designTime = designTime; - } } diff --git a/libjava/java/beans/XMLDecoder.java b/libjava/java/beans/XMLDecoder.java new file mode 100644 index 0000000..8770335 --- /dev/null +++ b/libjava/java/beans/XMLDecoder.java @@ -0,0 +1,307 @@ +/* java.beans.XMLDecoder -- + Copyright (C) 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.beans; + +import gnu.java.beans.decoder.DefaultExceptionListener; +import gnu.java.beans.decoder.PersistenceParser; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Iterator; +import java.util.NoSuchElementException; + +/** + * The XMLDecoder reads XML data that is structured according to + * <a href="http://java.sun.com/products/jfc/tsc/articles/persistence3/javabeans.dtd">this</a> DTD + * and creates objects according to the content. Usually such data is generated using the + * {@link XMLEncoder} class. + * <p> + * An example XML document might look like this: + * <code> + * <java> + * <string>Hello World</string> + * <int>200</int> + * </java> + * </code> + * <p>To read the <code>String</code> and the <code>Integer</code> instance the following can be used (assume + * the XML data can be obtained from the InputStream):</p> + * <code> + * XMLDecoder decoder = new XMLDecoder(inputStreamContainingXMLData); + * String message = (String) decoder.readObject(); + * Integer number = (Integer) decoder.readObject(); + * </code> + * <p>Besides this basic functionality the <code>XMLDecoder</code> has some more features that might come + * handy in certain situations:</p> + * <p>An owner object can be set using the <code>setOwner</code> method which can then be accessed when + * decoding. This feature is only useful if the XML data is aware of the owner object. Such data may + * look like this (assume that the owner object is a JFrame instance):</p> + * <code> + * <java> + * <void method="getOwner"> + * <void method="setVisible"> + * <boolean>true<boolean> + * </void> + * </void> + * </java> + * </code> + * This accesses the <code>JFrame</code> and makes it visible using the <code>setVisible</code> method. + * <p>Please note that changing the owner <b>after</b> the having read the first object has no effect, + * because all object have been decoded then.</p> + * <p>If the <code>XMLDecoder</code> is created with no {@link ExceptionListener} instance a default one + * is used that prints an error message to <code>System.err</code> whenever a recoverable exception + * is thrown. Recovarable exceptions occur when the XML data cannot be interpreted correctly (e.g + * unknown classes or methods, invocation on null, ...). In general be very careful when the + * <code>XMLDecoder</code> provoked such exceptions because the resulting object(s) may be in an + * undesirable state.</p> + * <p>Note that changing the ExceptionListener instance after <code>readObject</code> has been called + * once has no effect because the decoding is completed then.</p> + * <p>At last one can provide a specific <code>ClassLoader</code> which is then used when <code>Class</code> + * objects are accessed. See {@link java.lang.Class#forName(String, boolean, ClassLoader)} for details + * on this.</p> + * <p>Note: If the <code>InputStream</code> instance given to any of the constructors is <code>null</code> + * the resulting <code>XMLDecoder</code> will be silently (without any exception) useless. Each call + * to <code>readObject</code> will return <code>null</code> and never throws an + * <code>ArrayIndexOutOfBoundsException</code>.</p> + * + * @author Robert Schuster + * @since 1.4 + * @status updated to 1.5 + */ +public class XMLDecoder +{ + private Object owner; + + private ExceptionListener exceptionListener; + + private InputStream inputStream; + + private boolean isStreamClosed; + + private ClassLoader classLoader; + + private Iterator iterator; + + /** Creates a XMLDecoder instance that parses the XML data of the given input stream. + * Using this constructor no special ClassLoader, a default ExceptionListener + * and no owner object is used. + * + * @param in InputStream to read XML data from. + */ + public XMLDecoder(InputStream in) + { + this(in, null); + } + + /** Creates a XMLDecoder instance that parses the XML data of the given input stream. + * Using this constructor no special ClassLoader and a default ExceptionListener + * is used. + * + * @param in InputStream to read XML data from. + * @param owner Owner object which can be accessed and modified while parsing. + */ + public XMLDecoder(InputStream in, Object owner) + { + this(in, owner, null); + } + + /** Creates a XMLDecoder instance that parses the XML data of the given input stream. + * If the ExceptionListener argument is null a default implementation is used. + * + * @param in InputStream to read XML data from. + * @param owner Owner object which can be accessed and modified while parsing. + * @param exceptionListener ExceptionListener instance to which exception notifications are send. + */ + public XMLDecoder( + InputStream in, + Object owner, + ExceptionListener exceptionListener) + { + this( + in, + owner, + exceptionListener, + Thread.currentThread().getContextClassLoader()); + } + + /** Creates a XMLDecoder instance that parses the XML data of the given input stream. + * If the ExceptionListener argument is null a default implementation is used. + * + * @param in InputStream to read XML data from. + * @param owner Owner object which can be accessed and modified while parsing. + * @param exceptionListener ExceptionListener instance to which exception notifications are send. + * @param cl ClassLoader instance that is used for calls to <code>Class.forName(String, boolean, ClassLoader)</code> + * @since 1.5 + */ + public XMLDecoder( + InputStream in, + Object owner, + ExceptionListener listener, + ClassLoader cl) + { + // initially here was a check for the validity of the InputStream argument but some + // great engineers decided that this API should silently discard this and behave rather + // odd: readObject will always return null ... + inputStream = in; + + setExceptionListener(listener); + + // validity of this object is checked in Class.forName() and therefore may be null + classLoader = cl; + + this.owner = owner; + } + + /** Closes the stream associated with this decoder. This should be done after having read all + * decoded objects. + * <p>See the description of the {@link #readObject()} for the effect caused by <code>close</code>.</p> + */ + public void close() + { + if (isStreamClosed) + { + return; + } + + try + { + inputStream.close(); + isStreamClosed = true; + } + catch (IOException e) + { + // bad style forced by original API design ... + } + } + + /** Returns the ExceptionListener instance associated with this decoder. + * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p> + * + * @return Current ExceptionListener of the decoder. + */ + public ExceptionListener getExceptionListener() + { + return exceptionListener; + } + + /** Returns the owner object of the decoder. This method is usually called + * from within the parsed XML data. + * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p> + * + * @return The owner object of this decoder. + */ + public Object getOwner() + { + return owner; + } + + /** Returns the next available decoded object. + * <p>Note that the actual decoding takes place when the method is called for the first time.</p> + * <p>If the <code>close</code> method was already called a <code>NoSuchElementException</code> + * is thrown.</p> + * <p>If the InputStream instance used in the constructors was <code>null</code> this method + * will always return <code>null</code> itself.</p> + * + * @return The next object in a sequence decoded from XML data. + * @throws ArrayIndexOutOfBoundsException When no more objects are available. + */ + public Object readObject() throws ArrayIndexOutOfBoundsException + { + // note: the RI does it this way ... + if(inputStream == null) { + return null; + } + + // note: the original API documentation says nothing on what to do + // when the stream was closed before readObject is called but it actually + // throws a NoSuchElementException - this behaviour is imitated here + if (isStreamClosed) + { + throw new NoSuchElementException("Cannot read any objects - XMLDecoder was already closed."); + } + + // creates the PersistenceParser (doing the parsing and decoding) and returns its + // Iterator on first invocation + if (iterator == null) + { + iterator = + new PersistenceParser( + inputStream, + exceptionListener, + classLoader, + this) + .iterator(); + } + + // note: done according to the official documentation + if (!iterator.hasNext()) + { + throw new ArrayIndexOutOfBoundsException("No more objects available from this XMLDecoder."); + } + + // returns just the next object if there was no problem + return iterator.next(); + } + + /** Sets the ExceptionListener instance to which notifications of exceptions are send + * while parsing the XML data. + * <p>See the description of {@link XMLDecoder} class for more information on the ExceptionListener.</p> + * + * @param listener + */ + public void setExceptionListener(ExceptionListener listener) + { + // uses a default implementation when null + if (listener == null) + { + listener = new DefaultExceptionListener(); + } + exceptionListener = listener; + } + + /** Sets the owner object which can be accessed from the parsed XML data. + * <p>See the description of {@link XMLDecoder} class for more information on the owner object.</p> + * + * @param newOwner + */ + public void setOwner(Object newOwner) + { + owner = newOwner; + } + +} |