mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-21 17:21:03 +08:00
Initial jndi check-in
From-SVN: r37770
This commit is contained in:
parent
158227a66a
commit
18205ca3b6
@ -1,3 +1,21 @@
|
||||
2000-11-26 Anthony Green <green@redhat.com>
|
||||
|
||||
* javax/naming/spi/NamingManager.java,
|
||||
javax/naming/spi/ObjectFactory.java,
|
||||
javax/naming/spi/InitialContextFactory.java,
|
||||
javax/naming/spi/InitialContextFactoryBuilder.java,
|
||||
javax/naming/RefAddr.java, javax/naming/Reference.java,
|
||||
javax/naming/NamingException.java, javax/naming/Context.java,
|
||||
javax/naming/Referenceable.java,
|
||||
javax/naming/directory/InitialDirContext.java,
|
||||
javax/naming/directory/DirContext.java,
|
||||
javax/naming/directory/Attributes.java,
|
||||
javax/naming/directory/Attribute.java,
|
||||
javax/naming/StringRefAddr.java,
|
||||
javax/naming/NamingEnumeration.java, javax/naming/Name.java,
|
||||
javax/naming/InitialContext.java,
|
||||
javax/naming/NoInitialContextException.java: New files.
|
||||
|
||||
2000-11-25 Anthony Green <green@redhat.com>
|
||||
|
||||
* prims.cc (_Jv_NewObjectArray): Undo placement change.
|
||||
|
83
libjava/javax/naming/Context.java
Normal file
83
libjava/javax/naming/Context.java
Normal file
@ -0,0 +1,83 @@
|
||||
/* 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;
|
||||
|
||||
public interface Context
|
||||
{
|
||||
// Property with name of the inital context factory to use
|
||||
public static final String INITIAL_CONTEXT_FACTORY
|
||||
= "java.naming.factory.initial";
|
||||
|
||||
// Property with colon-separated list of object factories to use.
|
||||
public static final String OBJECT_FACTORIES
|
||||
= "java.naming.factory.object";
|
||||
|
||||
// Property with colon-separated list of state factories to use.
|
||||
public static final String STATE_FACTORIES
|
||||
= "java.naming.factory.state";
|
||||
|
||||
// Property with colon-separated list of package prefixes to use.
|
||||
public static final String URL_PKG_PREFIXES
|
||||
= "java.naming.factory.url.pkgs";
|
||||
|
||||
// Property with URL specifying configuration for the service
|
||||
// provider to use.
|
||||
public static final String PROVIDER_URL
|
||||
= "java.naming.provider.url";
|
||||
|
||||
// Property with the DNS host and domain names to use.
|
||||
public static final String DNS_URL
|
||||
= "java.naming.dns.url";
|
||||
|
||||
// Property with the authoritativeness of the service requested.
|
||||
public static final String AUTHORITATIVE
|
||||
= "java.naming.authoritative";
|
||||
|
||||
// Property with the batch size to use when returning data via the
|
||||
// service's protocol.
|
||||
public static final String BATCHSIZE
|
||||
= "java.naming.batchsize";
|
||||
|
||||
// Property defining how referrals encountered by the service
|
||||
// provider are to be processed.
|
||||
public static final String REFERRAL
|
||||
= "java.naming.referral";
|
||||
|
||||
// Property specifying the security protocol to use.
|
||||
public static final String SECURITY_PROTOCOL
|
||||
= "java.naming.security.protocol";
|
||||
|
||||
// Property specifying the security level to use.
|
||||
public static final String SECURITY_AUTHENTICATION
|
||||
= "java.naming.security.authentication";
|
||||
|
||||
// Property for the identity of the principal for authenticating
|
||||
// the caller to the service.
|
||||
public static final String SECURITY_PRINCIPAL
|
||||
= "java.naming.security.principal";
|
||||
|
||||
// Property specifying the credentials of the principal for
|
||||
// authenticating the caller to the service.
|
||||
public static final String SECURITY_CREDENTIAL
|
||||
= "java.naming.security.credentials";
|
||||
|
||||
// Property for specifying the preferred language to use with the
|
||||
// service.
|
||||
public static final String LANGUAGE
|
||||
= "java.naming.language";
|
||||
|
||||
// Property for the initial context constructor to use when searching
|
||||
// for other properties.
|
||||
public static final String APPLET
|
||||
= "java.naming.applet";
|
||||
|
||||
public void bind (Name name, Object obj) throws NamingException;
|
||||
public void bind (String name, Object obj) throws NamingException;
|
||||
}
|
||||
|
197
libjava/javax/naming/InitialContext.java
Normal file
197
libjava/javax/naming/InitialContext.java
Normal file
@ -0,0 +1,197 @@
|
||||
/* 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Properties;
|
||||
import java.applet.Applet;
|
||||
import java.util.Hashtable;
|
||||
import javax.naming.spi.NamingManager;
|
||||
|
||||
|
||||
public class InitialContext implements Context
|
||||
{
|
||||
protected Context defaultInitCtx;
|
||||
protected boolean gotDefault = false;
|
||||
protected Hashtable myProps;
|
||||
|
||||
InitialContext (Hashtable environment)
|
||||
{
|
||||
init (environment);
|
||||
}
|
||||
|
||||
protected InitialContext (boolean lazy)
|
||||
{
|
||||
if (! lazy)
|
||||
init (null);
|
||||
}
|
||||
|
||||
InitialContext ()
|
||||
{
|
||||
init (null);
|
||||
}
|
||||
|
||||
protected void init (Hashtable environment)
|
||||
{
|
||||
// FIXME: Is this enough?
|
||||
final String[] properties = {
|
||||
Context.DNS_URL,
|
||||
Context.INITIAL_CONTEXT_FACTORY,
|
||||
Context.OBJECT_FACTORIES,
|
||||
Context.PROVIDER_URL,
|
||||
Context.STATE_FACTORIES,
|
||||
Context.URL_PKG_PREFIXES,
|
||||
};
|
||||
|
||||
// Create myProps, cloning environment if needed.
|
||||
if (environment != null)
|
||||
myProps = (Hashtable) environment.clone ();
|
||||
else
|
||||
myProps = new Hashtable ();
|
||||
|
||||
Applet napplet = (Applet) myProps.get (Context.APPLET);
|
||||
|
||||
for (int i = properties.length - 1; i >= 0; i--)
|
||||
{
|
||||
Object o = myProps.get (properties[i]);
|
||||
|
||||
if (o == null)
|
||||
{
|
||||
if (napplet != null)
|
||||
o = napplet.getParameter (properties[i]);
|
||||
if (o == null)
|
||||
o = System.getProperty (properties[i]);
|
||||
if (o != null)
|
||||
myProps.put (properties[i], o);
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Enumeration ep = Thread.currentThread().getContextClassLoader().getResources("jndi.naming");
|
||||
while (ep.hasMoreElements ())
|
||||
{
|
||||
URL url = (URL) ep.nextElement ();
|
||||
Properties p = new Properties ();
|
||||
|
||||
try {
|
||||
InputStream is = url.openStream ();
|
||||
p.load (is);
|
||||
is.close ();
|
||||
} catch (IOException e) {}
|
||||
|
||||
merge (myProps, p);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {}
|
||||
|
||||
String home = System.getProperty("java.home");
|
||||
if (home != null)
|
||||
{
|
||||
String fileName = home + File.separator
|
||||
+ "lib" + File.separator + "jndi.properties";
|
||||
Properties p = new Properties ();
|
||||
|
||||
try {
|
||||
InputStream is = new FileInputStream (fileName);
|
||||
p.load (is);
|
||||
is.close ();
|
||||
} catch (IOException e) {}
|
||||
|
||||
merge (myProps, p);
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Is this enough?
|
||||
private static final String[] colon_list =
|
||||
{
|
||||
Context.OBJECT_FACTORIS,
|
||||
Context.URL_PKG_PREFIXES,
|
||||
Context.STATE_FACTORIES
|
||||
};
|
||||
|
||||
private static void merge (Hashtable h1, Hashtable h2)
|
||||
{
|
||||
Enumeration e2 = h2.keys();
|
||||
|
||||
while (e2.hasMoreElements())
|
||||
{
|
||||
String key2 = (String) e2.nextElement();
|
||||
Object value1 = h1.get(key2);
|
||||
if (value1 == null)
|
||||
h1.put(key2, h2.get(key2));
|
||||
else if (key2.compareTo(colon_list[0]) == 0
|
||||
|| key2.compareTo(colon_list[1]) == 0
|
||||
|| key2.compareTo(colon_list[2]) == 0
|
||||
|| key2.compareTo(colon_list[3]) == 0)
|
||||
{
|
||||
String value2 = (String) h2.get(key2);
|
||||
h1.put(key2, (String) value1 + ":" + value2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected Context getDefaultInitCtx () throws NamingException
|
||||
{
|
||||
if (! gotDefault)
|
||||
{
|
||||
defaultInitCtx = NamingManager.getInitialContext (myProps);
|
||||
gotDefault = true;
|
||||
}
|
||||
return defaultInitCtx;
|
||||
}
|
||||
|
||||
|
||||
protected Context getURLOrDefaultInitCtx (Name name)
|
||||
throws NamingException
|
||||
{
|
||||
if (name.size () > 0)
|
||||
return getURLOrDefaultInitCtx (name.get (0));
|
||||
else
|
||||
return getDefaultInitCtx ();
|
||||
}
|
||||
|
||||
protected Context getURLOrDefaultInitCtx (String name)
|
||||
throws NamingException
|
||||
{
|
||||
String scheme = null;
|
||||
|
||||
if (NamingManager.hasInitialContextFactoryBuilder())
|
||||
return getDefaultInitCtx();
|
||||
int colon = name.indexOf(':');
|
||||
int slash = name.indexOf('/');
|
||||
if (colon > 0 && (slash == -1 || colon < slash))
|
||||
scheme = name.substring(0, colon);
|
||||
if (scheme != null)
|
||||
{
|
||||
Context context =
|
||||
NamingManager.getURLContext(scheme, myProps);
|
||||
if (context != null)
|
||||
return context;
|
||||
}
|
||||
|
||||
return getDefaultInitCtx();
|
||||
}
|
||||
|
||||
public void bind (Name name, Object obj) throws NamingException
|
||||
{
|
||||
getURLOrDefaultInitCtx (name).bind (name, obj);
|
||||
}
|
||||
|
||||
public void bind (String name, Object obj) throws NamingException
|
||||
{
|
||||
getURLOrDefaultInitCtx (name).bind (name, obj);
|
||||
}
|
||||
}
|
17
libjava/javax/naming/Name.java
Normal file
17
libjava/javax/naming/Name.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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface Name extends Cloneable, Serializable
|
||||
{
|
||||
public int size ();
|
||||
public String get (int index);
|
||||
}
|
18
libjava/javax/naming/NamingEnumeration.java
Normal file
18
libjava/javax/naming/NamingEnumeration.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;
|
||||
|
||||
import java.util.Enumeration;
|
||||
|
||||
public interface NamingEnumeration extends Enumeration
|
||||
{
|
||||
public void close() throws NamingException;
|
||||
public boolean hasMore() throws NamingException;
|
||||
public Object next() throws NamingException;
|
||||
}
|
36
libjava/javax/naming/NamingException.java
Normal file
36
libjava/javax/naming/NamingException.java
Normal file
@ -0,0 +1,36 @@
|
||||
/* 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;
|
||||
|
||||
import java.lang.Exception;
|
||||
|
||||
public class NamingException extends Exception
|
||||
{
|
||||
protected Throwable rootException;
|
||||
|
||||
public NamingException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public NamingException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
|
||||
public Throwable getRootCause ()
|
||||
{
|
||||
return rootException;
|
||||
}
|
||||
|
||||
public void setRootCause (Throwable e)
|
||||
{
|
||||
rootException = e;
|
||||
}
|
||||
}
|
24
libjava/javax/naming/NoInitialContextException.java
Normal file
24
libjava/javax/naming/NoInitialContextException.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;
|
||||
|
||||
import java.lang.Exception;
|
||||
|
||||
public class NoInitialContextException extends NamingException
|
||||
{
|
||||
public NoInitialContextException()
|
||||
{
|
||||
super();
|
||||
}
|
||||
|
||||
public NoInitialContextException(String msg)
|
||||
{
|
||||
super(msg);
|
||||
}
|
||||
}
|
15
libjava/javax/naming/RefAddr.java
Normal file
15
libjava/javax/naming/RefAddr.java
Normal file
@ -0,0 +1,15 @@
|
||||
/* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class RefAddr implements Serializable
|
||||
{
|
||||
}
|
36
libjava/javax/naming/Reference.java
Normal file
36
libjava/javax/naming/Reference.java
Normal file
@ -0,0 +1,36 @@
|
||||
/* 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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Reference implements Cloneable, Serializable
|
||||
{
|
||||
public Reference (String className, String factory, String factoryLocation)
|
||||
{
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
void add (RefAddr addr)
|
||||
{
|
||||
throw new Error ("javax.naming.Reference.add not implemented");
|
||||
}
|
||||
|
||||
RefAddr get (String addrType)
|
||||
{
|
||||
throw new Error ("javax.naming.Reference.get not implemented");
|
||||
}
|
||||
|
||||
public String getClassName ()
|
||||
{
|
||||
return className;
|
||||
}
|
||||
|
||||
private String className;
|
||||
}
|
14
libjava/javax/naming/Referenceable.java
Normal file
14
libjava/javax/naming/Referenceable.java
Normal file
@ -0,0 +1,14 @@
|
||||
/* 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;
|
||||
|
||||
public interface Referenceable
|
||||
{
|
||||
public Reference getReference() throws NamingException;
|
||||
}
|
24
libjava/javax/naming/StringRefAddr.java
Normal file
24
libjava/javax/naming/StringRefAddr.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;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class StringRefAddr extends RefAddr
|
||||
{
|
||||
public StringRefAddr (String addrType, String addr)
|
||||
{
|
||||
throw new Error ("javax.naming.StringRefAddr not implemented");
|
||||
}
|
||||
|
||||
public Object getContent ()
|
||||
{
|
||||
throw new Error ("javax.naming.StringRefAddr.getContent not implemented");
|
||||
}
|
||||
}
|
20
libjava/javax/naming/directory/Attribute.java
Normal file
20
libjava/javax/naming/directory/Attribute.java
Normal file
@ -0,0 +1,20 @@
|
||||
/* 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.directory;
|
||||
|
||||
import javax.naming.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface Attribute extends Cloneable, Serializable
|
||||
{
|
||||
// FIXME
|
||||
|
||||
NamingEnumeration getAll ();
|
||||
}
|
||||
|
20
libjava/javax/naming/directory/Attributes.java
Normal file
20
libjava/javax/naming/directory/Attributes.java
Normal file
@ -0,0 +1,20 @@
|
||||
/* 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.directory;
|
||||
|
||||
import javax.naming.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
public interface Attributes extends Cloneable, Serializable
|
||||
{
|
||||
// FIXME
|
||||
|
||||
NamingEnumeration getAll ();
|
||||
}
|
||||
|
18
libjava/javax/naming/directory/DirContext.java
Normal file
18
libjava/javax/naming/directory/DirContext.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.directory;
|
||||
|
||||
import javax.naming.*;
|
||||
|
||||
public interface DirContext extends Context
|
||||
{
|
||||
public Attributes getAttributes (String name);
|
||||
public Attributes getAttributes (String name, String[] attrIds);
|
||||
}
|
||||
|
20
libjava/javax/naming/directory/InitialDirContext.java
Normal file
20
libjava/javax/naming/directory/InitialDirContext.java
Normal file
@ -0,0 +1,20 @@
|
||||
/* 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.directory;
|
||||
|
||||
import javax.naming.*;
|
||||
import java.util.Hashtable;
|
||||
|
||||
public class InitialDirContext extends InitialContext implements DirContext
|
||||
{
|
||||
public InitialDirContext (Hashtable environment)
|
||||
{
|
||||
throw new Error ("javax.naming.directory.InitialDirContext not implemented");
|
||||
}
|
||||
}
|
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…
x
Reference in New Issue
Block a user