programming-examples/java/Servlets_Session_Swing_Util/JndiUtil.java

25 lines
526 B
Java
Raw Normal View History

2019-11-15 12:59:38 +01:00
JndiUtil
package com.ack.util;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
public class JndiUtil {
private static Context ctx;
public static void init( Context theContext ) throws NamingException {
if( ( JndiUtil.ctx = theContext ) == null ) {
JndiUtil.ctx = new InitialContext();
}
}
public static Object getJndiEntry( String jndiEntry )
throws NamingException {
return ctx.lookup( jndiEntry );
}
}