KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > cache > transaction > DummyContextFactory


1 package org.jboss.cache.transaction;
2
3 import javax.naming.Context JavaDoc;
4 import javax.naming.NamingException JavaDoc;
5 import javax.naming.spi.InitialContextFactory JavaDoc;
6 import java.util.Hashtable JavaDoc;
7
8 /**
9  * @author bela
10  * Date: May 15, 2003
11  * Time: 6:22:02 PM
12  */

13 public class DummyContextFactory implements InitialContextFactory JavaDoc {
14
15    static Context JavaDoc instance=null;
16
17    public DummyContextFactory() {
18       ;
19    }
20
21    /**
22     * Creates an Initial Context for beginning name resolution.
23     * Special requirements of this context are supplied
24     * using <code>environment</code>.
25     * <p/>
26     * The environment parameter is owned by the caller.
27     * The implementation will not modify the object or keep a reference
28     * to it, although it may keep a reference to a clone or copy.
29     *
30     * @param environment The possibly null environment
31     * specifying information to be used in the creation
32     * of the initial context.
33     * @return A non-null initial context object that implements the Context
34     * interface.
35     * @throws NamingException If cannot create an initial context.
36     */

37    public Context JavaDoc getInitialContext(Hashtable JavaDoc environment) throws NamingException JavaDoc {
38       if(instance == null)
39          instance=new DummyContext();
40       return instance;
41    }
42 }
43
Popular Tags