code: public InitialContext getInitialContext() throws ControlException {
          if (_initialContext != null) {
              return _initialContext;
          }
          Properties props = (Properties) _context.getControlPropertySet(Properties.class);
          String url = nullIfEmpty(props.url());
          String factory = nullIfEmpty(props.factory());
          if (url == null && factory == null) {
              try {
                  return new InitialContext();
              }
              catch (NamingException e) {
                  throw new ControlException("Cannot get default JNDI initial context", e);
              }
  
          }
          if (url == null || factory == null) {
              throw new ControlException("Both the provider-url and jndi factory need to be provided");
  
          }
          Hashtable<String, String> env = new Hashtable<String, String>();
          env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, factory);
          env.put(javax.naming.Context.PROVIDER_URL, url);
  
          String username = nullIfEmpty(props.jndiSecurityPrincipal());
          if (username != null)
              env.put(javax.naming.Context.SECURITY_PRINCIPAL, username);
  
          String password = nullIfEmpty(props.jndiSecurityCredentials());
          if (password != null)
              env.put(javax.naming.Context.SECURITY_CREDENTIALS, password);
  
          try {
              return _initialContext = new InitialContext(env);
          }
          catch (NamingException e) {
              throw new ControlException("Cannot get JNDI initial context at provider '" + url + "' with factory '" + factory + "'", e);
          }
      }
docs: Get the initial context.
  
  @return the initial context.