01: /*
02: * JFox - The most lightweight Java EE Application Server!
03: * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn.
04: *
05: * JFox is licenced and re-distributable under GNU LGPL.
06: */
07: package org.jfox.ejb3.naming;
08:
09: import java.util.Hashtable;
10: import javax.naming.Context;
11: import javax.naming.Name;
12: import javax.naming.NamingException;
13: import javax.naming.spi.InitialContextFactory;
14: import javax.naming.spi.ObjectFactory;
15:
16: /**
17: * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
18: */
19: public class InitialContextFactoryImpl implements
20: InitialContextFactory, ObjectFactory {
21:
22: private static Context context = null;
23:
24: //由 SimpleEJB3Container.postPropertiesSet 调用
25: public static void setInitialContext(Context ctx) {
26: context = ctx;
27: }
28:
29: public Context getInitialContext(Hashtable<?, ?> env)
30: throws NamingException {
31: if (context == null) {
32: throw new NamingException("Naming Service not initialzed.");
33: }
34: return context;
35: }
36:
37: public Object getObjectInstance(Object obj, Name name, Context ctx,
38: Hashtable environment) throws Exception {
39: // will perform after urlContextFactory failed and if set Context.OBJECT_FACTORY
40: throw new UnsupportedOperationException("getObjectInstance");
41: }
42:
43: public static void main(String[] args) {
44:
45: }
46: }
|