KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > ca > jndiproviders > dsml > DsmlCtxFactory


1 package com.ca.jndiproviders.dsml;
2
3 import javax.naming.spi.InitialContextFactory JavaDoc;
4 import javax.naming.Context JavaDoc;
5 import javax.naming.NamingException JavaDoc;
6 import java.util.Hashtable JavaDoc;
7 import java.util.logging.*;
8
9 /**
10  * This code lovingly written by Chris.
11  */

12 public class DsmlCtxFactory implements InitialContextFactory JavaDoc
13 {
14
15     private static Logger log = Logger.getLogger(DsmlContext.class.getName());
16 // private static Logger log = Logger.getLogger("com.ca.jndiproviders.dsml");
17

18     /*// Debug
19     {
20         log.setLevel(Level.FINE);
21         ConsoleHandler ch = new ConsoleHandler();
22         ch.setLevel(Level.FINEST);
23         log.addHandler(ch);
24         log.info("com.ca.jndiproviders.dsml log setup");
25     }
26     */

27     
28     /**
29      * Creates an Initial Context for beginning name resolution.
30      * Special requirements of this context are supplied
31      * using <code>environment</code>.
32      * <p/>
33      * The environment parameter is owned by the caller.
34      * The implementation will not modify the object or keep a reference
35      * to it, although it may keep a reference to a clone or copy.
36      *
37      * @param environment The possibly null environment
38      * specifying information to be used in the creation
39      * of the initial context.
40      * @return A non-null initial context object that implements the Context
41      * interface.
42      * @throws javax.naming.NamingException If cannot create an initial context.
43      */

44     public Context JavaDoc getInitialContext(Hashtable JavaDoc environment) throws NamingException JavaDoc
45     {
46         log.fine("CREATING NEW CA DSML CONTEXT...");
47
48         // sort out any pre creation setup (e.g. setting up SOAP connection etc?)
49

50         DsmlContext newContext = new DsmlContext((Hashtable JavaDoc)environment.clone());
51
52         log.fine( "...CREATED NEW CA DSML CONTEXT");
53
54         return newContext;
55     }
56 }
57
Popular Tags