aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2001-10-24 21:39:24 +0000
committerTom Tromey <tromey@gcc.gnu.org>2001-10-24 21:39:24 +0000
commit6dee3a2320540b9b654d9a5ef7626e90246ffe80 (patch)
tree77f03cf3fdeebbd2596223d2c7c3196a423c195c
parente1cb83c58069ad5b04dcd161564d159562dd8f25 (diff)
downloadgcc-6dee3a2320540b9b654d9a5ef7626e90246ffe80.zip
gcc-6dee3a2320540b9b654d9a5ef7626e90246ffe80.tar.gz
gcc-6dee3a2320540b9b654d9a5ef7626e90246ffe80.tar.bz2
Makefile.in: Rebuilt.
2001-10-24 Tom Tromey <tromey@redhat.com> Warren Levy <warrenl@redhat.com> * Makefile.in: Rebuilt. * Makefile.am (javax_source_files): New macro. (ordinary_java_source_files): Added javax_source_files. (libgcj.jar): Search javax for class files. * javax/naming/LinkException.java (toString): Wrote. (toString(boolean)): Likewise. * javax/naming/ldap/InitialLdapContext.java: New file. * javax/naming/directory/InitialDirContext.java: Wrote. * javax/naming/spi/NamingManager.java (getPlusPath): Now has package-private protection. (getURLContext): Likewise. (NamingManager): Likewise. * javax/naming/spi/DirectoryManager.java: New file. * javax/naming/directory/BasicAttributes.java: New file. * javax/naming/directory/BasicAttribute.java: New file. * javax/naming/spi/ResolveResult.java (ResolveResult(Object,String)): Wrote. (appendRemainingName): Uncommented body. (appendRemainingComponent): Likewise. * javax/naming/ldap/ControlFactory.java: New file. * javax/naming/directory/AttributeModificationException.java (toString): Wrote. * javax/naming/spi/NamingManager.java (NamingManager): New constructor. (setInitialContextFactoryBuilder): Wrote. (getInitialContext): Look in system properties for class name as well. Use Class.forName(). (getURLContext): Wrote. (ofb): New field. (setObjectFactoryBuilder): Wrote. (getObjectInstance): Wrote. (getContinuationContext): Wrote. (getPlusPath): New private method. (getStateToBind): Wrote. * javax/naming/CannotProceedException.java: Added missing methods & fields. * javax/naming/LinkException.java: Added missing methods & fields. * javax/naming/ReferralException.java (ReferralException): Made constructor protected per spec. Added missing abstract methods. * javax/naming/directory/Attribute.java: Updated copyright. * javax/naming/directory/AttributeModificationException.java: Ditto. * javax/naming/directory/Attributes.java: Ditto. * javax/naming/directory/DirContext.java: Ditto. * javax/naming/spi/NamingManager.java: Ditto. * javax/naming/spi/ResolveResult.java: Added comment. * javax/naming/directory/Attribute.java: Added missing interface methods. * javax/naming/directory/AttributeModificationException.java: Added missing methods & fields. * javax/naming/directory/directory/Attributes.java: Added missing interface methods. * javax/naming/directory/SearchControls.java: Maded serialized fields private. * javax/naming/event/NamingEvent.java: Added comment. * javax/naming/event/NamingExceptionEvent.java: Maded serialized field private. * javax/naming/ldap/UnsolicitedNotificationEvent.java: Maded serialized field private. * javax/naming/spi/NamingManager.java: Added missing field and stubbed missing methods. * javax/naming/directory/DirContext.java: Added missing interface fields & methods. * javax/naming/directory/InitialDirContext.java: Stubbed missing methods. * javax/naming/directory/ModificationItem.java: New class. * javax/naming/directory/SearchResult.java: New class. * javax/naming/directory/SearchControls.java: New class. * javax/naming/event/EventContext.java: New class. * javax/naming/event/EventDirContext.java: New class. * javax/naming/event/NamespaceChangeListener.java: New class. * javax/naming/event/NamingEvent.java: New class. * javax/naming/event/NamingExceptionEvent.java: New class. * javax/naming/event/NamingListener.java: New class. * javax/naming/event/ObjectChangeListener.java: New class. * javax/naming/ldap/Control.java: New class. * javax/naming/ldap/ExtendedRequest.java: New class. * javax/naming/ldap/ExtendedResponse.java: New class. * javax/naming/ldap/HasControls.java: New class. * javax/naming/ldap/LdapContext.java: New class. * javax/naming/ldap/LdapReferralException.java: New class. * javax/naming/ldap/UnsolicitedNotification.java: New class. * javax/naming/ldap/UnsolicitedNotificationEvent.java: New class. * javax/naming/ldap/UnsolicitedNotificationListener.java: New class. * javax/naming/spi/DirObjectFactory.java: New class. * javax/naming/spi/DirStateFactory.java: New class. * javax/naming/spi/ObjectFactoryBuilder.java: New class. * javax/naming/spi/ResolveResult.java: New class. * javax/naming/spi/Resolver.java: New class. * javax/naming/spi/StateFactory.java: New class. * javax/naming/spi/ObjectFactory.java: Made an interface per spec. * java/rmi/RemoteException.java: New class. * javax/transaction/HeuristicCommitException.java: New class. * javax/transaction/HeuristicMixedException.java: New class. * javax/transaction/HeuristicRollbackException.java: New class. * javax/transaction/NotSupportedException.java: New class. * javax/transaction/RollbackException.java: New class. * javax/transaction/Status.java: New class. * javax/transaction/Synchronization.java: New class. * javax/transaction/SystemException.java: New class. * javax/transaction/Transaction.java: New class. * javax/transaction/TransactionManager.java: New class. * javax/transaction/UserTransaction.java: New class. * javax/transaction/xa/XAException.java: Added public static fields. * javax/transaction/xa/XAResource.java: New class. * javax/transaction/xa/Xid.java: New class. * javax/naming/CompoundName.java (CompoundName(String)): Reverse elements if required. Handle case where quote is at end of string. * javax/naming/CompoundName.java (CompoundName(String)): Handle text left at end of parsing. (toString): Handle empty element at beginning. * javax/naming/CompositeName.java (toString): Handle empty element at beginning. (CompositeName(String)): Handle text left at end of parsing. Correctly compute boundary condition for quoting. * javax/naming/CompoundName.java: New file. * javax/naming/CompositeName.java: New file. * javax/naming/Binding.java: New file. * javax/naming/LinkRef.java: New file. * javax/naming/NameClassPair.java: New file. * javax/naming/Reference.java (addrs, classFactory, classFactoryLocation): New fields. (className): Now protected. (Reference): New constructors. (add): Now public. Implemented. (get(String)): Likewise. (add(int,RefAddr)): New method. (clear): Likewise. (clone): Likewise. (equals): Likewise. (get(int)): Likewise. (getAll): Likewise. (getFactoryClassLocation): Likewise. (getFactoryClassName): Likewise. (hashCode): Likewise. (remove): Likewise. (size): Likewise. (toString): Likewise. * javax/transaction/xa/XAException.java: New file. * javax/transaction/TransactionRolledbackException.java: New file. * javax/transaction/TransactionRequiredException.java: New file. * javax/transaction/InvalidTransactionException.java: New file. * javax/naming/directory/SchemaViolationException.java: Use correct package. Import NamingException. * javax/naming/directory/NoSuchAttributeException.java, javax/naming/directory/InvalidSearchFilterException.java, javax/naming/directory/InvalidSearchControlsException.java, javax/naming/directory/InvalidAttributesException.java, javax/naming/directory/InvalidAttributeValueException.java, javax/naming/directory/InvalidAttributeIdentifierException.java, javax/naming/directory/AttributeModificationException.java, javax/naming/directory/AttributeInUseException.java: Likewise. * javax/naming/directory/InitialDirContext.java (getAttributes): Stub implementation. * javax/naming/RefAddr.java (RefAddr): Reindented. (equals): Renamed and reindented. * javax/naming/BinaryRefAddr.java (equals): Renamed and reindented. Co-Authored-By: Warren Levy <warrenl@redhat.com> From-SVN: r46474
-rw-r--r--libjava/ChangeLog163
-rw-r--r--libjava/Makefile.am113
-rw-r--r--libjava/Makefile.in213
-rw-r--r--libjava/javax/naming/BinaryRefAddr.java12
-rw-r--r--libjava/javax/naming/Binding.java68
-rw-r--r--libjava/javax/naming/CannotProceedException.java54
-rw-r--r--libjava/javax/naming/CompositeName.java289
-rw-r--r--libjava/javax/naming/CompoundName.java460
-rw-r--r--libjava/javax/naming/LinkException.java66
-rw-r--r--libjava/javax/naming/LinkRef.java35
-rw-r--r--libjava/javax/naming/NameClassPair.java71
-rw-r--r--libjava/javax/naming/RefAddr.java24
-rw-r--r--libjava/javax/naming/Reference.java140
-rw-r--r--libjava/javax/naming/ReferralException.java21
-rw-r--r--libjava/javax/naming/directory/Attribute.java28
-rw-r--r--libjava/javax/naming/directory/AttributeInUseException.java6
-rw-r--r--libjava/javax/naming/directory/AttributeModificationException.java29
-rw-r--r--libjava/javax/naming/directory/Attributes.java19
-rw-r--r--libjava/javax/naming/directory/BasicAttribute.java298
-rw-r--r--libjava/javax/naming/directory/BasicAttributes.java194
-rw-r--r--libjava/javax/naming/directory/DirContext.java40
-rw-r--r--libjava/javax/naming/directory/InitialDirContext.java206
-rw-r--r--libjava/javax/naming/directory/InvalidAttributeIdentifierException.java6
-rw-r--r--libjava/javax/naming/directory/InvalidAttributeValueException.java6
-rw-r--r--libjava/javax/naming/directory/InvalidAttributesException.java6
-rw-r--r--libjava/javax/naming/directory/InvalidSearchControlsException.java6
-rw-r--r--libjava/javax/naming/directory/InvalidSearchFilterException.java6
-rw-r--r--libjava/javax/naming/directory/ModificationItem.java49
-rw-r--r--libjava/javax/naming/directory/NoSuchAttributeException.java6
-rw-r--r--libjava/javax/naming/directory/SchemaViolationException.java6
-rw-r--r--libjava/javax/naming/directory/SearchControls.java106
-rw-r--r--libjava/javax/naming/directory/SearchResult.java64
-rw-r--r--libjava/javax/naming/event/EventContext.java29
-rw-r--r--libjava/javax/naming/event/EventDirContext.java31
-rw-r--r--libjava/javax/naming/event/NamespaceChangeListener.java21
-rw-r--r--libjava/javax/naming/event/NamingEvent.java89
-rw-r--r--libjava/javax/naming/event/NamingExceptionEvent.java43
-rw-r--r--libjava/javax/naming/event/NamingListener.java20
-rw-r--r--libjava/javax/naming/event/ObjectChangeListener.java19
-rw-r--r--libjava/javax/naming/ldap/Control.java25
-rw-r--r--libjava/javax/naming/ldap/ControlFactory.java75
-rw-r--r--libjava/javax/naming/ldap/ExtendedRequest.java26
-rw-r--r--libjava/javax/naming/ldap/ExtendedResponse.java21
-rw-r--r--libjava/javax/naming/ldap/HasControls.java20
-rw-r--r--libjava/javax/naming/ldap/InitialLdapContext.java99
-rw-r--r--libjava/javax/naming/ldap/LdapContext.java32
-rw-r--r--libjava/javax/naming/ldap/LdapReferralException.java35
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotification.java21
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java38
-rw-r--r--libjava/javax/naming/ldap/UnsolicitedNotificationListener.java20
-rw-r--r--libjava/javax/naming/spi/DirObjectFactory.java24
-rw-r--r--libjava/javax/naming/spi/DirStateFactory.java50
-rw-r--r--libjava/javax/naming/spi/DirectoryManager.java204
-rw-r--r--libjava/javax/naming/spi/NamingManager.java315
-rw-r--r--libjava/javax/naming/spi/ObjectFactory.java9
-rw-r--r--libjava/javax/naming/spi/ObjectFactoryBuilder.java23
-rw-r--r--libjava/javax/naming/spi/ResolveResult.java93
-rw-r--r--libjava/javax/naming/spi/Resolver.java23
-rw-r--r--libjava/javax/naming/spi/StateFactory.java22
-rw-r--r--libjava/javax/transaction/HeuristicCommitException.java27
-rw-r--r--libjava/javax/transaction/HeuristicMixedException.java27
-rw-r--r--libjava/javax/transaction/HeuristicRollbackException.java27
-rw-r--r--libjava/javax/transaction/InvalidTransactionException.java29
-rw-r--r--libjava/javax/transaction/NotSupportedException.java27
-rw-r--r--libjava/javax/transaction/RollbackException.java27
-rw-r--r--libjava/javax/transaction/Status.java28
-rw-r--r--libjava/javax/transaction/Synchronization.java20
-rw-r--r--libjava/javax/transaction/SystemException.java35
-rw-r--r--libjava/javax/transaction/Transaction.java33
-rw-r--r--libjava/javax/transaction/TransactionManager.java35
-rw-r--r--libjava/javax/transaction/TransactionRequiredException.java29
-rw-r--r--libjava/javax/transaction/TransactionRolledbackException.java29
-rw-r--r--libjava/javax/transaction/UserTransaction.java30
-rw-r--r--libjava/javax/transaction/xa/XAException.java60
-rw-r--r--libjava/javax/transaction/xa/XAResource.java40
-rw-r--r--libjava/javax/transaction/xa/Xid.java24
76 files changed, 4663 insertions, 101 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 6829f6e..9e0dd10 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,4 +1,167 @@
2001-10-24 Tom Tromey <tromey@redhat.com>
+ Warren Levy <warrenl@redhat.com>
+
+ * Makefile.in: Rebuilt.
+ * Makefile.am (javax_source_files): New macro.
+ (ordinary_java_source_files): Added javax_source_files.
+ (libgcj.jar): Search javax for class files.
+ * javax/naming/LinkException.java (toString): Wrote.
+ (toString(boolean)): Likewise.
+ * javax/naming/ldap/InitialLdapContext.java: New file.
+ * javax/naming/directory/InitialDirContext.java: Wrote.
+ * javax/naming/spi/NamingManager.java (getPlusPath): Now has
+ package-private protection.
+ (getURLContext): Likewise.
+ (NamingManager): Likewise.
+ * javax/naming/spi/DirectoryManager.java: New file.
+ * javax/naming/directory/BasicAttributes.java: New file.
+ * javax/naming/directory/BasicAttribute.java: New file.
+ * javax/naming/spi/ResolveResult.java
+ (ResolveResult(Object,String)): Wrote.
+ (appendRemainingName): Uncommented body.
+ (appendRemainingComponent): Likewise.
+ * javax/naming/ldap/ControlFactory.java: New file.
+ * javax/naming/directory/AttributeModificationException.java
+ (toString): Wrote.
+ * javax/naming/spi/NamingManager.java (NamingManager): New
+ constructor.
+ (setInitialContextFactoryBuilder): Wrote.
+ (getInitialContext): Look in system properties for class name as
+ well. Use Class.forName().
+ (getURLContext): Wrote.
+ (ofb): New field.
+ (setObjectFactoryBuilder): Wrote.
+ (getObjectInstance): Wrote.
+ (getContinuationContext): Wrote.
+ (getPlusPath): New private method.
+ (getStateToBind): Wrote.
+ * javax/naming/CannotProceedException.java: Added missing methods &
+ fields.
+ * javax/naming/LinkException.java: Added missing methods & fields.
+ * javax/naming/ReferralException.java (ReferralException): Made
+ constructor protected per spec.
+ Added missing abstract methods.
+ * javax/naming/directory/Attribute.java: Updated copyright.
+ * javax/naming/directory/AttributeModificationException.java: Ditto.
+ * javax/naming/directory/Attributes.java: Ditto.
+ * javax/naming/directory/DirContext.java: Ditto.
+ * javax/naming/spi/NamingManager.java: Ditto.
+ * javax/naming/spi/ResolveResult.java: Added comment.
+ * javax/naming/directory/Attribute.java: Added missing interface
+ methods.
+ * javax/naming/directory/AttributeModificationException.java:
+ Added missing methods & fields.
+ * javax/naming/directory/directory/Attributes.java: Added missing
+ interface methods.
+ * javax/naming/directory/SearchControls.java: Maded serialized fields
+ private.
+ * javax/naming/event/NamingEvent.java: Added comment.
+ * javax/naming/event/NamingExceptionEvent.java: Maded serialized field
+ private.
+ * javax/naming/ldap/UnsolicitedNotificationEvent.java: Maded
+ serialized field private.
+ * javax/naming/spi/NamingManager.java: Added missing field and stubbed
+ missing methods.
+ * javax/naming/directory/DirContext.java: Added missing interface
+ fields & methods.
+ * javax/naming/directory/InitialDirContext.java: Stubbed missing
+ methods.
+ * javax/naming/directory/ModificationItem.java: New class.
+ * javax/naming/directory/SearchResult.java: New class.
+ * javax/naming/directory/SearchControls.java: New class.
+ * javax/naming/event/EventContext.java: New class.
+ * javax/naming/event/EventDirContext.java: New class.
+ * javax/naming/event/NamespaceChangeListener.java: New class.
+ * javax/naming/event/NamingEvent.java: New class.
+ * javax/naming/event/NamingExceptionEvent.java: New class.
+ * javax/naming/event/NamingListener.java: New class.
+ * javax/naming/event/ObjectChangeListener.java: New class.
+ * javax/naming/ldap/Control.java: New class.
+ * javax/naming/ldap/ExtendedRequest.java: New class.
+ * javax/naming/ldap/ExtendedResponse.java: New class.
+ * javax/naming/ldap/HasControls.java: New class.
+ * javax/naming/ldap/LdapContext.java: New class.
+ * javax/naming/ldap/LdapReferralException.java: New class.
+ * javax/naming/ldap/UnsolicitedNotification.java: New class.
+ * javax/naming/ldap/UnsolicitedNotificationEvent.java: New class.
+ * javax/naming/ldap/UnsolicitedNotificationListener.java: New class.
+ * javax/naming/spi/DirObjectFactory.java: New class.
+ * javax/naming/spi/DirStateFactory.java: New class.
+ * javax/naming/spi/ObjectFactoryBuilder.java: New class.
+ * javax/naming/spi/ResolveResult.java: New class.
+ * javax/naming/spi/Resolver.java: New class.
+ * javax/naming/spi/StateFactory.java: New class.
+ * javax/naming/spi/ObjectFactory.java: Made an interface per spec.
+ * java/rmi/RemoteException.java: New class.
+ * javax/transaction/HeuristicCommitException.java: New class.
+ * javax/transaction/HeuristicMixedException.java: New class.
+ * javax/transaction/HeuristicRollbackException.java: New class.
+ * javax/transaction/NotSupportedException.java: New class.
+ * javax/transaction/RollbackException.java: New class.
+ * javax/transaction/Status.java: New class.
+ * javax/transaction/Synchronization.java: New class.
+ * javax/transaction/SystemException.java: New class.
+ * javax/transaction/Transaction.java: New class.
+ * javax/transaction/TransactionManager.java: New class.
+ * javax/transaction/UserTransaction.java: New class.
+ * javax/transaction/xa/XAException.java: Added public static fields.
+ * javax/transaction/xa/XAResource.java: New class.
+ * javax/transaction/xa/Xid.java: New class.
+ * javax/naming/CompoundName.java (CompoundName(String)): Reverse
+ elements if required. Handle case where quote is at end of
+ string.
+ * javax/naming/CompoundName.java (CompoundName(String)): Handle
+ text left at end of parsing.
+ (toString): Handle empty element at beginning.
+ * javax/naming/CompositeName.java (toString): Handle empty element
+ at beginning.
+ (CompositeName(String)): Handle text left at end of parsing.
+ Correctly compute boundary condition for quoting.
+ * javax/naming/CompoundName.java: New file.
+ * javax/naming/CompositeName.java: New file.
+ * javax/naming/Binding.java: New file.
+ * javax/naming/LinkRef.java: New file.
+ * javax/naming/NameClassPair.java: New file.
+ * javax/naming/Reference.java (addrs, classFactory,
+ classFactoryLocation): New fields.
+ (className): Now protected.
+ (Reference): New constructors.
+ (add): Now public. Implemented.
+ (get(String)): Likewise.
+ (add(int,RefAddr)): New method.
+ (clear): Likewise.
+ (clone): Likewise.
+ (equals): Likewise.
+ (get(int)): Likewise.
+ (getAll): Likewise.
+ (getFactoryClassLocation): Likewise.
+ (getFactoryClassName): Likewise.
+ (hashCode): Likewise.
+ (remove): Likewise.
+ (size): Likewise.
+ (toString): Likewise.
+ * javax/transaction/xa/XAException.java: New file.
+ * javax/transaction/TransactionRolledbackException.java: New file.
+ * javax/transaction/TransactionRequiredException.java: New file.
+ * javax/transaction/InvalidTransactionException.java: New file.
+ * javax/naming/directory/SchemaViolationException.java: Use
+ correct package. Import NamingException.
+ * javax/naming/directory/NoSuchAttributeException.java,
+ javax/naming/directory/InvalidSearchFilterException.java,
+ javax/naming/directory/InvalidSearchControlsException.java,
+ javax/naming/directory/InvalidAttributesException.java,
+ javax/naming/directory/InvalidAttributeValueException.java,
+ javax/naming/directory/InvalidAttributeIdentifierException.java,
+ javax/naming/directory/AttributeModificationException.java,
+ javax/naming/directory/AttributeInUseException.java: Likewise.
+ * javax/naming/directory/InitialDirContext.java (getAttributes):
+ Stub implementation.
+ * javax/naming/RefAddr.java (RefAddr): Reindented.
+ (equals): Renamed and reindented.
+ * javax/naming/BinaryRefAddr.java (equals): Renamed and
+ reindented.
+
+2001-10-24 Tom Tromey <tromey@redhat.com>
* java/lang/reflect/Field.java: Made many methods private.
diff --git a/libjava/Makefile.am b/libjava/Makefile.am
index 223d2ff..84ac600 100644
--- a/libjava/Makefile.am
+++ b/libjava/Makefile.am
@@ -192,7 +192,7 @@ libgcj.jar: $(built_java_source_files) $(java_source_files) $(x_java_source_file
test "$$fail" = no)
-@rm -f tmp-list libgcj.jar
## Note that we explicitly want to include directory information.
- find java gnu org -type d -o -type f -name '*.class' | \
+ find java gnu javax org -type d -o -type f -name '*.class' | \
sed -e '/\/\./d' -e '/\/xlib/d' | \
$(ZIP) cfM0E@ $@
@@ -912,6 +912,114 @@ gnu/java/rmi/server/UnicastRemoteStub.java \
gnu/java/rmi/server/UnicastServer.java \
gnu/java/rmi/server/UnicastServerRef.java
+javax_source_files = \
+javax/naming/directory/Attribute.java \
+javax/naming/directory/AttributeInUseException.java \
+javax/naming/directory/AttributeModificationException.java \
+javax/naming/directory/Attributes.java \
+javax/naming/directory/DirContext.java \
+javax/naming/directory/InvalidAttributeIdentifierException.java \
+javax/naming/directory/InvalidAttributeValueException.java \
+javax/naming/directory/InvalidAttributesException.java \
+javax/naming/directory/InvalidSearchControlsException.java \
+javax/naming/directory/InvalidSearchFilterException.java \
+javax/naming/directory/NoSuchAttributeException.java \
+javax/naming/directory/SchemaViolationException.java \
+javax/naming/directory/BasicAttribute.java \
+javax/naming/directory/BasicAttributes.java \
+javax/naming/directory/ModificationItem.java \
+javax/naming/directory/SearchControls.java \
+javax/naming/directory/SearchResult.java \
+javax/naming/directory/InitialDirContext.java \
+javax/naming/AuthenticationException.java \
+javax/naming/AuthenticationNotSupportedException.java \
+javax/naming/CannotProceedException.java \
+javax/naming/CommunicationException.java \
+javax/naming/ConfigurationException.java \
+javax/naming/Context.java \
+javax/naming/ContextNotEmptyException.java \
+javax/naming/InsufficientResourcesException.java \
+javax/naming/InterruptedNamingException.java \
+javax/naming/BinaryRefAddr.java \
+javax/naming/LimitExceededException.java \
+javax/naming/LinkException.java \
+javax/naming/LinkLoopException.java \
+javax/naming/MalformedLinkException.java \
+javax/naming/Name.java \
+javax/naming/NameAlreadyBoundException.java \
+javax/naming/NameNotFoundException.java \
+javax/naming/NameParser.java \
+javax/naming/NamingEnumeration.java \
+javax/naming/InitialContext.java \
+javax/naming/NamingSecurityException.java \
+javax/naming/NoInitialContextException.java \
+javax/naming/NoPermissionException.java \
+javax/naming/NotContextException.java \
+javax/naming/NamingException.java \
+javax/naming/PartialResultException.java \
+javax/naming/event/EventContext.java \
+javax/naming/event/EventDirContext.java \
+javax/naming/event/NamespaceChangeListener.java \
+javax/naming/event/NamingEvent.java \
+javax/naming/event/NamingExceptionEvent.java \
+javax/naming/event/NamingListener.java \
+javax/naming/event/ObjectChangeListener.java \
+javax/naming/RefAddr.java \
+javax/naming/Reference.java \
+javax/naming/Referenceable.java \
+javax/naming/ReferralException.java \
+javax/naming/ServiceUnavailableException.java \
+javax/naming/SizeLimitExceededException.java \
+javax/naming/StringRefAddr.java \
+javax/naming/TimeLimitExceededException.java \
+javax/naming/spi/InitialContextFactory.java \
+javax/naming/spi/InitialContextFactoryBuilder.java \
+javax/naming/spi/NamingManager.java \
+javax/naming/spi/ObjectFactory.java \
+javax/naming/spi/Resolver.java \
+javax/naming/spi/DirObjectFactory.java \
+javax/naming/spi/DirStateFactory.java \
+javax/naming/spi/DirectoryManager.java \
+javax/naming/spi/ObjectFactoryBuilder.java \
+javax/naming/spi/ResolveResult.java \
+javax/naming/spi/StateFactory.java \
+javax/naming/InvalidNameException.java \
+javax/naming/Binding.java \
+javax/naming/CompositeName.java \
+javax/naming/CompoundName.java \
+javax/naming/LinkRef.java \
+javax/naming/NameClassPair.java \
+javax/naming/ldap/Control.java \
+javax/naming/ldap/ControlFactory.java \
+javax/naming/ldap/ExtendedRequest.java \
+javax/naming/ldap/ExtendedResponse.java \
+javax/naming/ldap/HasControls.java \
+javax/naming/ldap/InitialLdapContext.java \
+javax/naming/ldap/LdapContext.java \
+javax/naming/ldap/LdapReferralException.java \
+javax/naming/ldap/UnsolicitedNotification.java \
+javax/naming/ldap/UnsolicitedNotificationEvent.java \
+javax/naming/ldap/UnsolicitedNotificationListener.java \
+javax/naming/OperationNotSupportedException.java \
+javax/transaction/xa/XAException.java \
+javax/transaction/xa/XAResource.java \
+javax/transaction/xa/Xid.java \
+javax/transaction/HeuristicCommitException.java \
+javax/transaction/HeuristicMixedException.java \
+javax/transaction/HeuristicRollbackException.java \
+javax/transaction/InvalidTransactionException.java \
+javax/transaction/NotSupportedException.java \
+javax/transaction/RollbackException.java \
+javax/transaction/Status.java \
+javax/transaction/Synchronization.java \
+javax/transaction/SystemException.java \
+javax/transaction/Transaction.java \
+javax/transaction/TransactionManager.java \
+javax/transaction/TransactionRequiredException.java \
+javax/transaction/TransactionRolledbackException.java \
+javax/transaction/UserTransaction.java
+
+
## Java files which are created by configure and thus are in the build
## directory.
built_java_source_files = java/lang/ConcreteProcess.java \
@@ -1475,7 +1583,8 @@ org/xml/sax/XMLFilter.java \
org/xml/sax/XMLReader.java \
$(rmi_java_source_files) \
$(awt_java_source_files) \
-$(convert_source_files)
+$(convert_source_files) \
+$(javax_source_files)
java_source_files = $(special_java_source_files) $(ordinary_java_source_files)
diff --git a/libjava/Makefile.in b/libjava/Makefile.in
index a66e458..5519f6b 100644
--- a/libjava/Makefile.in
+++ b/libjava/Makefile.in
@@ -654,6 +654,114 @@ gnu/java/rmi/server/UnicastServer.java \
gnu/java/rmi/server/UnicastServerRef.java
+javax_source_files = \
+javax/naming/directory/Attribute.java \
+javax/naming/directory/AttributeInUseException.java \
+javax/naming/directory/AttributeModificationException.java \
+javax/naming/directory/Attributes.java \
+javax/naming/directory/DirContext.java \
+javax/naming/directory/InvalidAttributeIdentifierException.java \
+javax/naming/directory/InvalidAttributeValueException.java \
+javax/naming/directory/InvalidAttributesException.java \
+javax/naming/directory/InvalidSearchControlsException.java \
+javax/naming/directory/InvalidSearchFilterException.java \
+javax/naming/directory/NoSuchAttributeException.java \
+javax/naming/directory/SchemaViolationException.java \
+javax/naming/directory/BasicAttribute.java \
+javax/naming/directory/BasicAttributes.java \
+javax/naming/directory/ModificationItem.java \
+javax/naming/directory/SearchControls.java \
+javax/naming/directory/SearchResult.java \
+javax/naming/directory/InitialDirContext.java \
+javax/naming/AuthenticationException.java \
+javax/naming/AuthenticationNotSupportedException.java \
+javax/naming/CannotProceedException.java \
+javax/naming/CommunicationException.java \
+javax/naming/ConfigurationException.java \
+javax/naming/Context.java \
+javax/naming/ContextNotEmptyException.java \
+javax/naming/InsufficientResourcesException.java \
+javax/naming/InterruptedNamingException.java \
+javax/naming/BinaryRefAddr.java \
+javax/naming/LimitExceededException.java \
+javax/naming/LinkException.java \
+javax/naming/LinkLoopException.java \
+javax/naming/MalformedLinkException.java \
+javax/naming/Name.java \
+javax/naming/NameAlreadyBoundException.java \
+javax/naming/NameNotFoundException.java \
+javax/naming/NameParser.java \
+javax/naming/NamingEnumeration.java \
+javax/naming/InitialContext.java \
+javax/naming/NamingSecurityException.java \
+javax/naming/NoInitialContextException.java \
+javax/naming/NoPermissionException.java \
+javax/naming/NotContextException.java \
+javax/naming/NamingException.java \
+javax/naming/PartialResultException.java \
+javax/naming/event/EventContext.java \
+javax/naming/event/EventDirContext.java \
+javax/naming/event/NamespaceChangeListener.java \
+javax/naming/event/NamingEvent.java \
+javax/naming/event/NamingExceptionEvent.java \
+javax/naming/event/NamingListener.java \
+javax/naming/event/ObjectChangeListener.java \
+javax/naming/RefAddr.java \
+javax/naming/Reference.java \
+javax/naming/Referenceable.java \
+javax/naming/ReferralException.java \
+javax/naming/ServiceUnavailableException.java \
+javax/naming/SizeLimitExceededException.java \
+javax/naming/StringRefAddr.java \
+javax/naming/TimeLimitExceededException.java \
+javax/naming/spi/InitialContextFactory.java \
+javax/naming/spi/InitialContextFactoryBuilder.java \
+javax/naming/spi/NamingManager.java \
+javax/naming/spi/ObjectFactory.java \
+javax/naming/spi/Resolver.java \
+javax/naming/spi/DirObjectFactory.java \
+javax/naming/spi/DirStateFactory.java \
+javax/naming/spi/DirectoryManager.java \
+javax/naming/spi/ObjectFactoryBuilder.java \
+javax/naming/spi/ResolveResult.java \
+javax/naming/spi/StateFactory.java \
+javax/naming/InvalidNameException.java \
+javax/naming/Binding.java \
+javax/naming/CompositeName.java \
+javax/naming/CompoundName.java \
+javax/naming/LinkRef.java \
+javax/naming/NameClassPair.java \
+javax/naming/ldap/Control.java \
+javax/naming/ldap/ControlFactory.java \
+javax/naming/ldap/ExtendedRequest.java \
+javax/naming/ldap/ExtendedResponse.java \
+javax/naming/ldap/HasControls.java \
+javax/naming/ldap/InitialLdapContext.java \
+javax/naming/ldap/LdapContext.java \
+javax/naming/ldap/LdapReferralException.java \
+javax/naming/ldap/UnsolicitedNotification.java \
+javax/naming/ldap/UnsolicitedNotificationEvent.java \
+javax/naming/ldap/UnsolicitedNotificationListener.java \
+javax/naming/OperationNotSupportedException.java \
+javax/transaction/xa/XAException.java \
+javax/transaction/xa/XAResource.java \
+javax/transaction/xa/Xid.java \
+javax/transaction/HeuristicCommitException.java \
+javax/transaction/HeuristicMixedException.java \
+javax/transaction/HeuristicRollbackException.java \
+javax/transaction/InvalidTransactionException.java \
+javax/transaction/NotSupportedException.java \
+javax/transaction/RollbackException.java \
+javax/transaction/Status.java \
+javax/transaction/Synchronization.java \
+javax/transaction/SystemException.java \
+javax/transaction/Transaction.java \
+javax/transaction/TransactionManager.java \
+javax/transaction/TransactionRequiredException.java \
+javax/transaction/TransactionRolledbackException.java \
+javax/transaction/UserTransaction.java
+
+
built_java_source_files = java/lang/ConcreteProcess.java \
gnu/classpath/Configuration.java
@@ -1208,7 +1316,8 @@ org/xml/sax/XMLFilter.java \
org/xml/sax/XMLReader.java \
$(rmi_java_source_files) \
$(awt_java_source_files) \
-$(convert_source_files)
+$(convert_source_files) \
+$(javax_source_files)
java_source_files = $(special_java_source_files) $(ordinary_java_source_files)
@@ -2140,7 +2249,105 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/java/util/zip/ZipException.P .deps/java/util/zip/ZipFile.P \
.deps/java/util/zip/ZipInputStream.P \
.deps/java/util/zip/ZipOutputStream.P .deps/java/util/zip/natDeflater.P \
-.deps/java/util/zip/natInflater.P .deps/jni.P .deps/name-finder.P \
+.deps/java/util/zip/natInflater.P \
+.deps/javax/naming/AuthenticationException.P \
+.deps/javax/naming/AuthenticationNotSupportedException.P \
+.deps/javax/naming/BinaryRefAddr.P .deps/javax/naming/Binding.P \
+.deps/javax/naming/CannotProceedException.P \
+.deps/javax/naming/CommunicationException.P \
+.deps/javax/naming/CompositeName.P .deps/javax/naming/CompoundName.P \
+.deps/javax/naming/ConfigurationException.P \
+.deps/javax/naming/Context.P \
+.deps/javax/naming/ContextNotEmptyException.P \
+.deps/javax/naming/InitialContext.P \
+.deps/javax/naming/InsufficientResourcesException.P \
+.deps/javax/naming/InterruptedNamingException.P \
+.deps/javax/naming/InvalidNameException.P \
+.deps/javax/naming/LimitExceededException.P \
+.deps/javax/naming/LinkException.P \
+.deps/javax/naming/LinkLoopException.P .deps/javax/naming/LinkRef.P \
+.deps/javax/naming/MalformedLinkException.P .deps/javax/naming/Name.P \
+.deps/javax/naming/NameAlreadyBoundException.P \
+.deps/javax/naming/NameClassPair.P \
+.deps/javax/naming/NameNotFoundException.P \
+.deps/javax/naming/NameParser.P .deps/javax/naming/NamingEnumeration.P \
+.deps/javax/naming/NamingException.P \
+.deps/javax/naming/NamingSecurityException.P \
+.deps/javax/naming/NoInitialContextException.P \
+.deps/javax/naming/NoPermissionException.P \
+.deps/javax/naming/NotContextException.P \
+.deps/javax/naming/OperationNotSupportedException.P \
+.deps/javax/naming/PartialResultException.P \
+.deps/javax/naming/RefAddr.P .deps/javax/naming/Reference.P \
+.deps/javax/naming/Referenceable.P \
+.deps/javax/naming/ReferralException.P \
+.deps/javax/naming/ServiceUnavailableException.P \
+.deps/javax/naming/SizeLimitExceededException.P \
+.deps/javax/naming/StringRefAddr.P \
+.deps/javax/naming/TimeLimitExceededException.P \
+.deps/javax/naming/directory/Attribute.P \
+.deps/javax/naming/directory/AttributeInUseException.P \
+.deps/javax/naming/directory/AttributeModificationException.P \
+.deps/javax/naming/directory/Attributes.P \
+.deps/javax/naming/directory/BasicAttribute.P \
+.deps/javax/naming/directory/BasicAttributes.P \
+.deps/javax/naming/directory/DirContext.P \
+.deps/javax/naming/directory/InitialDirContext.P \
+.deps/javax/naming/directory/InvalidAttributeIdentifierException.P \
+.deps/javax/naming/directory/InvalidAttributeValueException.P \
+.deps/javax/naming/directory/InvalidAttributesException.P \
+.deps/javax/naming/directory/InvalidSearchControlsException.P \
+.deps/javax/naming/directory/InvalidSearchFilterException.P \
+.deps/javax/naming/directory/ModificationItem.P \
+.deps/javax/naming/directory/NoSuchAttributeException.P \
+.deps/javax/naming/directory/SchemaViolationException.P \
+.deps/javax/naming/directory/SearchControls.P \
+.deps/javax/naming/directory/SearchResult.P \
+.deps/javax/naming/event/EventContext.P \
+.deps/javax/naming/event/EventDirContext.P \
+.deps/javax/naming/event/NamespaceChangeListener.P \
+.deps/javax/naming/event/NamingEvent.P \
+.deps/javax/naming/event/NamingExceptionEvent.P \
+.deps/javax/naming/event/NamingListener.P \
+.deps/javax/naming/event/ObjectChangeListener.P \
+.deps/javax/naming/ldap/Control.P \
+.deps/javax/naming/ldap/ControlFactory.P \
+.deps/javax/naming/ldap/ExtendedRequest.P \
+.deps/javax/naming/ldap/ExtendedResponse.P \
+.deps/javax/naming/ldap/HasControls.P \
+.deps/javax/naming/ldap/InitialLdapContext.P \
+.deps/javax/naming/ldap/LdapContext.P \
+.deps/javax/naming/ldap/LdapReferralException.P \
+.deps/javax/naming/ldap/UnsolicitedNotification.P \
+.deps/javax/naming/ldap/UnsolicitedNotificationEvent.P \
+.deps/javax/naming/ldap/UnsolicitedNotificationListener.P \
+.deps/javax/naming/spi/DirObjectFactory.P \
+.deps/javax/naming/spi/DirStateFactory.P \
+.deps/javax/naming/spi/DirectoryManager.P \
+.deps/javax/naming/spi/InitialContextFactory.P \
+.deps/javax/naming/spi/InitialContextFactoryBuilder.P \
+.deps/javax/naming/spi/NamingManager.P \
+.deps/javax/naming/spi/ObjectFactory.P \
+.deps/javax/naming/spi/ObjectFactoryBuilder.P \
+.deps/javax/naming/spi/ResolveResult.P \
+.deps/javax/naming/spi/Resolver.P .deps/javax/naming/spi/StateFactory.P \
+.deps/javax/transaction/HeuristicCommitException.P \
+.deps/javax/transaction/HeuristicMixedException.P \
+.deps/javax/transaction/HeuristicRollbackException.P \
+.deps/javax/transaction/InvalidTransactionException.P \
+.deps/javax/transaction/NotSupportedException.P \
+.deps/javax/transaction/RollbackException.P \
+.deps/javax/transaction/Status.P \
+.deps/javax/transaction/Synchronization.P \
+.deps/javax/transaction/SystemException.P \
+.deps/javax/transaction/Transaction.P \
+.deps/javax/transaction/TransactionManager.P \
+.deps/javax/transaction/TransactionRequiredException.P \
+.deps/javax/transaction/TransactionRolledbackException.P \
+.deps/javax/transaction/UserTransaction.P \
+.deps/javax/transaction/xa/XAException.P \
+.deps/javax/transaction/xa/XAResource.P \
+.deps/javax/transaction/xa/Xid.P .deps/jni.P .deps/name-finder.P \
.deps/no-threads.P .deps/nogc.P .deps/org/w3c/dom/Attr.P \
.deps/org/w3c/dom/CDATASection.P .deps/org/w3c/dom/CharacterData.P \
.deps/org/w3c/dom/Comment.P .deps/org/w3c/dom/DOMException.P \
@@ -2718,7 +2925,7 @@ libgcj.jar: $(built_java_source_files) $(java_source_files) $(x_java_source_file
done; \
test "$$fail" = no)
-@rm -f tmp-list libgcj.jar
- find java gnu org -type d -o -type f -name '*.class' | \
+ find java gnu javax org -type d -o -type f -name '*.class' | \
sed -e '/\/\./d' -e '/\/xlib/d' | \
$(ZIP) cfM0E@ $@
diff --git a/libjava/javax/naming/BinaryRefAddr.java b/libjava/javax/naming/BinaryRefAddr.java
index f44e43f..7206ab3 100644
--- a/libjava/javax/naming/BinaryRefAddr.java
+++ b/libjava/javax/naming/BinaryRefAddr.java
@@ -86,17 +86,17 @@ public class BinaryRefAddr extends RefAddr
* the addrType is the same as this addrType and the bytes of the
* content are the same.
*/
- public boolean equal(Object o)
+ public boolean equals (Object o)
{
if (o instanceof BinaryRefAddr)
{
BinaryRefAddr refAddr = (BinaryRefAddr) o;
if (this.getType().equals(refAddr.getType()))
- {
- byte[] c1 = (byte[]) this.getContent();
- byte[] c2 = (byte[]) refAddr.getContent();
- return Arrays.equals(c1, c2);
- }
+ {
+ byte[] c1 = (byte[]) this.getContent();
+ byte[] c2 = (byte[]) refAddr.getContent();
+ return Arrays.equals(c1, c2);
+ }
}
return false;
}
diff --git a/libjava/javax/naming/Binding.java b/libjava/javax/naming/Binding.java
new file mode 100644
index 0000000..e8ee4a2
--- /dev/null
+++ b/libjava/javax/naming/Binding.java
@@ -0,0 +1,68 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date May 16, 2001
+ */
+public class Binding extends NameClassPair
+{
+ public Binding (String name, Object obj)
+ {
+ super (name, null);
+ boundObj = obj;
+ }
+
+ public Binding (String name, Object obj, boolean isRelative)
+ {
+ super (name, null, isRelative);
+ boundObj = obj;
+ }
+
+ public Binding (String name, String className, Object obj)
+ {
+ super (name, className);
+ boundObj = obj;
+ }
+
+ public Binding (String name, String className, Object obj,
+ boolean isRelative)
+ {
+ super (name, className, isRelative);
+ boundObj = obj;
+ }
+
+ public String getClassName ()
+ {
+ String r = super.getClassName ();
+ if (r != null)
+ return r;
+ return boundObj == null ? null : boundObj.getClass ().getName ();
+ }
+
+ public Object getObject ()
+ {
+ return boundObj;
+ }
+
+ public void setObject (Object obj)
+ {
+ boundObj = obj;
+ }
+
+ public String toString ()
+ {
+ // Format specified by the documentation.
+ return super.toString () + ":" + boundObj.toString ();
+ }
+
+ // This name is fixed by the serialization spec.
+ private Object boundObj;
+}
diff --git a/libjava/javax/naming/CannotProceedException.java b/libjava/javax/naming/CannotProceedException.java
index 4b0ea2a..f35e147 100644
--- a/libjava/javax/naming/CannotProceedException.java
+++ b/libjava/javax/naming/CannotProceedException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -9,9 +9,21 @@ details. */
package javax.naming;
import java.lang.Exception;
+import java.util.Hashtable;
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 14, 2001
+ */
+
public class CannotProceedException extends NamingException
{
+ // Serialized fields.
+ protected Name remainingNewName;
+ protected Hashtable environment;
+ protected Name altName;
+ protected Context altNameCtx;
+
public CannotProceedException ()
{
super ();
@@ -21,4 +33,44 @@ public class CannotProceedException extends NamingException
{
super (msg);
}
+
+ public Hashtable getEnvironment()
+ {
+ return environment;
+ }
+
+ public void setEnvironment(Hashtable environment)
+ {
+ this.environment = environment;
+ }
+
+ public Name getRemainingNewName()
+ {
+ return remainingNewName;
+ }
+
+ public void setRemainingNewName(Name newName)
+ {
+ remainingNewName = (Name) newName.clone();
+ }
+
+ public Name getAltName()
+ {
+ return altName;
+ }
+
+ public void setAltName(Name altName)
+ {
+ this.altName = altName;
+ }
+
+ public Context getAltNameCtx()
+ {
+ return altNameCtx;
+ }
+
+ public void setAltNameCtx(Context altNameCtx)
+ {
+ this.altNameCtx = altNameCtx;
+ }
}
diff --git a/libjava/javax/naming/CompositeName.java b/libjava/javax/naming/CompositeName.java
new file mode 100644
index 0000000..afc85d5
--- /dev/null
+++ b/libjava/javax/naming/CompositeName.java
@@ -0,0 +1,289 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date May 16, 2001
+ *
+ * FIXME: must write readObject and writeObject to conform to
+ * serialization spec.
+ */
+public class CompositeName implements Name, Cloneable, Serializable
+{
+ public CompositeName ()
+ {
+ elts = new Vector ();
+ }
+
+ protected CompositeName (Enumeration comps)
+ {
+ elts = new Vector ();
+ try
+ {
+ while (comps.hasMoreElements ())
+ elts.add (comps.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+
+ public CompositeName (String n) throws InvalidNameException
+ {
+ elts = new Vector ();
+ // Parse the string into its components.
+ final char no_quote = 'x'; // Use 'x' to mean no quoting.
+ char quote = no_quote;
+ boolean escaped = false;
+ StringBuffer new_element = new StringBuffer ();
+ for (int i = 0; i < n.length (); ++i)
+ {
+ char c = n.charAt (i);
+ if (escaped)
+ escaped = false;
+ else if (c == '\\')
+ {
+ escaped = true;
+ continue;
+ }
+ else if (quote != no_quote)
+ {
+ if (quote == c)
+ {
+ // The quotes must surround a complete component.
+ if (i + 1 < n.length () && n.charAt (i + 1) != '/')
+ throw new InvalidNameException ("close quote before end of component");
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ quote = no_quote;
+ continue;
+ }
+ // Otherwise, fall through.
+ }
+ // Quotes are only special at the start of a component.
+ else if (new_element.length () == 0
+ && (c == '\'' || c == '"'))
+ {
+ quote = c;
+ continue;
+ }
+ else if (c == '/')
+ {
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ continue;
+ }
+
+ new_element.append (c);
+ }
+
+ if (new_element.length () != 0)
+ elts.add (new_element.toString ());
+
+ // Error checking.
+ if (quote != no_quote)
+ throw new InvalidNameException ("unterminated quote");
+ if (escaped)
+ throw new InvalidNameException ("trailing escape character");
+ }
+
+ public Name add (int posn, String comp) throws InvalidNameException
+ {
+ elts.add (posn, comp);
+ return this;
+ }
+
+ public Name add (String comp) throws InvalidNameException
+ {
+ elts.add (comp);
+ return this;
+ }
+
+ public Name addAll (int posn, Name n) throws InvalidNameException
+ {
+ Enumeration e = n.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ {
+ elts.add (posn, e.nextElement ());
+ ++posn;
+ }
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Name addAll (Name suffix) throws InvalidNameException
+ {
+ Enumeration e = suffix.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ elts.add (e.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Object clone ()
+ {
+ return new CompositeName (elts.elements ());
+ }
+
+ public int compareTo (Object obj)
+ {
+ if (obj == null || ! (obj instanceof CompositeName))
+ throw new ClassCastException ("CompositeName.compareTo() expected CompositeName");
+ CompositeName cn = (CompositeName) obj;
+ int last = Math.min (cn.elts.size (), elts.size ());
+ for (int i = 0; i < last; ++i)
+ {
+ String f = (String) elts.get (i);
+ int comp = f.compareTo ((String) cn.elts.get (i));
+ if (comp != 0)
+ return comp;
+ }
+ return elts.size () - cn.elts.size ();
+ }
+
+ public boolean endsWith (Name n)
+ {
+ if (! (n instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ int delta = elts.size () - cn.elts.size ();
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ if (! cn.elts.get (i).equals (elts.get (delta + i)))
+ return false;
+ }
+ return true;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) obj;
+ return elts.equals (cn.elts);
+ }
+
+ public String get (int posn)
+ {
+ return (String) elts.get (posn);
+ }
+
+ public Enumeration getAll ()
+ {
+ return elts.elements ();
+ }
+
+ public Name getPrefix (int posn)
+ {
+ CompositeName cn = new CompositeName ();
+ for (int i = 0; i < posn; ++i)
+ cn.elts.add ((String) elts.get (i));
+ return cn;
+ }
+
+ public Name getSuffix (int posn)
+ {
+ if (posn > elts.size ())
+ throw new ArrayIndexOutOfBoundsException (posn);
+ CompositeName cn = new CompositeName ();
+ for (int i = posn; i < elts.size (); ++i)
+ cn.elts.add ((String) elts.get (i));
+ return cn;
+ }
+
+ public int hashCode ()
+ {
+ // Specified in documentation.
+ int h = 0;
+ for (int i = 0; i < elts.size (); ++i)
+ h += elts.get (i).hashCode ();
+ return h;
+ }
+
+ public boolean isEmpty ()
+ {
+ return elts.isEmpty ();
+ }
+
+ public Object remove (int posn) throws InvalidNameException
+ {
+ return elts.remove (posn);
+ }
+
+ public int size ()
+ {
+ return elts.size ();
+ }
+
+ public boolean startsWith (Name n)
+ {
+ if (! (n instanceof CompositeName))
+ return false;
+ CompositeName cn = (CompositeName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ if (! cn.elts.get (i).equals (elts.get (i)))
+ return false;
+ }
+ return true;
+ }
+
+ public String toString ()
+ {
+ StringBuffer result = new StringBuffer ();
+ for (int i = 0; i < elts.size (); ++i)
+ {
+ // For simplicity we choose to always quote using escapes and
+ // never quotes.
+ String elt = (String) elts.get (i);
+ if (i > 0
+ || (i == elts.size () - 1 && elt.equals ("")))
+ result.append ('/');
+ for (int k = 0; k < elt.length (); ++k)
+ {
+ char c = elt.charAt (k);
+ // We must quote
+ // ... a leading quote,
+ if ((k == 0 && (c == '"' || c == '\''))
+ // ... an escape preceding a meta character,
+ // or at the end of a component,
+ || (c == '\\'
+ && (k == elt.length () - 1
+ || "\\'\"/".indexOf (elt.charAt (k + 1)) != -1))
+ // ... or a component separator.
+ || c == '/')
+ result.append ('\\');
+ result.append (c);
+ }
+ }
+ return result.toString ();
+ }
+
+ private transient Vector elts;
+}
diff --git a/libjava/javax/naming/CompoundName.java b/libjava/javax/naming/CompoundName.java
new file mode 100644
index 0000000..4e9f5bd
--- /dev/null
+++ b/libjava/javax/naming/CompoundName.java
@@ -0,0 +1,460 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming;
+
+import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.NoSuchElementException;
+import java.util.Vector;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date May 16, 2001
+ *
+ * FIXME: must write readObject and writeObject to conform to
+ * serialization spec.
+ *
+ * FIXME: this class is underspecified. For instance, the `flat'
+ * direction is never described. If it means that the CompoundName
+ * can only have a single element, then the Enumeration-based
+ * constructor ought to throw InvalidNameException.
+ */
+public class CompoundName implements Name, Cloneable, Serializable
+{
+ private CompoundName (Properties syntax)
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+ }
+
+ protected CompoundName (Enumeration comps, Properties syntax)
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+ try
+ {
+ while (comps.hasMoreElements ())
+ elts.add (comps.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ }
+
+ public CompoundName (String n, Properties syntax)
+ throws InvalidNameException
+ {
+ elts = new Vector ();
+ mySyntax = syntax;
+ initializeSyntax ();
+
+ StringBuffer new_element = new StringBuffer ();
+ int i = 0;
+ // QUOTE==null means no quoting right now. When it is set it is
+ // the value of the closing quote.
+ String quote = null;
+ while (i < n.length ())
+ {
+ String special = isSpecial (n, i);
+
+ if (special == escape && escape != null)
+ {
+ if (n.length () == i + special.length ())
+ {
+ // A trailing escape is treated as itself.
+ new_element.append (special);
+ i += special.length ();
+ }
+ else
+ {
+ String eSpecial = isSpecial (n, i + special.length ());
+ if (eSpecial != null)
+ {
+ // Treat the escape as an escape.
+ new_element.append (eSpecial);
+ i += special.length () + eSpecial.length ();
+ }
+ else
+ {
+ // Treat the escape as itself.
+ new_element.append (special);
+ i += special.length ();
+ }
+ continue;
+ }
+ }
+ else if (quote != null)
+ {
+ // It is safe to use == here.
+ if (quote == special)
+ {
+ // Quotes must surround a complete component.
+ if (i + quote.length () < n.length ()
+ && ! n.startsWith (separator, i + quote.length ()))
+ throw new InvalidNameException ("close quote before end of component");
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ i += quote.length ();
+ quote = null;
+ continue;
+ }
+ // Otherwise, fall through.
+ }
+ // Quotes are only special at the start of a component.
+ else if (new_element.length () == 0 && special == beginQuote)
+ {
+ quote = endQuote;
+ i += special.length ();
+ continue;
+ }
+ else if (new_element.length () == 0 && special == beginQuote2)
+ {
+ quote = endQuote2;
+ i += special.length ();
+ continue;
+ }
+ else if (special == separator)
+ {
+ elts.add (new_element.toString ());
+ new_element.setLength (0);
+ i += special.length ();
+ continue;
+ }
+
+ // Nothing in particular, so try the next character.
+ new_element.append (n.charAt (i));
+ ++i;
+ }
+
+ if (new_element.length () != 0)
+ elts.add (new_element.toString ());
+
+ if (direction == RIGHT_TO_LEFT)
+ {
+ // Reverse the order of the elements.
+ int len = elts.size ();
+ for (i = 0; i < len / 2; ++i)
+ {
+ Object t = elts.set (i, elts.get (len - i - 1));
+ elts.set (len - i - 1, t);
+ }
+ }
+
+ // Error checking.
+ if (quote != null)
+ throw new InvalidNameException ("unterminated quote");
+ }
+
+ public Name add (int posn, String comp) throws InvalidNameException
+ {
+ elts.add (posn, comp);
+ return this;
+ }
+
+ public Name add (String comp) throws InvalidNameException
+ {
+ elts.add (comp);
+ return this;
+ }
+
+ public Name addAll (int posn, Name n) throws InvalidNameException
+ {
+ Enumeration e = n.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ {
+ elts.add (posn, e.nextElement ());
+ ++posn;
+ }
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Name addAll (Name suffix) throws InvalidNameException
+ {
+ Enumeration e = suffix.getAll ();
+ try
+ {
+ while (e.hasMoreElements ())
+ elts.add (e.nextElement ());
+ }
+ catch (NoSuchElementException ignore)
+ {
+ }
+ return this;
+ }
+
+ public Object clone ()
+ {
+ return new CompoundName (elts.elements (), mySyntax);
+ }
+
+ public int compareTo (Object obj)
+ {
+ if (obj == null || ! (obj instanceof CompoundName))
+ throw new ClassCastException ("CompoundName.compareTo() expected CompoundName");
+ CompoundName cn = (CompoundName) obj;
+ int last = Math.min (cn.elts.size (), elts.size ());
+ for (int i = 0; i < last; ++i)
+ {
+ String f = canonicalize ((String) elts.get (i));
+ int comp = f.compareTo (canonicalize ((String) cn.elts.get (i)));
+ if (comp != 0)
+ return comp;
+ }
+ return elts.size () - cn.elts.size ();
+ }
+
+ public boolean endsWith (Name n)
+ {
+ if (! (n instanceof CompoundName))
+ return false;
+ CompoundName cn = (CompoundName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ int delta = elts.size () - cn.elts.size ();
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ String f = canonicalize ((String) elts.get (i));
+ if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ return false;
+ }
+ return true;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof CompoundName))
+ return false;
+ return compareTo (obj) == 0;
+ }
+
+ public String get (int posn)
+ {
+ return (String) elts.get (posn);
+ }
+
+ public Enumeration getAll ()
+ {
+ return elts.elements ();
+ }
+
+ public Name getPrefix (int posn)
+ {
+ CompoundName cn = new CompoundName (mySyntax);
+ for (int i = 0; i < posn; ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public Name getSuffix (int posn)
+ {
+ if (posn > elts.size ())
+ throw new ArrayIndexOutOfBoundsException (posn);
+ CompoundName cn = new CompoundName (mySyntax);
+ for (int i = posn; i < elts.size (); ++i)
+ cn.elts.add (elts.get (i));
+ return cn;
+ }
+
+ public int hashCode ()
+ {
+ int h = 0;
+ for (int i = 0; i < elts.size (); ++i)
+ h += canonicalize ((String) elts.get (i)).hashCode ();
+ return h;
+ }
+
+ public boolean isEmpty ()
+ {
+ return elts.isEmpty ();
+ }
+
+ public Object remove (int posn) throws InvalidNameException
+ {
+ return elts.remove (posn);
+ }
+
+ public int size ()
+ {
+ return elts.size ();
+ }
+
+ public boolean startsWith (Name n)
+ {
+ if (! (n instanceof CompoundName))
+ return false;
+ CompoundName cn = (CompoundName) n;
+ if (cn.elts.size () > elts.size ())
+ return false;
+ for (int i = 0; i < cn.elts.size (); ++i)
+ {
+ String f = canonicalize ((String) elts.get (i));
+ if (! f.equals (canonicalize ((String) cn.elts.get (i))))
+ return false;
+ }
+ return true;
+ }
+
+ // If ELEMENT starts with some meta-sequence at OFFSET, then return
+ // the string representing the meta-sequence. Otherwise return
+ // null.
+ private String isSpecial (String element, int offset)
+ {
+ String special = null;
+ if (separator != null && element.startsWith (separator, offset))
+ special = separator;
+ else if (escape != null && element.startsWith (escape, offset))
+ special = escape;
+ else if (beginQuote != null && element.startsWith (beginQuote, offset))
+ special = beginQuote;
+ else if (endQuote != null && element.startsWith (endQuote, offset))
+ special = endQuote;
+ else if (beginQuote2 != null
+ && element.startsWith (beginQuote2, offset))
+ special = beginQuote2;
+ else if (endQuote2 != null && element.startsWith (endQuote2, offset))
+ special = endQuote2;
+
+ return special;
+ }
+
+ public String toString ()
+ {
+ StringBuffer result = new StringBuffer ();
+ int size = elts.size ();
+ for (int i = 0; i < size; ++i)
+ {
+ // Find the appropriate element. FIXME: not clear what FLAT
+ // means.
+ int offset = (direction == RIGHT_TO_LEFT) ? (size - i - 1) : i;
+ String element = (String) elts.get (offset);
+ if (i > 0
+ || (i == size - 1 && element.equals ("")))
+ result.append (separator);
+
+ int k = 0;
+ while (k < element.length ())
+ {
+ String special = isSpecial (element, k);
+ if (special != null)
+ {
+ result.append (escape);
+ result.append (special);
+ k += special.length ();
+ }
+ else
+ {
+ result.append (element.charAt (k));
+ ++k;
+ }
+ }
+ }
+
+ return result.toString ();
+ }
+
+ // This canonicalizes a String, based on the syntax, for comparison
+ // or other similar purposes.
+ private String canonicalize (String element)
+ {
+ String ret = element;
+
+ if (ignoreCase)
+ ret = ret.toLowerCase ();
+
+ if (trimBlanks)
+ {
+ int first = 0;
+ while (first < ret.length ()
+ && Character.isWhitespace (ret.charAt (first)))
+ ++first;
+
+ int last = ret.length () - 1;
+ while (last >= first
+ && Character.isWhitespace (ret.charAt (last)))
+ --last;
+
+ ret = ret.substring (first, last);
+ }
+
+ return ret;
+ }
+
+ // This initializes all the syntax variables. This seems easier
+ // than re-querying the properties every time. We're allowed to do
+ // this because the spec says that subclasses should consider the
+ // syntax as being read-only.
+ private void initializeSyntax ()
+ {
+ String t = mySyntax.getProperty ("jndi.syntax.direction", "flat");
+ if (t.equals ("right_to_left"))
+ this.direction = RIGHT_TO_LEFT;
+ else if (t.equals ("left_to_right"))
+ this.direction = LEFT_TO_RIGHT;
+ else
+ {
+ // If we don't recognize it, default to flat.
+ this.direction = FLAT;
+ }
+
+ // This is required unless the direction is FLAT. Unfortunately
+ // there is no way to report this error.
+ this.separator = mySyntax.getProperty ("jndi.syntax.separator", "");
+
+ this.ignoreCase
+ = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.ignorecase",
+ "false")).booleanValue ();
+ this.escape = mySyntax.getProperty ("jndi.syntax.escape", null);
+ this.beginQuote = mySyntax.getProperty ("jndi.syntax.beginquote", null);
+ this.endQuote = mySyntax.getProperty ("jndi.syntax.endquote",
+ this.beginQuote);
+ this.beginQuote2 = mySyntax.getProperty ("jndi.syntax.beginquote2",
+ null);
+ this.endQuote2 = mySyntax.getProperty ("jndi.syntax.endquote2",
+ this.beginQuote2);
+ this.trimBlanks
+ = Boolean.valueOf (mySyntax.getProperty ("jndi.syntax.trimblanks",
+ "false")).booleanValue ();
+ }
+
+ // The spec specifies this but does not document it in any way (it
+ // is a package-private class). It is useless as far as I can tell.
+ // So we ignore it.
+ // protected transient NameImpl impl;
+ protected transient Properties mySyntax;
+
+ // The actual elements.
+ private transient Vector elts;
+
+ // The following are all used for syntax.
+ private transient int direction;
+ private transient String separator;
+ private transient boolean ignoreCase;
+ private transient String escape;
+ private transient String beginQuote;
+ private transient String endQuote;
+ private transient String beginQuote2;
+ private transient String endQuote2;
+ private transient boolean trimBlanks;
+ // We didn't need these for parsing, so they are gone.
+ // private transient String avaSeparator;
+ // private transient String typevalSeparator;
+
+ private static final int RIGHT_TO_LEFT = -1;
+ private static final int LEFT_TO_RIGHT = 1;
+ private static final int FLAT = 0;
+}
diff --git a/libjava/javax/naming/LinkException.java b/libjava/javax/naming/LinkException.java
index 90798c1..6512c92 100644
--- a/libjava/javax/naming/LinkException.java
+++ b/libjava/javax/naming/LinkException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -10,8 +10,19 @@ package javax.naming;
import java.lang.Exception;
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 14, 2001
+ */
+
public class LinkException extends NamingException
{
+ // Serialized fields.
+ protected Name linkResolvedName;
+ protected Object linkResolvedObj;
+ protected Name linkRemainingName;
+ protected String linkExplanation;
+
public LinkException ()
{
super ();
@@ -21,4 +32,57 @@ public class LinkException extends NamingException
{
super (msg);
}
+
+ public Name getLinkResolvedName()
+ {
+ return linkResolvedName;
+ }
+
+ public Name getLinkRemainingName()
+ {
+ return linkRemainingName;
+ }
+
+ public Object getLinkResolvedObj()
+ {
+ return linkResolvedObj;
+ }
+
+ public String getLinkExplanation()
+ {
+ return linkExplanation;
+ }
+
+ public void setLinkExplanation(String msg)
+ {
+ linkExplanation = msg;
+ }
+
+ public void setLinkResolvedName(Name name)
+ {
+ linkResolvedName = (Name) name.clone();
+ }
+
+ public void setLinkRemainingName(Name name)
+ {
+ linkRemainingName = (Name) name.clone();
+ }
+
+ public void setLinkResolvedObj(Object obj)
+ {
+ linkResolvedObj = obj;
+ }
+
+ public String toString ()
+ {
+ return super.toString () + "; " + linkRemainingName.toString ();
+ }
+
+ public String toString (boolean detail)
+ {
+ String r = super.toString (detail) + "; " + linkRemainingName.toString ();
+ if (detail)
+ r += "; " + linkResolvedObj.toString ();
+ return r;
+ }
}
diff --git a/libjava/javax/naming/LinkRef.java b/libjava/javax/naming/LinkRef.java
new file mode 100644
index 0000000..703eb74
--- /dev/null
+++ b/libjava/javax/naming/LinkRef.java
@@ -0,0 +1,35 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming;
+
+import java.io.Serializable;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date May 16, 2001
+ */
+public class LinkRef extends Reference
+{
+ public LinkRef (Name name)
+ {
+ this (name.toString ());
+ }
+
+ public LinkRef (String name)
+ {
+ // FIXME: javax.naming.LinkRef?
+ super ("LinkRef", new StringRefAddr ("LinkAddress", name));
+ }
+
+ public String getLinkName ()
+ {
+ StringRefAddr sra = (StringRefAddr) get (0);
+ return (String) sra.getContent ();
+ }
+}
diff --git a/libjava/javax/naming/NameClassPair.java b/libjava/javax/naming/NameClassPair.java
new file mode 100644
index 0000000..3d4c0a7
--- /dev/null
+++ b/libjava/javax/naming/NameClassPair.java
@@ -0,0 +1,71 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming;
+
+import java.io.Serializable;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date May 16, 2001
+ */
+public class NameClassPair implements Serializable
+{
+ public NameClassPair (String name, String className)
+ {
+ this (name, className, true);
+ }
+
+ public NameClassPair (String name, String className, boolean isRelative)
+ {
+ this.name = name;
+ this.className = className;
+ this.isRel = isRelative;
+ }
+
+ public String getClassName ()
+ {
+ return className;
+ }
+
+ public String getName ()
+ {
+ return name;
+ }
+
+ public boolean isRelative ()
+ {
+ return isRel;
+ }
+
+ public void setClassName (String name)
+ {
+ this.className = name;
+ }
+
+ public void setName (String name)
+ {
+ this.name = name;
+ }
+
+ public void setRelative (boolean r)
+ {
+ this.isRel = r;
+ }
+
+ public String toString ()
+ {
+ // Specified by class documentation.
+ return name + ":" + className;
+ }
+
+ // These field names are fixed by the serialization spec.
+ private String name;
+ private String className;
+ private boolean isRel;
+}
diff --git a/libjava/javax/naming/RefAddr.java b/libjava/javax/naming/RefAddr.java
index 4c1659c..8043fb2 100644
--- a/libjava/javax/naming/RefAddr.java
+++ b/libjava/javax/naming/RefAddr.java
@@ -60,9 +60,9 @@ public abstract class RefAddr implements Serializable
*/
protected RefAddr(String addrType)
{
- if (addrType == null)
- throw new NullPointerException("addrType cannot be null");
-
+ if (addrType == null)
+ throw new NullPointerException("addrType cannot be null");
+
this.addrType = addrType;
}
@@ -87,20 +87,20 @@ public abstract class RefAddr implements Serializable
* is the same as this addrType and the content is equals to the
* content of this object.
*/
- public boolean equal(Object o)
+ public boolean equals (Object o)
{
if (o instanceof RefAddr)
{
RefAddr refAddr = (RefAddr) o;
if (this.getType().equals(refAddr.getType()))
- {
- Object c1 = this.getContent();
- Object c2 = refAddr.getContent();
- if (c1 == null)
- return c2 == null;
- else
- return c1.equals(c2);
- }
+ {
+ Object c1 = this.getContent();
+ Object c2 = refAddr.getContent();
+ if (c1 == null)
+ return c2 == null;
+ else
+ return c1.equals(c2);
+ }
}
return false;
}
diff --git a/libjava/javax/naming/Reference.java b/libjava/javax/naming/Reference.java
index 79cecc3..dbd3418 100644
--- a/libjava/javax/naming/Reference.java
+++ b/libjava/javax/naming/Reference.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -9,22 +9,105 @@ details. */
package javax.naming;
import java.io.Serializable;
+import java.util.Enumeration;
+import java.util.Vector;
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date May 16, 2001
+ */
public class Reference implements Cloneable, Serializable
{
+ public Reference (String className)
+ {
+ this.className = className;
+ addrs = new Vector ();
+ }
+
+ public Reference (String className, RefAddr addr)
+ {
+ this.className = className;
+ addrs = new Vector ();
+ addrs.add (addr);
+ }
+
public Reference (String className, String factory, String factoryLocation)
{
this.className = className;
+ this.classFactory = factory;
+ this.classFactoryLocation = factoryLocation;
+ addrs = new Vector ();
+ }
+
+ public Reference (String className, RefAddr addr,
+ String factory, String factoryLocation)
+ {
+ this.className = className;
+ this.classFactory = factory;
+ this.classFactoryLocation = factoryLocation;
+ addrs = new Vector ();
+ addrs.add (addr);
+ }
+
+ public void add (int posn, RefAddr addr)
+ {
+ addrs.add (posn, addr);
}
- void add (RefAddr addr)
+ public void add (RefAddr addr)
{
- throw new Error ("javax.naming.Reference.add not implemented");
+ addrs.add (addr);
}
- RefAddr get (String addrType)
+ public void clear ()
{
- throw new Error ("javax.naming.Reference.get not implemented");
+ addrs.clear ();
+ }
+
+ public Object clone ()
+ {
+ Reference r = new Reference (className, classFactory,
+ classFactoryLocation);
+ r.addrs = (Vector) addrs.clone ();
+ return r;
+ }
+
+ // Convenience function.
+ private boolean equals (String a, String b)
+ {
+ return (a == null) ? (b == null) : a.equals (b);
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof Reference))
+ return false;
+ Reference r = (Reference) obj;
+ return (equals (classFactory, r.classFactory)
+ && equals (classFactoryLocation, r.classFactoryLocation)
+ && equals (className, r.className)
+ && addrs.equals (r.addrs));
+ }
+
+ public RefAddr get (int posn)
+ {
+ return (RefAddr) addrs.get (posn);
+ }
+
+ public RefAddr get (String addrType)
+ {
+ for (int i = 0; i < addrs.size (); ++i)
+ {
+ RefAddr r = (RefAddr) addrs.get (i);
+ if (addrType.equals (r.getType ()))
+ return r;
+ }
+ return null;
+ }
+
+ public Enumeration getAll ()
+ {
+ return addrs.elements ();
}
public String getClassName ()
@@ -32,5 +115,50 @@ public class Reference implements Cloneable, Serializable
return className;
}
- private String className;
+ public String getFactoryClassLocation ()
+ {
+ return classFactoryLocation;
+ }
+
+ public String getFactoryClassName ()
+ {
+ return classFactory;
+ }
+
+ public int hashCode ()
+ {
+ // The spec says the hash code is the sum of the hash codes of the
+ // addresses. It does not mention the other fields.
+ int h = 0;
+ for (int i = 0; i < addrs.size (); ++i)
+ h += addrs.get (i).hashCode ();
+ return h;
+ }
+
+ public Object remove (int posn)
+ {
+ return addrs.remove (posn);
+ }
+
+ public int size ()
+ {
+ return addrs.size ();
+ }
+
+ public String toString ()
+ {
+ String x = getClass ().toString () + "[";
+ for (int i = 0; i < addrs.size (); ++i)
+ {
+ if (i > 0)
+ x += ",";
+ x += addrs.get (i).toString ();
+ }
+ return x + "]";
+ }
+
+ protected Vector addrs;
+ protected String classFactory;
+ protected String classFactoryLocation;
+ protected String className;
}
diff --git a/libjava/javax/naming/ReferralException.java b/libjava/javax/naming/ReferralException.java
index e8697c1..9e815f9 100644
--- a/libjava/javax/naming/ReferralException.java
+++ b/libjava/javax/naming/ReferralException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -9,16 +9,29 @@ details. */
package javax.naming;
import java.lang.Exception;
+import java.util.Hashtable;
-public class ReferralException extends NamingException
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 14, 2001
+ */
+
+public abstract class ReferralException extends NamingException
{
- public ReferralException ()
+ protected ReferralException ()
{
super ();
}
- public ReferralException (String msg)
+ protected ReferralException (String msg)
{
super (msg);
}
+
+ public abstract Object getReferralInfo();
+ public abstract Context getReferralContext() throws NamingException;
+ public abstract Context getReferralContext(Hashtable env)
+ throws NamingException;
+ public abstract boolean skipReferral();
+ public abstract void retryReferral();
}
diff --git a/libjava/javax/naming/directory/Attribute.java b/libjava/javax/naming/directory/Attribute.java
index ec3861c..5c2b933 100644
--- a/libjava/javax/naming/directory/Attribute.java
+++ b/libjava/javax/naming/directory/Attribute.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -11,10 +11,30 @@ package javax.naming.directory;
import javax.naming.*;
import java.io.Serializable;
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 14, 2001
+ */
+
public interface Attribute extends Cloneable, Serializable
{
- // FIXME
+ // FIXME: Need to set value from JNDI 1.1.1 fro interoperability.
+ // public static final long serialVersionUID = ;
- NamingEnumeration getAll ();
+ public NamingEnumeration getAll() throws NamingException;
+ public Object get() throws NamingException;
+ public int size();
+ public String getID();
+ public boolean contains(Object attrVal);
+ public boolean add(Object attrVal);
+ public boolean remove(Object attrval);
+ public void clear();
+ public DirContext getAttributeSyntaxDefinition() throws NamingException;
+ public DirContext getAttributeDefinition() throws NamingException;
+ public Object clone();
+ public boolean isOrdered();
+ public Object get(int ix) throws NamingException;
+ public Object remove(int ix);
+ public void add(int ix, Object attrVal);
+ public Object set(int ix, Object attrVal);
}
-
diff --git a/libjava/javax/naming/directory/AttributeInUseException.java b/libjava/javax/naming/directory/AttributeInUseException.java
index 8a2cf2f..118d991 100644
--- a/libjava/javax/naming/directory/AttributeInUseException.java
+++ b/libjava/javax/naming/directory/AttributeInUseException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class AttributeInUseException extends NamingException
{
diff --git a/libjava/javax/naming/directory/AttributeModificationException.java b/libjava/javax/naming/directory/AttributeModificationException.java
index 208e693..898f7a4 100644
--- a/libjava/javax/naming/directory/AttributeModificationException.java
+++ b/libjava/javax/naming/directory/AttributeModificationException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,12 +6,20 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 14, 2001
+ */
public class AttributeModificationException extends NamingException
{
+ // Serialized fields.
+ private ModificationItem[] unexecs;
+
public AttributeModificationException ()
{
super ();
@@ -21,4 +29,19 @@ public class AttributeModificationException extends NamingException
{
super (msg);
}
+
+ public void setUnexecutedModifications(ModificationItem[] e)
+ {
+ unexecs = e;
+ }
+
+ public ModificationItem[] getUnexecutedModifications()
+ {
+ return unexecs;
+ }
+
+ public String toString()
+ {
+ return super.toString () + ": " + unexecs[0].toString ();
+ }
}
diff --git a/libjava/javax/naming/directory/Attributes.java b/libjava/javax/naming/directory/Attributes.java
index 7d7c953..f76d593 100644
--- a/libjava/javax/naming/directory/Attributes.java
+++ b/libjava/javax/naming/directory/Attributes.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -11,10 +11,21 @@ package javax.naming.directory;
import javax.naming.*;
import java.io.Serializable;
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 14, 2001
+ */
+
public interface Attributes extends Cloneable, Serializable
{
- // FIXME
-
- NamingEnumeration getAll ();
+ public boolean isCaseIgnored();
+ public int size();
+ public Attribute get(String attrID);
+ public NamingEnumeration getAll();
+ public NamingEnumeration getIDs();
+ public Attribute put(String attrID, Object val);
+ public Attribute put(Attribute attr);
+ public Attribute remove(String attrID);
+ public Object clone();
}
diff --git a/libjava/javax/naming/directory/BasicAttribute.java b/libjava/javax/naming/directory/BasicAttribute.java
new file mode 100644
index 0000000..8ccb67a
--- /dev/null
+++ b/libjava/javax/naming/directory/BasicAttribute.java
@@ -0,0 +1,298 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.directory;
+
+import javax.naming.*;
+import java.util.*;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date June 20, 2001
+ */
+public class BasicAttribute implements Attribute
+{
+ /** The ID of this attribute. */
+ protected String attrID;
+ /** True if this attribute's values are ordered. */
+ protected boolean ordered;
+ /** Values for this attribute. */
+ protected transient Vector values;
+
+ // Used by cloning.
+ private BasicAttribute ()
+ {
+ }
+
+ public BasicAttribute (String id)
+ {
+ this (id, false);
+ }
+
+ public BasicAttribute (String id, boolean ordered)
+ {
+ attrID = id;
+ this.ordered = ordered;
+ values = new Vector ();
+ }
+
+ public BasicAttribute (String id, Object value)
+ {
+ this (id, value, false);
+ }
+
+ public BasicAttribute (String id, Object value, boolean ordered)
+ {
+ attrID = id;
+ this.ordered = ordered;
+ values = new Vector ();
+ values.add (value);
+ }
+
+ public void add (int index, Object val)
+ {
+ if (! ordered && contains (val))
+ throw new IllegalStateException ("value already in attribute");
+ values.add (index, val);
+ }
+
+ public boolean add (Object val)
+ {
+ if (! ordered && contains (val))
+ throw new IllegalStateException ("value already in attribute");
+ return values.add (val);
+ }
+
+ public void clear ()
+ {
+ values.clear ();
+ }
+
+ public Object clone ()
+ {
+ BasicAttribute c = new BasicAttribute ();
+ c.attrID = attrID;
+ c.ordered = ordered;
+ c.values = (Vector) values.clone ();
+ return c;
+ }
+
+ public boolean contains (Object val)
+ {
+ for (int i = 0; i < values.size (); ++i)
+ {
+ if (equals (val, values.get (i)))
+ return true;
+ }
+
+ return false;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof BasicAttribute))
+ return false;
+ BasicAttribute b = (BasicAttribute) obj;
+
+ if (ordered != b.ordered
+ || ! attrID.equals (b.attrID)
+ || values.size () != b.values.size ())
+ return false;
+
+ for (int i = 0; i < values.size (); ++i)
+ {
+ boolean ok = false;
+ if (ordered)
+ ok = equals (values.get (i), b.values.get (i));
+ else
+ {
+ for (int j = 0; j < b.values.size (); ++j)
+ {
+ if (equals (values.get (i), b.values.get (j)))
+ {
+ ok = true;
+ break;
+ }
+ }
+ }
+
+ if (! ok)
+ return false;
+ }
+
+ return true;
+ }
+
+ public Object get ()
+ {
+ if (values.size () == 0)
+ throw new NoSuchElementException ("no values");
+ return get (0);
+ }
+
+ public Object get (int index)
+ {
+ return values.get (index);
+ }
+
+ public NamingEnumeration getAll ()
+ {
+ return new BasicAttributeEnumeration ();
+ }
+
+ public DirContext getAttributeDefinition ()
+ throws OperationNotSupportedException, NamingException
+ {
+ throw new OperationNotSupportedException ();
+ }
+
+ public DirContext getAttributeSyntaxDefinition ()
+ throws OperationNotSupportedException, NamingException
+ {
+ throw new OperationNotSupportedException ();
+ }
+
+ public String getID ()
+ {
+ return attrID;
+ }
+
+ public int hashCode ()
+ {
+ int val = attrID.hashCode ();
+ for (int i = 0; i < values.size (); ++i)
+ {
+ Object o = values.get (i);
+ if (o == null)
+ {
+ // Nothing.
+ }
+ else if (o instanceof Object[])
+ {
+ Object[] a = (Object[]) o;
+ for (int j = 0; j < a.length; ++j)
+ val += a[j].hashCode ();
+ }
+ else
+ val += o.hashCode ();
+ }
+
+ return val;
+ }
+
+ public boolean isOrdered ()
+ {
+ return ordered;
+ }
+
+ public Object remove (int index)
+ {
+ return values.remove (index);
+ }
+
+ public boolean remove (Object val)
+ {
+ for (int i = 0; i < values.size (); ++i)
+ {
+ if (equals (val, values.get (i)))
+ {
+ values.remove (i);
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public Object set (int index, Object val)
+ {
+ if (! ordered && contains (val))
+ throw new IllegalStateException ("value already in attribute");
+ return values.set (index, val);
+ }
+
+ public int size ()
+ {
+ return values.size ();
+ }
+
+ public String toString ()
+ {
+ String r = attrID;
+ for (int i = 0; i < values.size (); ++i)
+ r += ";" + values.get (i).toString ();
+ return r;
+ }
+
+ // This is used for testing equality of two Objects according to our
+ // local rules.
+ private boolean equals (Object one, Object two)
+ {
+ if (one == null)
+ return two == null;
+
+ if (one instanceof Object[])
+ {
+ if (! (two instanceof Object[]))
+ return false;
+
+ Object[] aone = (Object[]) one;
+ Object[] atwo = (Object[]) two;
+
+ if (aone.length != atwo.length)
+ return false;
+
+ for (int i = 0; i < aone.length; ++i)
+ {
+ if (! aone[i].equals (atwo[i]))
+ return false;
+ }
+
+ return true;
+ }
+
+ return one.equals (two);
+ }
+
+ // Used when enumerating this attribute.
+ private class BasicAttributeEnumeration implements NamingEnumeration
+ {
+ int where = -1;
+
+ public BasicAttributeEnumeration ()
+ {
+ }
+
+ public void close () throws NamingException
+ {
+ }
+
+ public boolean hasMore () throws NamingException
+ {
+ return hasMoreElements ();
+ }
+
+ public Object next () throws NamingException
+ {
+ return nextElement ();
+ }
+
+ public boolean hasMoreElements ()
+ {
+ return where < values.size ();
+ }
+
+ public Object nextElement () throws NoSuchElementException
+ {
+ if (where + 1 >= values.size ())
+ throw new NoSuchElementException ("no more elements");
+ ++where;
+ return values.get (where);
+ }
+ }
+}
diff --git a/libjava/javax/naming/directory/BasicAttributes.java b/libjava/javax/naming/directory/BasicAttributes.java
new file mode 100644
index 0000000..935612c
--- /dev/null
+++ b/libjava/javax/naming/directory/BasicAttributes.java
@@ -0,0 +1,194 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.directory;
+
+import javax.naming.*;
+import java.util.*;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date June 22, 2001
+ */
+public class BasicAttributes implements Attributes
+{
+ public BasicAttributes ()
+ {
+ this (false);
+ }
+
+ public BasicAttributes (boolean ignoreCase)
+ {
+ this.ignoreCase = ignoreCase;
+ this.attributes = new Vector ();
+ }
+
+ public BasicAttributes (String attrID, Object val)
+ {
+ this (attrID, val, false);
+ }
+
+ public BasicAttributes (String attrID, Object val, boolean ignoreCase)
+ {
+ this.ignoreCase = ignoreCase;
+ attributes = new Vector ();
+ attributes.add (new BasicAttribute (attrID, val));
+ }
+
+ public Object clone ()
+ {
+ // Slightly inefficient as we make a garbage Vector here.
+ BasicAttributes ba = new BasicAttributes (ignoreCase);
+ ba.attributes = (Vector) attributes.clone ();
+ return ba;
+ }
+
+ public boolean equals (Object obj)
+ {
+ if (! (obj instanceof BasicAttributes))
+ return false;
+ BasicAttributes b = (BasicAttributes) obj;
+ if (ignoreCase != b.ignoreCase
+ || attributes.size () != b.attributes.size ())
+ return false;
+
+ // Does order matter?
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ if (! attributes.get (i).equals (b.attributes.get (i)))
+ return false;
+ }
+
+ return true;
+ }
+
+ public Attribute get (String attrID)
+ {
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ Attribute at = (Attribute) attributes.get (i);
+ if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ()))
+ || (! ignoreCase && attrID.equals (at.getID ())))
+ return at;
+ }
+
+ return null;
+ }
+
+ public NamingEnumeration getAll ()
+ {
+ return new BasicAttributesEnumeration (false);
+ }
+
+ public NamingEnumeration getIDs ()
+ {
+ return new BasicAttributesEnumeration (true);
+ }
+
+ public int hashCode ()
+ {
+ int val = 0;
+ for (int i = 0; i < attributes.size (); ++i)
+ val += attributes.get (i).hashCode ();
+ return val;
+ }
+
+ public boolean isCaseIgnored ()
+ {
+ return ignoreCase;
+ }
+
+ public Attribute put (Attribute attr)
+ {
+ Attribute r = remove (attr.getID ());
+ attributes.add (attr);
+ return r;
+ }
+
+ public Attribute put (String attrID, Object val)
+ {
+ return put (new BasicAttribute (attrID, val));
+ }
+
+ public Attribute remove (String attrID)
+ {
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ Attribute at = (Attribute) attributes.get (i);
+ if ((ignoreCase && attrID.equalsIgnoreCase (at.getID ()))
+ || (! ignoreCase && attrID.equals (at.getID ())))
+ {
+ attributes.remove (i);
+ return at;
+ }
+ }
+
+ return null;
+ }
+
+ public int size ()
+ {
+ return attributes.size ();
+ }
+
+ public String toString ()
+ {
+ String r = "";
+ for (int i = 0; i < attributes.size (); ++i)
+ {
+ if (i > 0)
+ r += "; ";
+ r += attributes.get (i).toString ();
+ }
+ return r;
+ }
+
+ // This is set by the serialization spec.
+ private boolean ignoreCase;
+ private transient Vector attributes;
+
+ // Used when enumerating.
+ private class BasicAttributesEnumeration implements NamingEnumeration
+ {
+ int where = -1;
+ boolean id;
+
+ public BasicAttributesEnumeration (boolean id)
+ {
+ this.id = id;
+ }
+
+ public void close () throws NamingException
+ {
+ }
+
+ public boolean hasMore () throws NamingException
+ {
+ return hasMoreElements ();
+ }
+
+ public Object next () throws NamingException
+ {
+ return nextElement ();
+ }
+
+ public boolean hasMoreElements ()
+ {
+ return where < attributes.size ();
+ }
+
+ public Object nextElement () throws NoSuchElementException
+ {
+ if (where + 1 >= attributes.size ())
+ throw new NoSuchElementException ("no more elements");
+ ++where;
+ Attribute at = (Attribute) attributes.get (where);
+ return id ? (Object) at.getID () : (Object) at;
+ }
+ }
+}
diff --git a/libjava/javax/naming/directory/DirContext.java b/libjava/javax/naming/directory/DirContext.java
index 50deca0..4b82231 100644
--- a/libjava/javax/naming/directory/DirContext.java
+++ b/libjava/javax/naming/directory/DirContext.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -10,9 +10,41 @@ package javax.naming.directory;
import javax.naming.*;
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 13, 2001
+ */
+
public interface DirContext extends Context
{
- public Attributes getAttributes (String name);
- public Attributes getAttributes (String name, String[] attrIds);
-}
+ public static final int ADD_ATTRIBUTE = 1;
+ public static final int REPLACE_ATTRIBUTE = 2;
+ public static final int REMOVE_ATTRIBUTE = 3;
+ public Attributes getAttributes (String name) throws NamingException;
+ public Attributes getAttributes (String name, String[] attrIds) throws NamingException;
+ public Attributes getAttributes (Name name) throws NamingException;
+ public Attributes getAttributes(Name name, String[] attrIds) throws NamingException;
+ public void modifyAttributes(Name name, int mod_op, Attributes attrs) throws NamingException;
+ public void modifyAttributes(String name, int mod_op, Attributes attrs) throws NamingException;
+ public void modifyAttributes(Name name, ModificationItem[] mods) throws NamingException;
+ public void modifyAttributes(String name, ModificationItem[] mods) throws NamingException;
+ public void bind(Name name, Object obj, Attributes attrs) throws NamingException;
+ public void bind(String name, Object obj, Attributes attrs) throws NamingException;
+ public void rebind(Name name, Object obj, Attributes attrs) throws NamingException;
+ public void rebind(String name, Object obj, Attributes attrs) throws NamingException;
+ public DirContext createSubcontext(Name name, Attributes attrs) throws NamingException;
+ public DirContext createSubcontext(String name, Attributes attrs) throws NamingException;
+ public DirContext getSchema(Name name) throws NamingException;
+ public DirContext getSchema(String name) throws NamingException;
+ public DirContext getSchemaClassDefinition(Name name) throws NamingException;
+ public DirContext getSchemaClassDefinition(String name) throws NamingException;
+ public NamingEnumeration search(Name name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException;
+ public NamingEnumeration search(String name, Attributes matchingAttributes, String[] attributesToReturn) throws NamingException;
+ public NamingEnumeration search(Name name, Attributes matchingAttributes) throws NamingException;
+ public NamingEnumeration search(String name, Attributes matchingAttributes) throws NamingException;
+ public NamingEnumeration search(Name name, String filter, SearchControls cons) throws NamingException;
+ public NamingEnumeration search(String name, String filter, SearchControls cons) throws NamingException;
+ public NamingEnumeration search(Name name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException;
+ public NamingEnumeration search(String name, String filterExpr, Object[] filterArgs, SearchControls cons) throws NamingException;
+}
diff --git a/libjava/javax/naming/directory/InitialDirContext.java b/libjava/javax/naming/directory/InitialDirContext.java
index a63160f..185528f 100644
--- a/libjava/javax/naming/directory/InitialDirContext.java
+++ b/libjava/javax/naming/directory/InitialDirContext.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -11,20 +11,218 @@ package javax.naming.directory;
import javax.naming.*;
import java.util.Hashtable;
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date June 25, 2001
+ */
public class InitialDirContext extends InitialContext implements DirContext
{
+ public InitialDirContext ()
+ throws NamingException
+ {
+ this (null);
+ }
+
+ protected InitialDirContext (boolean lazy)
+ throws NamingException
+ {
+ super (lazy);
+ }
+
public InitialDirContext (Hashtable environment)
+ throws NamingException
{
- throw new Error ("javax.naming.directory.InitialDirContext not implemented");
+ super (environment);
+ }
+
+ // The InitialContext docs suggest that this exist. And it does
+ // seem like a good idea. but the InitialDirContext docs indicate
+ // it cannot be non-private.
+ private DirContext getURLOrDefaultInitDirCtx (Name name)
+ throws NamingException
+ {
+ Context c = getURLOrDefaultInitCtx (name);
+ if (c == null)
+ throw new NoInitialContextException ();
+ else if (! (c instanceof DirContext))
+ throw new NotContextException ();
+ return (DirContext) c;
+ }
+
+ private DirContext getURLOrDefaultInitDirCtx (String name)
+ throws NamingException
+ {
+ Context c = getURLOrDefaultInitCtx (name);
+ if (c == null)
+ throw new NoInitialContextException ();
+ else if (! (c instanceof DirContext))
+ throw new NotContextException ();
+ return (DirContext) c;
}
public Attributes getAttributes (String name)
+ throws NamingException
{
- throw new Error ("getAttributes not implemented");
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name);
}
public Attributes getAttributes (String name, String[] attrIds)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name, attrIds);
+ }
+
+ public Attributes getAttributes (Name name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name);
+ }
+
+ public Attributes getAttributes(Name name, String[] attrIds)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getAttributes (name, attrIds);
+ }
+
+ public void modifyAttributes(Name name, int mod_op, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mod_op, attrs);
+ }
+
+ public void modifyAttributes(String name, int mod_op, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mod_op, attrs);
+ }
+
+ public void modifyAttributes(Name name, ModificationItem[] mods)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mods);
+ }
+
+ public void modifyAttributes(String name, ModificationItem[] mods)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).modifyAttributes (name, mods);
+ }
+
+ public void bind(Name name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).bind (name, obj, attrs);
+ }
+
+ public void bind(String name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).bind (name, obj, attrs);
+ }
+
+ public void rebind(Name name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).rebind (name, obj, attrs);
+ }
+
+ public void rebind(String name, Object obj, Attributes attrs)
+ throws NamingException
+ {
+ getURLOrDefaultInitDirCtx (name).rebind (name, obj, attrs);
+ }
+
+ public DirContext createSubcontext(Name name, Attributes attrs)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).createSubcontext (name, attrs);
+ }
+
+ public DirContext createSubcontext(String name, Attributes attrs)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).createSubcontext (name, attrs);
+ }
+
+ public DirContext getSchema(Name name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchema (name);
+ }
+
+ public DirContext getSchema(String name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchema (name);
+ }
+
+ public DirContext getSchemaClassDefinition(Name name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name);
+ }
+
+ public DirContext getSchemaClassDefinition(String name)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).getSchemaClassDefinition (name);
+ }
+
+ public NamingEnumeration search(Name name, Attributes matchingAttributes,
+ String[] attributesToReturn)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes,
+ attributesToReturn);
+ }
+
+ public NamingEnumeration search(String name, Attributes matchingAttributes,
+ String[] attributesToReturn)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes,
+ attributesToReturn);
+ }
+
+ public NamingEnumeration search(Name name, Attributes matchingAttributes)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes);
+ }
+
+ public NamingEnumeration search(String name, Attributes matchingAttributes)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, matchingAttributes);
+ }
+
+ public NamingEnumeration search(Name name, String filter,
+ SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filter, cons);
+ }
+
+ public NamingEnumeration search(String name, String filter,
+ SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filter, cons);
+ }
+
+ public NamingEnumeration search(Name name, String filterExpr,
+ Object[] filterArgs, SearchControls cons)
+ throws NamingException
+ {
+ return getURLOrDefaultInitDirCtx (name).search (name, filterExpr,
+ filterArgs, cons);
+ }
+
+ public NamingEnumeration search(String name, String filterExpr,
+ Object[] filterArgs, SearchControls cons)
+ throws NamingException
{
- throw new Error ("getAttributes not implemented");
+ return getURLOrDefaultInitDirCtx (name).search (name, filterExpr,
+ filterArgs, cons);
}
}
diff --git a/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java b/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java
index 55c234a..3c2b38f 100644
--- a/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java
+++ b/libjava/javax/naming/directory/InvalidAttributeIdentifierException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class InvalidAttributeIdentifierException extends NamingException
{
diff --git a/libjava/javax/naming/directory/InvalidAttributeValueException.java b/libjava/javax/naming/directory/InvalidAttributeValueException.java
index f19edee..5a07604 100644
--- a/libjava/javax/naming/directory/InvalidAttributeValueException.java
+++ b/libjava/javax/naming/directory/InvalidAttributeValueException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class InvalidAttributeValueException extends NamingException
{
diff --git a/libjava/javax/naming/directory/InvalidAttributesException.java b/libjava/javax/naming/directory/InvalidAttributesException.java
index 5d6b45a..ce13acb 100644
--- a/libjava/javax/naming/directory/InvalidAttributesException.java
+++ b/libjava/javax/naming/directory/InvalidAttributesException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class InvalidAttributesException extends NamingException
{
diff --git a/libjava/javax/naming/directory/InvalidSearchControlsException.java b/libjava/javax/naming/directory/InvalidSearchControlsException.java
index 981deda..f0c535a 100644
--- a/libjava/javax/naming/directory/InvalidSearchControlsException.java
+++ b/libjava/javax/naming/directory/InvalidSearchControlsException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class InvalidSearchControlsException extends NamingException
{
diff --git a/libjava/javax/naming/directory/InvalidSearchFilterException.java b/libjava/javax/naming/directory/InvalidSearchFilterException.java
index 117b228..e1bb61c 100644
--- a/libjava/javax/naming/directory/InvalidSearchFilterException.java
+++ b/libjava/javax/naming/directory/InvalidSearchFilterException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class InvalidSearchFilterException extends NamingException
{
diff --git a/libjava/javax/naming/directory/ModificationItem.java b/libjava/javax/naming/directory/ModificationItem.java
new file mode 100644
index 0000000..963abee
--- /dev/null
+++ b/libjava/javax/naming/directory/ModificationItem.java
@@ -0,0 +1,49 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.directory;
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 13, 2001
+ */
+
+public class ModificationItem implements Serializable
+{
+ // Serialized fields.
+ private int mod_op;
+ private Attribute attr;
+
+ public ModificationItem(int mod_op, Attribute attr)
+ {
+ if (attr == null)
+ throw new IllegalArgumentException("attr is null");
+ if (mod_op != DirContext.ADD_ATTRIBUTE &&
+ mod_op != DirContext.REPLACE_ATTRIBUTE &&
+ mod_op != DirContext.REMOVE_ATTRIBUTE)
+ throw new IllegalArgumentException("mod_op is invalid");
+ this.mod_op = mod_op;
+ this.attr = attr;
+ }
+
+ public int getModificationOp()
+ {
+ return mod_op;
+ }
+
+ public Attribute getAttribute()
+ {
+ return attr;
+ }
+
+ public String toString()
+ {
+ return "mod_op=" + mod_op + ":" + "attr=" + attr.toString();
+ }
+}
diff --git a/libjava/javax/naming/directory/NoSuchAttributeException.java b/libjava/javax/naming/directory/NoSuchAttributeException.java
index 268d4db..0c5ee1c 100644
--- a/libjava/javax/naming/directory/NoSuchAttributeException.java
+++ b/libjava/javax/naming/directory/NoSuchAttributeException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class NoSuchAttributeException extends NamingException
{
diff --git a/libjava/javax/naming/directory/SchemaViolationException.java b/libjava/javax/naming/directory/SchemaViolationException.java
index 28ff92f..6fc5b1d 100644
--- a/libjava/javax/naming/directory/SchemaViolationException.java
+++ b/libjava/javax/naming/directory/SchemaViolationException.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -6,9 +6,9 @@ This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
details. */
-package javax.naming;
+package javax.naming.directory;
-import java.lang.Exception;
+import javax.naming.NamingException;
public class SchemaViolationException extends NamingException
{
diff --git a/libjava/javax/naming/directory/SearchControls.java b/libjava/javax/naming/directory/SearchControls.java
new file mode 100644
index 0000000..d2b3e24
--- /dev/null
+++ b/libjava/javax/naming/directory/SearchControls.java
@@ -0,0 +1,106 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.directory;
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 5, 2001
+ */
+
+public class SearchControls extends Object implements Serializable
+{
+ public static final int OBJECT_SCOPE = 0;
+ public static final int ONELEVEL_SCOPE = 1;
+ public static final int SUBTREE_SCOPE = 2;
+
+ // Serialized fields.
+ private int searchScope;
+ private int timeLimit;
+ private boolean derefLink;
+ private boolean returnObj;
+ private long countLimit;
+ private String[] attributesToReturn;
+
+ public SearchControls()
+ {
+ this(ONELEVEL_SCOPE, 0L, 0, null, false, false);
+ }
+
+ public SearchControls(int scope, long countlim, int timelim, String[] attrs,
+ boolean retobj, boolean deref)
+ {
+ searchScope = scope;
+ timeLimit = timelim;
+ derefLink = deref;
+ returnObj = retobj;
+ countLimit = countlim;
+ attributesToReturn = attrs;
+ }
+
+ public int getSearchScope()
+ {
+ return searchScope;
+ }
+
+ public int getTimeLimit()
+ {
+ return timeLimit;
+ }
+
+ public boolean getDerefLinkFlag()
+ {
+ return derefLink;
+ }
+
+ public boolean getReturningObjFlag()
+ {
+ return returnObj;
+ }
+
+ public long getCountLimit()
+ {
+ return countLimit;
+ }
+
+ public String[] getReturningAttributes()
+ {
+ return attributesToReturn;
+ }
+
+ public void setSearchScope(int scope)
+ {
+ searchScope = scope;
+ }
+
+ public void setTimeLimit(int ms)
+ {
+ timeLimit = ms;
+ }
+
+ public void setDerefLinkFlag(boolean on)
+ {
+ derefLink = on;
+ }
+
+ public void setReturningObjFlag(boolean on)
+ {
+ returnObj = on;
+ }
+
+ public void setCountLimit(long limit)
+ {
+ countLimit = limit;
+ }
+
+ public void setReturningAttributes(String[] attrs)
+ {
+ attributesToReturn = attrs;
+ }
+}
diff --git a/libjava/javax/naming/directory/SearchResult.java b/libjava/javax/naming/directory/SearchResult.java
new file mode 100644
index 0000000..956c32c
--- /dev/null
+++ b/libjava/javax/naming/directory/SearchResult.java
@@ -0,0 +1,64 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.directory;
+import javax.naming.*;
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 13, 2001
+ */
+
+public class SearchResult extends Binding
+{
+ // Serialized fields.
+ private Attributes attrs;
+
+ public SearchResult(String name, Object obj, Attributes attrs)
+ {
+ super(name, obj);
+ this.attrs = attrs;
+ }
+
+ public SearchResult(String name, Object obj, Attributes attrs,
+ boolean isRelative)
+ {
+ super(name, obj, isRelative);
+ this.attrs = attrs;
+ }
+
+ public SearchResult(String name, String className, Object obj,
+ Attributes attrs)
+ {
+ super(name, className, obj);
+ this.attrs = attrs;
+ }
+
+ public SearchResult(String name, String className, Object obj,
+ Attributes attrs, boolean isRelative)
+ {
+ super(name, className, obj, isRelative);
+ this.attrs = attrs;
+ }
+
+ public Attributes getAttributes()
+ {
+ return attrs;
+ }
+
+ public void setAttributes(Attributes attrs)
+ {
+ this.attrs = attrs;
+ }
+
+ public String toString()
+ {
+ return super.toString() + ":" + attrs.toString();
+ }
+}
diff --git a/libjava/javax/naming/event/EventContext.java b/libjava/javax/naming/event/EventContext.java
new file mode 100644
index 0000000..8056539
--- /dev/null
+++ b/libjava/javax/naming/event/EventContext.java
@@ -0,0 +1,29 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+import javax.naming.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface EventContext extends Context
+{
+ public static final int OBJECT_SCOPE = 0;
+ public static final int ONELEVEL_SCOPE = 1;
+ public static final int SUBTREE_SCOPE = 2;
+
+ public void addNamingListener(Name target, int scope, NamingListener l)
+ throws NamingException;
+ public void addNamingListener(String target, int scope, NamingListener l)
+ throws NamingException;
+ public void removeNamingListener(NamingListener l) throws NamingException;
+ public boolean targetMustExist() throws NamingException;
+}
diff --git a/libjava/javax/naming/event/EventDirContext.java b/libjava/javax/naming/event/EventDirContext.java
new file mode 100644
index 0000000..7321d0c
--- /dev/null
+++ b/libjava/javax/naming/event/EventDirContext.java
@@ -0,0 +1,31 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+import javax.naming.*;
+import javax.naming.directory.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface EventDirContext extends EventContext, DirContext
+{
+ public void addNamingListener(Name target, String filter, SearchControls ctls,
+ NamingListener l) throws NamingException;
+ public void addNamingListener(String target, String filter,
+ SearchControls ctls, NamingListener l)
+ throws NamingException;
+ public void addNamingListener(Name target, String filter, Object[] filterArgs,
+ SearchControls ctls, NamingListener l)
+ throws NamingException;
+ public void addNamingListener(String target, String filter,
+ Object[] filterArgs, SearchControls ctls,
+ NamingListener l) throws NamingException;
+}
diff --git a/libjava/javax/naming/event/NamespaceChangeListener.java b/libjava/javax/naming/event/NamespaceChangeListener.java
new file mode 100644
index 0000000..5469d04
--- /dev/null
+++ b/libjava/javax/naming/event/NamespaceChangeListener.java
@@ -0,0 +1,21 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface NamespaceChangeListener extends NamingListener
+{
+ public void objectAdded(NamingEvent evt);
+ public void objectRemoved(NamingEvent evt);
+ public void objectRenamed(NamingEvent evt);
+}
diff --git a/libjava/javax/naming/event/NamingEvent.java b/libjava/javax/naming/event/NamingEvent.java
new file mode 100644
index 0000000..3151dd8
--- /dev/null
+++ b/libjava/javax/naming/event/NamingEvent.java
@@ -0,0 +1,89 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+import javax.naming.*;
+import java.util.EventObject;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 5, 2001
+ */
+
+public class NamingEvent extends EventObject
+{
+ public static final int OBJECT_ADDED = 0;
+ public static final int OBJECT_REMOVED = 1;
+ public static final int OBJECT_RENAMED = 2;
+ public static final int OBJECT_CHANGED = 3;
+
+ // Serialized fields.
+ protected Object changeInfo;
+ protected int type;
+ protected Binding oldBinding;
+ protected Binding newBinding;
+
+ public NamingEvent(EventContext source, int type, Binding newBd,
+ Binding oldBd, Object changeInfo)
+ {
+ super(source);
+ this.type = type;
+ this.oldBinding = oldBd;
+ this.newBinding = newBd;
+ this.changeInfo = changeInfo;
+ // FIXME: for OBJECT_ADDED, newBd must not be null;
+ // FIXME: for OBJECT_CHANGED, newBd and oldBd must not be null;
+ // FIXME: for OBJECT_RENAMED, one of newBd or oldBd may be null if newBd or
+ // FIXME: oldBd is outside of the scope for which listener has registered.
+ // FIXME: namingExceptionThrown() is called for the listener in question.
+ }
+
+ public int getType()
+ {
+ return type;
+ }
+
+ public EventContext getEventContext()
+ {
+ return (EventContext) getSource();
+ }
+
+ public Binding getOldBinding()
+ {
+ return oldBinding;
+ }
+
+ public Binding getNewBinding()
+ {
+ return newBinding;
+ }
+
+ public Object getChangeInfo()
+ {
+ return changeInfo;
+ }
+
+ public void dispatch(NamingListener listener)
+ {
+ switch (type)
+ {
+ case OBJECT_ADDED:
+ ((NamespaceChangeListener) listener).objectAdded(this);
+ break;
+ case OBJECT_REMOVED:
+ ((NamespaceChangeListener) listener).objectRemoved(this);
+ break;
+ case OBJECT_RENAMED:
+ ((NamespaceChangeListener) listener).objectRenamed(this);
+ break;
+ case OBJECT_CHANGED:
+ ((ObjectChangeListener) listener).objectChanged(this);
+ break;
+ }
+ }
+}
diff --git a/libjava/javax/naming/event/NamingExceptionEvent.java b/libjava/javax/naming/event/NamingExceptionEvent.java
new file mode 100644
index 0000000..2cbdcb1
--- /dev/null
+++ b/libjava/javax/naming/event/NamingExceptionEvent.java
@@ -0,0 +1,43 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+import javax.naming.*;
+import java.util.EventObject;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 5, 2001
+ */
+
+public class NamingExceptionEvent extends EventObject
+{
+ // Serialized fields.
+ private NamingException exception;
+
+ public NamingExceptionEvent(EventContext source, NamingException exc)
+ {
+ super(source);
+ exception = exc;
+ }
+
+ public NamingException getException()
+ {
+ return exception;
+ }
+
+ public EventContext getEventContext()
+ {
+ return (EventContext) getSource();
+ }
+
+ public void dispatch(NamingListener listener)
+ {
+ listener.namingExceptionThrown(this);
+ }
+}
diff --git a/libjava/javax/naming/event/NamingListener.java b/libjava/javax/naming/event/NamingListener.java
new file mode 100644
index 0000000..b631ccb
--- /dev/null
+++ b/libjava/javax/naming/event/NamingListener.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+import java.util.EventListener;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface NamingListener extends EventListener
+{
+ public void namingExceptionThrown(NamingExceptionEvent evt);
+}
diff --git a/libjava/javax/naming/event/ObjectChangeListener.java b/libjava/javax/naming/event/ObjectChangeListener.java
new file mode 100644
index 0000000..9da3473
--- /dev/null
+++ b/libjava/javax/naming/event/ObjectChangeListener.java
@@ -0,0 +1,19 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.event;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface ObjectChangeListener extends NamingListener
+{
+ public void objectChanged(NamingEvent evt);
+}
diff --git a/libjava/javax/naming/ldap/Control.java b/libjava/javax/naming/ldap/Control.java
new file mode 100644
index 0000000..156af96
--- /dev/null
+++ b/libjava/javax/naming/ldap/Control.java
@@ -0,0 +1,25 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface Control extends Serializable
+{
+ public static final boolean CRITICAL = true;
+ public static final boolean NONCRITICAL = false;
+
+ public String getID();
+ public boolean isCritical();
+ public byte[] getEncodedValue();
+}
diff --git a/libjava/javax/naming/ldap/ControlFactory.java b/libjava/javax/naming/ldap/ControlFactory.java
new file mode 100644
index 0000000..8c988ab
--- /dev/null
+++ b/libjava/javax/naming/ldap/ControlFactory.java
@@ -0,0 +1,75 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+
+import javax.naming.*;
+import java.util.StringTokenizer;
+import java.util.Hashtable;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date June 22, 2001
+ */
+public abstract class ControlFactory
+{
+ protected ControlFactory ()
+ {
+ }
+
+ public abstract Control getControlInstance (Control control)
+ throws NamingException;
+
+ public static Control getControlInstance (Control control,
+ Context ctx,
+ Hashtable env)
+ throws NamingException
+ {
+ String path = (String) env.get (LdapContext.CONTROL_FACTORIES);
+ String path2 = null;
+ if (ctx != null)
+ path2 = (String) ctx.getEnvironment ().get (LdapContext.CONTROL_FACTORIES);
+ if (path == null)
+ path = path2;
+ else if (path2 != null)
+ path += ":" + path2;
+
+ StringTokenizer tokens = new StringTokenizer (path, ":");
+ while (tokens.hasMoreTokens ())
+ {
+ String name = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (name);
+ ControlFactory cf = (ControlFactory) k.newInstance ();
+ Control ctrl = cf.getControlInstance (control);
+ if (ctrl != null)
+ return ctrl;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // Ignore it.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return control;
+ }
+}
diff --git a/libjava/javax/naming/ldap/ExtendedRequest.java b/libjava/javax/naming/ldap/ExtendedRequest.java
new file mode 100644
index 0000000..af5a0fb
--- /dev/null
+++ b/libjava/javax/naming/ldap/ExtendedRequest.java
@@ -0,0 +1,26 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import java.io.Serializable;
+import javax.naming.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface ExtendedRequest extends Serializable
+{
+ public String getID();
+ public byte[] getEncodedValue();
+ public ExtendedResponse createExtendedResponse(String id,
+ byte[] berValue, int offset,
+ int length)
+ throws NamingException;
+}
diff --git a/libjava/javax/naming/ldap/ExtendedResponse.java b/libjava/javax/naming/ldap/ExtendedResponse.java
new file mode 100644
index 0000000..73dd96e
--- /dev/null
+++ b/libjava/javax/naming/ldap/ExtendedResponse.java
@@ -0,0 +1,21 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface ExtendedResponse extends Serializable
+{
+ public String getID();
+ public byte[] getEncodedValue();
+}
diff --git a/libjava/javax/naming/ldap/HasControls.java b/libjava/javax/naming/ldap/HasControls.java
new file mode 100644
index 0000000..c37d30c
--- /dev/null
+++ b/libjava/javax/naming/ldap/HasControls.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import javax.naming.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface HasControls
+{
+ public Control[] getControls() throws NamingException;
+}
diff --git a/libjava/javax/naming/ldap/InitialLdapContext.java b/libjava/javax/naming/ldap/InitialLdapContext.java
new file mode 100644
index 0000000..88d0e26e
--- /dev/null
+++ b/libjava/javax/naming/ldap/InitialLdapContext.java
@@ -0,0 +1,99 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+
+import javax.naming.*;
+import javax.naming.directory.InitialDirContext;
+import java.util.Hashtable;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date June 21, 2001
+ */
+public class InitialLdapContext
+ extends InitialDirContext
+ implements LdapContext
+{
+ public InitialLdapContext ()
+ throws NamingException
+ {
+ this (null, null);
+ }
+
+ public InitialLdapContext (Hashtable environment, Control[] connControls)
+ throws NamingException
+ {
+ super (false);
+
+ if (connControls != null)
+ {
+ if (environment == null)
+ environment = new Hashtable ();
+ else
+ environment = (Hashtable) environment.clone ();
+ environment.put ("java.naming.ldap.control.connect",
+ connControls);
+ }
+
+ init (environment);
+ }
+
+ private LdapContext getDefaultInitLdapCtx ()
+ throws NamingException
+ {
+ Context c = getDefaultInitCtx ();
+ if (c == null)
+ throw new NoInitialContextException ();
+ else if (! (c instanceof LdapContext))
+ throw new NotContextException ();
+ return (LdapContext) c;
+ }
+
+ public ExtendedResponse extendedOperation (ExtendedRequest request)
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().extendedOperation (request);
+ }
+
+ public Control[] getConnectControls ()
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().getConnectControls ();
+ }
+
+ public Control[] getRequestControls ()
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().getRequestControls ();
+ }
+
+ public Control[] getResponseControls ()
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().getResponseControls ();
+ }
+
+ public LdapContext newInstance (Control[] reqControls)
+ throws NamingException
+ {
+ return getDefaultInitLdapCtx ().newInstance (reqControls);
+ }
+
+ public void reconnect (Control[] connControls)
+ throws NamingException
+ {
+ getDefaultInitLdapCtx ().reconnect (connControls);
+ }
+
+ public void setRequestControls (Control[] reqControls)
+ throws NamingException
+ {
+ getDefaultInitLdapCtx ().setRequestControls (reqControls);
+ }
+}
diff --git a/libjava/javax/naming/ldap/LdapContext.java b/libjava/javax/naming/ldap/LdapContext.java
new file mode 100644
index 0000000..204269e
--- /dev/null
+++ b/libjava/javax/naming/ldap/LdapContext.java
@@ -0,0 +1,32 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import javax.naming.*;
+import javax.naming.directory.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface LdapContext extends DirContext
+{
+ public static final String CONTROL_FACTORIES = "java.naming.factory.control";
+
+ public ExtendedResponse extendedOperation(ExtendedRequest request)
+ throws NamingException;
+ public LdapContext newInstance(Control[] requestControls)
+ throws NamingException;
+ public void reconnect(Control[] connCtls) throws NamingException;
+ public Control[] getConnectControls() throws NamingException;
+ public void setRequestControls(Control[] requestControls)
+ throws NamingException;
+ public Control[] getRequestControls() throws NamingException;
+ public Control[] getResponseControls() throws NamingException;
+}
diff --git a/libjava/javax/naming/ldap/LdapReferralException.java b/libjava/javax/naming/ldap/LdapReferralException.java
new file mode 100644
index 0000000..1653710
--- /dev/null
+++ b/libjava/javax/naming/ldap/LdapReferralException.java
@@ -0,0 +1,35 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import javax.naming.*;
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public abstract class LdapReferralException extends ReferralException
+{
+ protected LdapReferralException()
+ {
+ super();
+ }
+
+ protected LdapReferralException(String explanation)
+ {
+ super(explanation);
+ }
+
+ public abstract Context getReferralContext() throws NamingException;
+ public abstract Context getReferralContext(Hashtable env)
+ throws NamingException;
+ public abstract Context getReferralContext(Hashtable env, Control[] reqCtls)
+ throws NamingException;
+}
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotification.java b/libjava/javax/naming/ldap/UnsolicitedNotification.java
new file mode 100644
index 0000000..539d599
--- /dev/null
+++ b/libjava/javax/naming/ldap/UnsolicitedNotification.java
@@ -0,0 +1,21 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import javax.naming.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface UnsolicitedNotification extends ExtendedResponse, HasControls
+{
+ public String[] getReferrals();
+ public NamingException getException();
+}
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java b/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
new file mode 100644
index 0000000..fe1e404
--- /dev/null
+++ b/libjava/javax/naming/ldap/UnsolicitedNotificationEvent.java
@@ -0,0 +1,38 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import java.util.EventObject;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 5, 2001
+ */
+
+public class UnsolicitedNotificationEvent extends EventObject
+{
+ // Serialized fields.
+ private UnsolicitedNotification notice;
+
+ public UnsolicitedNotificationEvent(Object src,
+ UnsolicitedNotification notice)
+ {
+ super(src);
+ this.notice = notice;
+ }
+
+ public UnsolicitedNotification getNotification()
+ {
+ return notice;
+ }
+
+ public void dispatch(UnsolicitedNotificationListener listener)
+ {
+ listener.notificationReceived(this);
+ }
+}
diff --git a/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java b/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java
new file mode 100644
index 0000000..2f22a61
--- /dev/null
+++ b/libjava/javax/naming/ldap/UnsolicitedNotificationListener.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.ldap;
+import javax.naming.event.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface UnsolicitedNotificationListener extends NamingListener
+{
+ public void notificationReceived(UnsolicitedNotificationEvent evt);
+}
diff --git a/libjava/javax/naming/spi/DirObjectFactory.java b/libjava/javax/naming/spi/DirObjectFactory.java
new file mode 100644
index 0000000..6749ff3
--- /dev/null
+++ b/libjava/javax/naming/spi/DirObjectFactory.java
@@ -0,0 +1,24 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.spi;
+import javax.naming.*;
+import javax.naming.directory.*;
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface DirObjectFactory extends ObjectFactory
+{
+ public Object getObjectInstance(Object obj, Name name, Context nameCtx,
+ Hashtable environment, Attributes attrs)
+ throws Exception;
+}
diff --git a/libjava/javax/naming/spi/DirStateFactory.java b/libjava/javax/naming/spi/DirStateFactory.java
new file mode 100644
index 0000000..dbd35c7
--- /dev/null
+++ b/libjava/javax/naming/spi/DirStateFactory.java
@@ -0,0 +1,50 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.spi;
+import javax.naming.*;
+import javax.naming.directory.*;
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface DirStateFactory extends StateFactory
+{
+ // Inner class
+
+ public static class Result
+ {
+ private Object obj;
+ private Attributes outAttrs;
+
+ public Result(Object obj, Attributes outAttrs)
+ {
+ this.obj = obj;
+ this.outAttrs = outAttrs;
+ }
+
+ public Object getObject()
+ {
+ return obj;
+ }
+
+ public Attributes getAttributes()
+ {
+ return outAttrs;
+ }
+ }
+
+ public DirStateFactory.Result getStateToBind(Object obj, Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes inAttrs)
+ throws NamingException;
+}
diff --git a/libjava/javax/naming/spi/DirectoryManager.java b/libjava/javax/naming/spi/DirectoryManager.java
new file mode 100644
index 0000000..33872f4
--- /dev/null
+++ b/libjava/javax/naming/spi/DirectoryManager.java
@@ -0,0 +1,204 @@
+/* Copyright (C) 2000, 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+ This software is copyrighted work licensed under the terms of the
+ Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+ details. */
+
+package javax.naming.spi;
+
+import javax.naming.*;
+import javax.naming.directory.*;
+import java.util.Hashtable;
+import java.util.StringTokenizer;
+import java.util.Enumeration;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date June 25, 2001
+ */
+public class DirectoryManager extends NamingManager
+{
+ // Can't instantiate this class.
+ DirectoryManager ()
+ {
+ }
+
+ public static DirContext getContinuationDirContext (CannotProceedException c)
+ throws NamingException
+ {
+ return (DirContext) getContinuationContext (c);
+ }
+
+ // Try to create an object using the factory. Return null on
+ // failure.
+ private static Object tryCreateObject (ObjectFactory factory,
+ Object refInfo,
+ Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes attrs)
+ throws Exception
+ {
+ if (factory instanceof DirObjectFactory)
+ {
+ DirObjectFactory dof = (DirObjectFactory) factory;
+ return dof.getObjectInstance (refInfo, name, nameCtx,
+ environment, attrs);
+ }
+ else
+ return factory.getObjectInstance (refInfo, name, nameCtx,
+ environment);
+ }
+
+ public static Object getObjectInstance (Object refInfo, Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes attrs)
+ throws Exception
+ {
+ ObjectFactory factory = null;
+
+ if (ofb != null)
+ factory = ofb.createObjectFactory (refInfo, environment);
+ else
+ {
+ // First see if we have a Reference or a Referenceable. If so
+ // we do some special processing.
+ Object ref2 = refInfo;
+ if (refInfo instanceof Referenceable)
+ ref2 = ((Referenceable) refInfo).getReference ();
+ if (ref2 instanceof Reference)
+ {
+ Reference ref = (Reference) ref2;
+
+ // If we have a factory class name then we use that.
+ String fClass = ref.getFactoryClassName ();
+ if (fClass != null)
+ {
+ // Exceptions here are passed to the caller.
+ Class k = Class.forName (fClass);
+ factory = (ObjectFactory) k.newInstance ();
+ }
+ else
+ {
+ // There's no factory class name. If the address is a
+ // StringRefAddr with address type `URL', then we try
+ // the URL's context factory.
+ Enumeration e = ref.getAll ();
+ while (e.hasMoreElements ())
+ {
+ RefAddr ra = (RefAddr) e.nextElement ();
+ if (ra instanceof StringRefAddr
+ && "URL".equals (ra.getType ()))
+ {
+ factory
+ = (ObjectFactory) getURLContext (refInfo,
+ name,
+ nameCtx,
+ (String) ra.getContent (),
+ environment);
+ Object obj = tryCreateObject (factory,
+ refInfo,
+ name,
+ nameCtx,
+ environment,
+ attrs);
+ if (obj != null)
+ return obj;
+ }
+ }
+
+ // Have to try the next step.
+ factory = null;
+ }
+ }
+
+ // Now look at OBJECT_FACTORIES to find the factory.
+ if (factory == null)
+ {
+ StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES,
+ environment, nameCtx);
+
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ Class k = Class.forName (klassName);
+ factory = (ObjectFactory) k.newInstance ();
+ Object obj = tryCreateObject (factory, refInfo, name,
+ nameCtx, environment, attrs);
+ if (obj != null)
+ return obj;
+ }
+
+ // Failure.
+ return refInfo;
+ }
+ }
+
+ if (factory == null)
+ return refInfo;
+ Object obj = tryCreateObject (factory, refInfo, name,
+ nameCtx, environment, attrs);
+ return obj == null ? refInfo : obj;
+ }
+
+ public static DirStateFactory.Result getStateToBind (Object obj,
+ Name name,
+ Context nameCtx,
+ Hashtable environment,
+ Attributes attrs)
+ throws NamingException
+ {
+ StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES,
+ environment, nameCtx);
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (klassName);
+ StateFactory factory = (StateFactory) k.newInstance ();
+
+ DirStateFactory.Result result = null;
+ if (factory instanceof DirStateFactory)
+ {
+ DirStateFactory dsf = (DirStateFactory) factory;
+ result = dsf.getStateToBind (obj, name, nameCtx, environment,
+ attrs);
+ }
+ else
+ {
+ Object o = factory.getStateToBind (obj, name, nameCtx,
+ environment);
+ if (o != null)
+ result = new DirStateFactory.Result (o, attrs);
+ }
+ if (result != null)
+ return result;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return new DirStateFactory.Result (obj, attrs);
+ }
+}
diff --git a/libjava/javax/naming/spi/NamingManager.java b/libjava/javax/naming/spi/NamingManager.java
index 9cb814e..53eeb3a 100644
--- a/libjava/javax/naming/spi/NamingManager.java
+++ b/libjava/javax/naming/spi/NamingManager.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2000, 2001 Free Software Foundation
This file is part of libgcj.
@@ -8,19 +8,28 @@
package javax.naming.spi;
-import java.util.Hashtable;
+import java.util.*;
import javax.naming.*;
public class NamingManager
{
+ public static final String CPE = "java.naming.spi.CannotProceedException";
+
private static InitialContextFactoryBuilder icfb = null;
+ private static ObjectFactoryBuilder ofb = null;
+
+ // This class cannot be instantiated.
+ NamingManager ()
+ {
+ }
public static boolean hasInitialContextFactoryBuilder ()
{
return icfb != null;
}
- public static Context getInitialContext (Hashtable environment) throws NamingException
+ public static Context getInitialContext (Hashtable environment)
+ throws NamingException
{
InitialContextFactory icf = null;
@@ -33,25 +42,297 @@ public class NamingManager
java_naming_factory_initial
= (String) environment.get (Context.INITIAL_CONTEXT_FACTORY);
if (java_naming_factory_initial == null)
- throw new NoInitialContextException ("Can't find property: " + Context.INITIAL_CONTEXT_FACTORY);
-
- try {
- icf = (InitialContextFactory) Thread.currentThread().getContextClassLoader().loadClass(java_naming_factory_initial).newInstance();
- } catch (Exception exception) {
- NoInitialContextException e
- = new NoInitialContextException("Can't load InitialContextFactory class: " + java_naming_factory_initial);
- e.setRootCause(exception);
- throw e;
- }
+ java_naming_factory_initial =
+ System.getProperty (Context.INITIAL_CONTEXT_FACTORY);
+ if (java_naming_factory_initial == null)
+ throw new
+ NoInitialContextException ("Can't find property: "
+ + Context.INITIAL_CONTEXT_FACTORY);
+
+ try
+ {
+ icf = (InitialContextFactory) Class.forName (java_naming_factory_initial).newInstance ();
+ }
+ catch (Exception exception)
+ {
+ NoInitialContextException e
+ = new NoInitialContextException ("Can't load InitialContextFactory class: "
+ + java_naming_factory_initial);
+ e.setRootCause(exception);
+ throw e;
+ }
}
-
+
return icf.getInitialContext (environment);
}
- public static Context getURLContext(String scheme,
- Hashtable environment)
+ static Context getURLContext (Object refInfo,
+ Name name,
+ Context nameCtx,
+ String scheme,
+ Hashtable environment)
+ throws NamingException
+ {
+ String prefixes = null;
+ if (environment != null)
+ prefixes = (String) environment.get (Context.URL_PKG_PREFIXES);
+ if (prefixes == null)
+ prefixes = System.getProperty (Context.URL_PKG_PREFIXES);
+ if (prefixes == null)
+ {
+ // Specified as the default in the docs. Unclear if this is
+ // right for us.
+ prefixes = "com.sun.jndi.url";
+ }
+
+ scheme += "URLContextFactory";
+
+ StringTokenizer tokens = new StringTokenizer (prefixes, ":");
+ while (tokens.hasMoreTokens ())
+ {
+ String aTry = tokens.nextToken ();
+ try
+ {
+ Class factoryClass = Class.forName (aTry + "." + scheme);
+ ObjectFactory factory =
+ (ObjectFactory) factoryClass.newInstance ();
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ Context ctx = (Context) obj;
+ if (ctx != null)
+ return ctx;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ catch (NamingException _5)
+ {
+ throw _5;
+ }
+ catch (Exception _6)
+ {
+ // Anything from getObjectInstance.
+ }
+ }
+
+ return null;
+ }
+
+ public static Context getURLContext (String scheme,
+ Hashtable environment)
throws NamingException
{
- throw new Error ("javax.naming.spi.NamingManager.getURLContext not implemented");
+ return getURLContext (null, null, null, scheme, environment);
+ }
+
+ public static void setObjectFactoryBuilder (ObjectFactoryBuilder builder)
+ throws NamingException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkSetFactory ();
+ // Once the builder is installed it cannot be replaced.
+ if (ofb != null)
+ throw new IllegalStateException ("builder already installed");
+ if (builder != null)
+ ofb = builder;
+ }
+
+ static StringTokenizer getPlusPath (String property, Hashtable env,
+ Context nameCtx)
+ throws NamingException
+ {
+ String path = (String) env.get (property);
+ if (nameCtx == null)
+ nameCtx = getInitialContext (env);
+ String path2 = (String) nameCtx.getEnvironment ().get (property);
+ if (path == null)
+ path = path2;
+ else if (path2 != null)
+ path += ":" + path2;
+ return new StringTokenizer (path, ":");
+ }
+
+ public static Object getObjectInstance (Object refInfo,
+ Name name,
+ Context nameCtx,
+ Hashtable environment)
+ throws Exception
+ {
+ ObjectFactory factory = null;
+
+ if (ofb != null)
+ factory = ofb.createObjectFactory (refInfo, environment);
+ else
+ {
+ // First see if we have a Reference or a Referenceable. If so
+ // we do some special processing.
+ Object ref2 = refInfo;
+ if (refInfo instanceof Referenceable)
+ ref2 = ((Referenceable) refInfo).getReference ();
+ if (ref2 instanceof Reference)
+ {
+ Reference ref = (Reference) ref2;
+
+ // If we have a factory class name then we use that.
+ String fClass = ref.getFactoryClassName ();
+ if (fClass != null)
+ {
+ // Exceptions here are passed to the caller.
+ Class k = Class.forName (fClass);
+ factory = (ObjectFactory) k.newInstance ();
+ }
+ else
+ {
+ // There's no factory class name. If the address is a
+ // StringRefAddr with address type `URL', then we try
+ // the URL's context factory.
+ Enumeration e = ref.getAll ();
+ while (e.hasMoreElements ())
+ {
+ RefAddr ra = (RefAddr) e.nextElement ();
+ if (ra instanceof StringRefAddr
+ && "URL".equals (ra.getType ()))
+ {
+ factory
+ = (ObjectFactory) getURLContext (refInfo,
+ name,
+ nameCtx,
+ (String) ra.getContent (),
+ environment);
+ Object obj = factory.getObjectInstance (refInfo,
+ name,
+ nameCtx,
+ environment);
+ if (obj != null)
+ return obj;
+ }
+ }
+
+ // Have to try the next step.
+ factory = null;
+ }
+ }
+
+ // Now look at OBJECT_FACTORIES to find the factory.
+ if (factory == null)
+ {
+ StringTokenizer tokens = getPlusPath (Context.OBJECT_FACTORIES,
+ environment, nameCtx);
+
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ Class k = Class.forName (klassName);
+ factory = (ObjectFactory) k.newInstance ();
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ if (obj != null)
+ return obj;
+ }
+
+ // Failure.
+ return refInfo;
+ }
+ }
+
+ if (factory == null)
+ return refInfo;
+ Object obj = factory.getObjectInstance (refInfo, name,
+ nameCtx, environment);
+ return obj == null ? refInfo : obj;
+ }
+
+ public static void setInitialContextFactoryBuilder (InitialContextFactoryBuilder builder)
+ throws NamingException
+ {
+ SecurityManager sm = System.getSecurityManager ();
+ if (sm != null)
+ sm.checkSetFactory ();
+ // Once the builder is installed it cannot be replaced.
+ if (icfb != null)
+ throw new IllegalStateException ("builder already installed");
+ if (builder != null)
+ icfb = builder;
+ }
+
+ public static Context getContinuationContext (CannotProceedException cpe)
+ throws NamingException
+ {
+ Hashtable env = cpe.getEnvironment ();
+ if (env != null)
+ env.put (CPE, cpe);
+
+ // It is really unclear to me if this is right.
+ try
+ {
+ Object obj = getObjectInstance (null, cpe.getAltName (),
+ cpe.getAltNameCtx (), env);
+ if (obj != null)
+ return (Context) obj;
+ }
+ catch (Exception _)
+ {
+ }
+
+ throw cpe;
+ }
+
+ public static Object getStateToBind (Object obj, Name name,
+ Context nameCtx, Hashtable environment)
+ throws NamingException
+ {
+ StringTokenizer tokens = getPlusPath (Context.STATE_FACTORIES,
+ environment, nameCtx);
+ while (tokens.hasMoreTokens ())
+ {
+ String klassName = tokens.nextToken ();
+ try
+ {
+ Class k = Class.forName (klassName);
+ StateFactory factory = (StateFactory) k.newInstance ();
+ Object o = factory.getStateToBind (obj, name, nameCtx,
+ environment);
+ if (o != null)
+ return o;
+ }
+ catch (ClassNotFoundException _1)
+ {
+ // Ignore it.
+ }
+ catch (ClassCastException _2)
+ {
+ // This means that the class we found was not an
+ // ObjectFactory or that the factory returned something
+ // which was not a Context.
+ }
+ catch (InstantiationException _3)
+ {
+ // If we couldn't instantiate the factory we might get
+ // this.
+ }
+ catch (IllegalAccessException _4)
+ {
+ // Another possibility when instantiating.
+ }
+ }
+
+ return obj;
}
}
diff --git a/libjava/javax/naming/spi/ObjectFactory.java b/libjava/javax/naming/spi/ObjectFactory.java
index 760e586..8189628 100644
--- a/libjava/javax/naming/spi/ObjectFactory.java
+++ b/libjava/javax/naming/spi/ObjectFactory.java
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 Free Software Foundation
+/* Copyright (C) 2001 Free Software Foundation
This file is part of libgcj.
@@ -11,14 +11,11 @@ package javax.naming.spi;
import java.util.Hashtable;
import javax.naming.*;
-public class ObjectFactory
+public interface ObjectFactory
{
public Object getObjectInstance (Object obj,
Name name,
Context nameCtx,
Hashtable environment)
- throws Exception
- {
- throw new Error ("javax.naming.spi.ObjectFactory.getObjectInstance not implemented");
- }
+ throws Exception;
}
diff --git a/libjava/javax/naming/spi/ObjectFactoryBuilder.java b/libjava/javax/naming/spi/ObjectFactoryBuilder.java
new file mode 100644
index 0000000..e879603
--- /dev/null
+++ b/libjava/javax/naming/spi/ObjectFactoryBuilder.java
@@ -0,0 +1,23 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.spi;
+import javax.naming.*;
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface ObjectFactoryBuilder
+{
+ public ObjectFactory createObjectFactory(Object obj,
+ Hashtable environment)
+ throws NamingException;
+}
diff --git a/libjava/javax/naming/spi/ResolveResult.java b/libjava/javax/naming/spi/ResolveResult.java
new file mode 100644
index 0000000..d00aef5
--- /dev/null
+++ b/libjava/javax/naming/spi/ResolveResult.java
@@ -0,0 +1,93 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.spi;
+import javax.naming.*;
+import java.util.EventObject;
+import java.io.Serializable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 5, 2001
+ */
+
+public class ResolveResult implements Serializable
+{
+ // Serialized fields.
+ protected Object resolvedObj;
+ protected Name remainingName;
+
+ protected ResolveResult()
+ {
+ resolvedObj = null;
+ remainingName = null;
+ }
+
+ public ResolveResult(Object robj, String rcomp)
+ {
+ if (robj == null || rcomp == null)
+ throw new IllegalArgumentException ();
+ resolvedObj = robj;
+ remainingName = new CompositeName ();
+ try
+ {
+ remainingName.add (rcomp);
+ }
+ catch (InvalidNameException _)
+ {
+ }
+ }
+
+ public ResolveResult(Object robj, Name rname)
+ {
+ resolvedObj = robj;
+ remainingName = rname;
+ }
+
+ public Name getRemainingName()
+ {
+ return remainingName;
+ }
+
+ public Object getResolvedObj()
+ {
+ return resolvedObj;
+ }
+
+ public void setRemainingName(Name name)
+ {
+ remainingName = (Name) name.clone();
+ }
+
+ public void appendRemainingName(Name name)
+ {
+ try
+ {
+ remainingName.addAll(name);
+ }
+ catch (InvalidNameException _)
+ {
+ }
+ }
+
+ public void appendRemainingComponent(String name)
+ {
+ try
+ {
+ remainingName.add(name);
+ }
+ catch (InvalidNameException _)
+ {
+ }
+ }
+
+ public void setResolvedObj(Object obj)
+ {
+ resolvedObj = obj;
+ }
+}
diff --git a/libjava/javax/naming/spi/Resolver.java b/libjava/javax/naming/spi/Resolver.java
new file mode 100644
index 0000000..ff52f66
--- /dev/null
+++ b/libjava/javax/naming/spi/Resolver.java
@@ -0,0 +1,23 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.spi;
+import javax.naming.*;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface Resolver
+{
+ public ResolveResult resolveToClass(Name name, Class contextType)
+ throws NamingException;
+ public ResolveResult resolveToClass(String name, Class contextType)
+ throws NamingException;
+}
diff --git a/libjava/javax/naming/spi/StateFactory.java b/libjava/javax/naming/spi/StateFactory.java
new file mode 100644
index 0000000..3be66d2
--- /dev/null
+++ b/libjava/javax/naming/spi/StateFactory.java
@@ -0,0 +1,22 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.naming.spi;
+import javax.naming.*;
+import java.util.Hashtable;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date June 1, 2001
+ */
+
+public interface StateFactory
+{
+ public Object getStateToBind(Object obj, Name name, Context nameCtx,
+ Hashtable environment) throws NamingException;
+}
diff --git a/libjava/javax/transaction/HeuristicCommitException.java b/libjava/javax/transaction/HeuristicCommitException.java
new file mode 100644
index 0000000..0646a23
--- /dev/null
+++ b/libjava/javax/transaction/HeuristicCommitException.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public class HeuristicCommitException extends java.lang.Exception
+{
+ public HeuristicCommitException ()
+ {
+ super();
+ }
+
+ public HeuristicCommitException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/HeuristicMixedException.java b/libjava/javax/transaction/HeuristicMixedException.java
new file mode 100644
index 0000000..f351da3
--- /dev/null
+++ b/libjava/javax/transaction/HeuristicMixedException.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public class HeuristicMixedException extends java.lang.Exception
+{
+ public HeuristicMixedException ()
+ {
+ super();
+ }
+
+ public HeuristicMixedException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/HeuristicRollbackException.java b/libjava/javax/transaction/HeuristicRollbackException.java
new file mode 100644
index 0000000..7ad3782
--- /dev/null
+++ b/libjava/javax/transaction/HeuristicRollbackException.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public class HeuristicRollbackException extends java.lang.Exception
+{
+ public HeuristicRollbackException ()
+ {
+ super();
+ }
+
+ public HeuristicRollbackException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/InvalidTransactionException.java b/libjava/javax/transaction/InvalidTransactionException.java
new file mode 100644
index 0000000..f5bb718
--- /dev/null
+++ b/libjava/javax/transaction/InvalidTransactionException.java
@@ -0,0 +1,29 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date April 18, 2001
+ */
+
+public class InvalidTransactionException extends RemoteException
+{
+ public InvalidTransactionException ()
+ {
+ super();
+ }
+
+ public InvalidTransactionException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/NotSupportedException.java b/libjava/javax/transaction/NotSupportedException.java
new file mode 100644
index 0000000..767babb
--- /dev/null
+++ b/libjava/javax/transaction/NotSupportedException.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public class NotSupportedException extends java.lang.Exception
+{
+ public NotSupportedException ()
+ {
+ super();
+ }
+
+ public NotSupportedException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/RollbackException.java b/libjava/javax/transaction/RollbackException.java
new file mode 100644
index 0000000..7bc77ee
--- /dev/null
+++ b/libjava/javax/transaction/RollbackException.java
@@ -0,0 +1,27 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public class RollbackException extends java.lang.Exception
+{
+ public RollbackException ()
+ {
+ super();
+ }
+
+ public RollbackException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/Status.java b/libjava/javax/transaction/Status.java
new file mode 100644
index 0000000..84f1e7c
--- /dev/null
+++ b/libjava/javax/transaction/Status.java
@@ -0,0 +1,28 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface Status
+{
+ public static final int STATUS_ACTIVE = 0;
+ public static final int STATUS_MARKED_ROLLBACK = 1;
+ public static final int STATUS_PREPARED = 2;
+ public static final int STATUS_COMMITTED = 3;
+ public static final int STATUS_ROLLEDBACK = 4;
+ public static final int STATUS_UNKNOWN = 5;
+ public static final int STATUS_NO_TRANSACTION = 6;
+ public static final int STATUS_PREPARING = 7;
+ public static final int STATUS_COMMITTING = 8;
+ public static final int STATUS_ROLLING_BACK = 9;
+}
diff --git a/libjava/javax/transaction/Synchronization.java b/libjava/javax/transaction/Synchronization.java
new file mode 100644
index 0000000..046f64d
--- /dev/null
+++ b/libjava/javax/transaction/Synchronization.java
@@ -0,0 +1,20 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface Synchronization
+{
+ public void beforeCompletion();
+ public void afterCompletion(int status);
+}
diff --git a/libjava/javax/transaction/SystemException.java b/libjava/javax/transaction/SystemException.java
new file mode 100644
index 0000000..e279aca
--- /dev/null
+++ b/libjava/javax/transaction/SystemException.java
@@ -0,0 +1,35 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public class SystemException extends java.lang.Exception
+{
+ public int errorCode;
+
+ public SystemException ()
+ {
+ super();
+ }
+
+ public SystemException (String msg)
+ {
+ super(msg);
+ }
+
+ public SystemException(int errcode)
+ {
+ super ();
+ this.errorCode = errcode;
+ }
+}
diff --git a/libjava/javax/transaction/Transaction.java b/libjava/javax/transaction/Transaction.java
new file mode 100644
index 0000000..632707c
--- /dev/null
+++ b/libjava/javax/transaction/Transaction.java
@@ -0,0 +1,33 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+import javax.transaction.xa.XAResource;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface Transaction
+{
+ public void commit()
+ throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, java.lang.SecurityException, SystemException;
+ public boolean delistResource(XAResource xaRes, int flag)
+ throws java.lang.IllegalStateException, SystemException;
+ public boolean enlistResource(XAResource xaRes)
+ throws RollbackException, java.lang.IllegalStateException, SystemException;
+ public int getStatus() throws SystemException;
+ public void registerSynchronization(Synchronization sync)
+ throws RollbackException, java.lang.IllegalStateException, SystemException;
+ public void rollback()
+ throws java.lang.IllegalStateException, SystemException;
+ public void setRollbackOnly()
+ throws java.lang.IllegalStateException, SystemException;
+}
diff --git a/libjava/javax/transaction/TransactionManager.java b/libjava/javax/transaction/TransactionManager.java
new file mode 100644
index 0000000..9f5f57c
--- /dev/null
+++ b/libjava/javax/transaction/TransactionManager.java
@@ -0,0 +1,35 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface TransactionManager
+{
+ public void begin() throws NotSupportedException, SystemException;
+ public void commit()
+ throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, java.lang.SecurityException,
+ java.lang.IllegalStateException, SystemException;
+ public int getStatus() throws SystemException;
+ public Transaction getTransaction() throws SystemException;
+ public void resume(Transaction tobj)
+ throws InvalidTransactionException, java.lang.IllegalStateException,
+ SystemException;
+ public void rollback()
+ throws java.lang.IllegalStateException, java.lang.SecurityException,
+ SystemException;
+ public void setRollbackOnly()
+ throws java.lang.IllegalStateException, SystemException;
+ public void setTransactionTimeout(int seconds) throws SystemException;
+ public Transaction suspend() throws SystemException;
+}
diff --git a/libjava/javax/transaction/TransactionRequiredException.java b/libjava/javax/transaction/TransactionRequiredException.java
new file mode 100644
index 0000000..e845a9f
--- /dev/null
+++ b/libjava/javax/transaction/TransactionRequiredException.java
@@ -0,0 +1,29 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date April 18, 2001
+ */
+
+public class TransactionRequiredException extends RemoteException
+{
+ public TransactionRequiredException ()
+ {
+ super();
+ }
+
+ public TransactionRequiredException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/TransactionRolledbackException.java b/libjava/javax/transaction/TransactionRolledbackException.java
new file mode 100644
index 0000000..96dd8dd
--- /dev/null
+++ b/libjava/javax/transaction/TransactionRolledbackException.java
@@ -0,0 +1,29 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+import java.rmi.RemoteException;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date April 18, 2001
+ */
+
+public class TransactionRolledbackException extends RemoteException
+{
+ public TransactionRolledbackException ()
+ {
+ super();
+ }
+
+ public TransactionRolledbackException (String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/libjava/javax/transaction/UserTransaction.java b/libjava/javax/transaction/UserTransaction.java
new file mode 100644
index 0000000..eb02a6c
--- /dev/null
+++ b/libjava/javax/transaction/UserTransaction.java
@@ -0,0 +1,30 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface UserTransaction
+{
+ public void begin() throws NotSupportedException, SystemException;
+ public void commit()
+ throws RollbackException, HeuristicMixedException,
+ HeuristicRollbackException, java.lang.SecurityException,
+ java.lang.IllegalStateException, SystemException;
+ public void rollback()
+ throws java.lang.IllegalStateException, java.lang.SecurityException,
+ SystemException;
+ public void setRollbackOnly()
+ throws java.lang.IllegalStateException, SystemException;
+ public int getStatus() throws SystemException;
+ public void setTransactionTimeout(int seconds) throws SystemException;
+}
diff --git a/libjava/javax/transaction/xa/XAException.java b/libjava/javax/transaction/xa/XAException.java
new file mode 100644
index 0000000..43ede1d
--- /dev/null
+++ b/libjava/javax/transaction/xa/XAException.java
@@ -0,0 +1,60 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction.xa;
+
+/**
+ * @author Tom Tromey <tromey@redhat.com>
+ * @date April 18, 2001
+ */
+
+public class XAException extends Exception
+{
+ public int errorCode;
+ public static final int XA_RBBASE = 100;
+ public static final int XA_RBROLLBACK = 100;
+ public static final int XA_RBCOMMFAIL = 101;
+ public static final int XA_RBDEADLOCK = 102;
+ public static final int XA_RBINTEGRITY = 103;
+ public static final int XA_RBOTHER = 104;
+ public static final int XA_RBPROTO = 105;
+ public static final int XA_RBTIMEOUT = 106;
+ public static final int XA_RBTRANSIENT = 107;
+ public static final int XA_RBEND = 107;
+ public static final int XA_NOMIGRATE = 9;
+ public static final int XA_HEURHAZ = 8;
+ public static final int XA_HEURCOM = 7;
+ public static final int XA_HEURRB = 6;
+ public static final int XA_HEURMIX = 5;
+ public static final int XA_RETRY = 4;
+ public static final int XA_RDONLY = 3;
+ public static final int XAER_ASYNC = -2;
+ public static final int XAER_RMERR = -3;
+ public static final int XAER_NOTA = -4;
+ public static final int XAER_INVAL = -5;
+ public static final int XAER_PROTO = -6;
+ public static final int XAER_RMFAIL = -7;
+ public static final int XAER_DUPID = -8;
+ public static final int XAER_OUTSIDE = -9;
+
+ public XAException ()
+ {
+ super ();
+ }
+
+ public XAException (String msg)
+ {
+ super (msg);
+ }
+
+ public XAException (int errcode)
+ {
+ super ();
+ this.errorCode = errcode;
+ }
+}
diff --git a/libjava/javax/transaction/xa/XAResource.java b/libjava/javax/transaction/xa/XAResource.java
new file mode 100644
index 0000000..226850c
--- /dev/null
+++ b/libjava/javax/transaction/xa/XAResource.java
@@ -0,0 +1,40 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction.xa;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface XAResource
+{
+ public static final int TMENDRSCAN = 8388608;
+ public static final int TMFAIL = 536870912;
+ public static final int TMJOIN = 2097152;
+ public static final int TMNOFLAGS = 0;
+ public static final int TMONEPHASE = 1073741824;
+ public static final int TMRESUME = 134217728;
+ public static final int TMSTARTRSCAN = 16777216;
+ public static final int TMSUCCESS = 67108864;
+ public static final int TMSUSPEND = 33554432;
+ public static final int XA_RDONLY = 3;
+ public static final int XA_OK = 0;
+
+ public void commit(Xid xid, boolean onePhase) throws XAException;
+ public void end(Xid xid, int flags) throws XAException;
+ public void forget(Xid xid) throws XAException;
+ public int getTransactionTimeout() throws XAException;
+ public boolean isSameRM(XAResource xares) throws XAException;
+ public int prepare(Xid xid) throws XAException;
+ public Xid[] recover(int flag) throws XAException;
+ public void rollback(Xid xid) throws XAException;
+ public boolean setTransactionTimeout(int seconds) throws XAException;
+ public void start(Xid xid, int flags) throws XAException;
+}
diff --git a/libjava/javax/transaction/xa/Xid.java b/libjava/javax/transaction/xa/Xid.java
new file mode 100644
index 0000000..2edf0c5
--- /dev/null
+++ b/libjava/javax/transaction/xa/Xid.java
@@ -0,0 +1,24 @@
+/* Copyright (C) 2001 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package javax.transaction.xa;
+
+/**
+ * @author Warren Levy <warrenl@redhat.com>
+ * @date May 25, 2001
+ */
+
+public abstract interface Xid
+{
+ public static final int MAXGTRIDSIZE = 64;
+ public static final int MAXBQUALSIZE = 64;
+
+ public int getFormatId();
+ public byte[] getGlobalTransactionId();
+ public byte[] getBranchQualifier();
+}