Class InitialContextFactory
- java.lang.Object
-
- org.apache.jmeter.protocol.jms.client.InitialContextFactory
-
public class InitialContextFactory extends Object
InitialContextFactory is responsible for getting an instance of the initial context.
-
-
Constructor Summary
Constructors Constructor Description InitialContextFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidclose()clear all the InitialContext objects.static ContextgetContext(boolean useProps, String initialContextFactory, String providerUrl, boolean useAuth, String securityPrincipal, String securityCredentials)Initialize the JNDI initial contextstatic ContextlookupContext(String initialContextFactory, String providerUrl, boolean useAuth, String securityPrincipal, String securityCredentials)Look up the context from the local cache, creating it if necessary.
-
-
-
Method Detail
-
lookupContext
public static Context lookupContext(String initialContextFactory, String providerUrl, boolean useAuth, String securityPrincipal, String securityCredentials) throws NamingException
Look up the context from the local cache, creating it if necessary.- Parameters:
initialContextFactory- used to set the propertyContext.INITIAL_CONTEXT_FACTORYproviderUrl- used to set the propertyContext.PROVIDER_URLuseAuth- settrueif security is to be used.securityPrincipal- used to set the propertyContext.SECURITY_PRINCIPALsecurityCredentials- used to set the propertyContext.SECURITY_CREDENTIALS- Returns:
- the context, never
null - Throws:
NamingException- when creation of the context fails
-
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 calllookupContext(String, String, boolean, String, String)initialContextFactory- name of the initial context factory (ignored ifusePropsistrue)providerUrl- url of the provider to use (ignored ifusePropsistrue)useAuth-trueif auth should be used,falseotherwise (ignored ifusePropsistrue)securityPrincipal- name of the principal to (ignored ifusePropsistrue)securityCredentials- credentials for the principal (ignored ifusePropsistrue)- Returns:
- the context, never
null - Throws:
NamingException- when creation of the context fails
-
close
public static void close()
clear all the InitialContext objects.
-
-