aboutsummaryrefslogtreecommitdiff
path: root/libjava/javax/naming/spi
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2000-11-27 03:16:14 +0000
committerAnthony Green <green@gcc.gnu.org>2000-11-27 03:16:14 +0000
commit18205ca3b63fa0536ce6db35b4f1e264bdda5276 (patch)
treefddd25f01c276e915b483a1138befefd75ad4852 /libjava/javax/naming/spi
parent158227a66aac2270747de0be47f1026e6bb13782 (diff)
downloadgcc-18205ca3b63fa0536ce6db35b4f1e264bdda5276.zip
gcc-18205ca3b63fa0536ce6db35b4f1e264bdda5276.tar.gz
gcc-18205ca3b63fa0536ce6db35b4f1e264bdda5276.tar.bz2
Initial jndi check-in
From-SVN: r37770
Diffstat (limited to 'libjava/javax/naming/spi')
-rw-r--r--libjava/javax/naming/spi/InitialContextFactory.java18
-rw-r--r--libjava/javax/naming/spi/InitialContextFactoryBuilder.java17
-rw-r--r--libjava/javax/naming/spi/NamingManager.java57
-rw-r--r--libjava/javax/naming/spi/ObjectFactory.java24
4 files changed, 116 insertions, 0 deletions
diff --git a/libjava/javax/naming/spi/InitialContextFactory.java b/libjava/javax/naming/spi/InitialContextFactory.java
new file mode 100644
index 0000000..493b3f5
--- /dev/null
+++ b/libjava/javax/naming/spi/InitialContextFactory.java
@@ -0,0 +1,18 @@
+/* Copyright (C) 2000 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 java.util.Hashtable;
+import javax.naming.Context;
+import javax.naming.NamingException;
+
+public interface InitialContextFactory
+{
+ public Context getInitialContext (Hashtable environment) throws NamingException;
+}
diff --git a/libjava/javax/naming/spi/InitialContextFactoryBuilder.java b/libjava/javax/naming/spi/InitialContextFactoryBuilder.java
new file mode 100644
index 0000000..e4ae85f
--- /dev/null
+++ b/libjava/javax/naming/spi/InitialContextFactoryBuilder.java
@@ -0,0 +1,17 @@
+/* Copyright (C) 2000 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 java.util.Hashtable;
+import javax.naming.NamingException;
+
+public interface InitialContextFactoryBuilder
+{
+ public InitialContextFactory createInitialContextFactory (Hashtable environment) throws NamingException;
+}
diff --git a/libjava/javax/naming/spi/NamingManager.java b/libjava/javax/naming/spi/NamingManager.java
new file mode 100644
index 0000000..9cb814e
--- /dev/null
+++ b/libjava/javax/naming/spi/NamingManager.java
@@ -0,0 +1,57 @@
+/* Copyright (C) 2000 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 java.util.Hashtable;
+import javax.naming.*;
+
+public class NamingManager
+{
+ private static InitialContextFactoryBuilder icfb = null;
+
+ public static boolean hasInitialContextFactoryBuilder ()
+ {
+ return icfb != null;
+ }
+
+ public static Context getInitialContext (Hashtable environment) throws NamingException
+ {
+ InitialContextFactory icf = null;
+
+ if (icfb != null)
+ icf = icfb.createInitialContextFactory(environment);
+ else
+ {
+ String java_naming_factory_initial = null;
+ if (environment != null)
+ java_naming_factory_initial
+ = (String) environment.get (Context.INITIAL_CONTEXT_FACTORY);
+ if (java_naming_factory_initial == null)
+ 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;
+ }
+ }
+
+ return icf.getInitialContext (environment);
+ }
+
+ public static Context getURLContext(String scheme,
+ Hashtable environment)
+ throws NamingException
+ {
+ throw new Error ("javax.naming.spi.NamingManager.getURLContext not implemented");
+ }
+}
diff --git a/libjava/javax/naming/spi/ObjectFactory.java b/libjava/javax/naming/spi/ObjectFactory.java
new file mode 100644
index 0000000..760e586
--- /dev/null
+++ b/libjava/javax/naming/spi/ObjectFactory.java
@@ -0,0 +1,24 @@
+/* Copyright (C) 2000 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 java.util.Hashtable;
+import javax.naming.*;
+
+public class ObjectFactory
+{
+ public Object getObjectInstance (Object obj,
+ Name name,
+ Context nameCtx,
+ Hashtable environment)
+ throws Exception
+ {
+ throw new Error ("javax.naming.spi.ObjectFactory.getObjectInstance not implemented");
+ }
+}