org.wamblee.support.jndi
Class StubInitialContextFactory
java.lang.Object
org.wamblee.support.jndi.StubInitialContextFactory
- All Implemented Interfaces:
- javax.naming.spi.InitialContextFactory
public class StubInitialContextFactory
- extends java.lang.Object
- implements javax.naming.spi.InitialContextFactory
Test initial context factory used for testing software in a Java SE
environnment that uses JNDI to retrieve objects.
See #bind(String, Object) to resp. register the initial context.
To bind objects in the JNDI tree simply use the standard JNDI api:
InitialContext context = new InitialContext();
MyClass myObj = ...;
context.bind("a/b", myObj);
|
Method Summary |
javax.naming.Context |
getInitialContext(java.util.Hashtable<?,?> aEnvironment)
|
static void |
register()
This method must be called to register this initial context factory as
the default implementation for JNDI. |
static void |
unregister()
Unregisters the initial context factory |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
StubInitialContextFactory
public StubInitialContextFactory()
register
public static void register()
- This method must be called to register this initial context factory as
the default implementation for JNDI.
- Throws:
java.lang.Exception
unregister
public static void unregister()
- Unregisters the initial context factory
getInitialContext
public javax.naming.Context getInitialContext(java.util.Hashtable<?,?> aEnvironment)
throws javax.naming.NamingException
- Specified by:
getInitialContext in interface javax.naming.spi.InitialContextFactory
- Throws:
javax.naming.NamingException
Copyright © 2010. All Rights Reserved.