Initial jndi check-in
From-SVN: r37770
This commit is contained in:
parent
158227a66a
commit
18205ca3b6
19 changed files with 676 additions and 0 deletions
18
libjava/javax/naming/spi/InitialContextFactory.java
Normal file
18
libjava/javax/naming/spi/InitialContextFactory.java
Normal file
|
@ -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;
|
||||
}
|
17
libjava/javax/naming/spi/InitialContextFactoryBuilder.java
Normal file
17
libjava/javax/naming/spi/InitialContextFactoryBuilder.java
Normal file
|
@ -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;
|
||||
}
|
57
libjava/javax/naming/spi/NamingManager.java
Normal file
57
libjava/javax/naming/spi/NamingManager.java
Normal file
|
@ -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");
|
||||
}
|
||||
}
|
24
libjava/javax/naming/spi/ObjectFactory.java
Normal file
24
libjava/javax/naming/spi/ObjectFactory.java
Normal file
|
@ -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");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue