FileDocCategorySizeDatePackage
InitialContextFactory.javaAPI DocJBoss 4.2.12581Fri Jul 13 20:53:58 BST 2007org.jboss.ejb3

InitialContextFactory

public class InitialContextFactory extends Object
version
$Revision: 60233 $
author
William DeCoste

Fields Summary
private static Properties
props
private static Properties
securityProperties
Constructors Summary
Methods Summary
public static javax.naming.InitialContextgetInitialContext()

   
        
   
      InitialContext jndiContext;
      
      if (props == null)
         jndiContext = new InitialContext();
      else
      {
         if (securityProperties != null)
         {
            Properties combinedProps = new Properties();
            combinedProps.putAll(props);
            combinedProps.putAll(securityProperties);
            jndiContext = new InitialContext(combinedProps);
         }
         else
            jndiContext = new InitialContext(props);
      }
      
      return jndiContext;
   
public static voidsetProperties(java.util.Properties properties)

      props = properties;
   
public static voidsetSecurity(java.lang.String user, java.lang.String password)

      if (props != null)
      {
         securityProperties = new Properties();
         securityProperties.put(Context.SECURITY_PRINCIPAL, user);
         securityProperties.put(Context.SECURITY_CREDENTIALS, password);
         securityProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.JndiLoginInitialContextFactory");
      }