package WEB-INF.classes.wenrgise.ejb.common.utility;

import java.util.Hashtable;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class myContextProvider {
  private Context ctx = null;
  
  public static InitialContext localContext;
  
  static {
    try {
      localContext = new InitialContext();
    } catch (NamingException oNx) {
      oNx.printStackTrace();
    } 
  }
  
  private static wenrgise.ejb.common.utility.myContextProvider objContextProvider = new wenrgise.ejb.common.utility.myContextProvider();
  
  private myContextProvider() {
    try {
      Hashtable env = new Hashtable();
      System.out.println("Test for ContextProvider -->");
      env.put("java.naming.factory.initial", "weblogic.jndi.WLInitialContextFactory");
      env.put("java.naming.provider.url", "t3://weblogicServer:7001");
      env.put("java.naming.security.principal", "weblogic");
      env.put("java.naming.security.credentials", "weblogic");
      this.ctx = new InitialContext();
    } catch (Throwable e) {
      e.printStackTrace();
    } 
  }
  
  public static Context getContext() {
    return objContextProvider.ctx;
  }
  
  public static InitialContext getLocalContext() {
    return localContext;
  }
}
