Class InitialContextFactory


  • public class InitialContextFactory
    extends Object
    InitialContextFactory is responsible for getting an instance of the initial context.
    • Constructor Detail

      • InitialContextFactory

        public InitialContextFactory()
    • Method Detail

      • getContext

        public static Context getContext​(boolean useProps,
                                         String initialContextFactory,
                                         String providerUrl,
                                         boolean useAuth,
                                         String securityPrincipal,
                                         String securityCredentials)
                                  throws NamingException
        Initialize the JNDI initial context
        Parameters:
        useProps - if true, create a new InitialContext; otherwise use the other parameters to call lookupContext(String, String, boolean, String, String)
        initialContextFactory - name of the initial context factory (ignored if useProps is true)
        providerUrl - url of the provider to use (ignored if useProps is true)
        useAuth - true if auth should be used, false otherwise (ignored if useProps is true)
        securityPrincipal - name of the principal to (ignored if useProps is true)
        securityCredentials - credentials for the principal (ignored if useProps is true)
        Returns:
        the context, never null
        Throws:
        NamingException - when creation of the context fails
      • close

        public static void close()
        clear all the InitialContext objects.