1 23 24 package com.rift.coad.lib.naming.cos; 26 27 import java.util.Hashtable ; 29 30 import com.rift.coad.lib.naming.NamingContextManager; 32 import com.rift.coad.lib.naming.NamingException; 33 import com.rift.coad.lib.naming.OrbManager; 34 import com.rift.coad.lib.thread.CoadunationThreadGroup; 35 36 41 public class CosNamingContextManager implements NamingContextManager { 42 43 private static CosNamingContextManager singleton = null; 47 48 private MasterContext masterContext = null; 50 51 60 public CosNamingContextManager(CoadunationThreadGroup threadGroup, 61 OrbManager orbManager, String instanceId) throws 62 CosNamingException { 63 try { 64 singleton = this; 65 masterContext = new MasterContext(new Hashtable (),threadGroup, 66 orbManager,instanceId); 67 } catch (Exception ex) { 68 throw new CosNamingException("Failed to instanicate the cos naming " + 69 "context manager : " + ex.getMessage()); 70 } 71 } 72 73 74 80 public static CosNamingContextManager getInstance() throws 81 CosNamingException { 82 if (singleton == null) { 83 throw new CosNamingException("The COS naming context manager has " + 84 "not been initialized."); 85 } 86 return singleton; 87 } 88 89 90 96 public String getInitialContextFactory() { 97 return "com.rift.coad.lib.naming.cos.URLInitialContextFactory"; 98 } 99 100 101 107 public String getURLContextFactory() { 108 return "com.rift.coad.lib.naming.cos.javaURLContextFactory"; 109 } 110 111 116 public void initContext() throws NamingException { 117 masterContext.initContext(); 118 } 119 120 121 124 public void releaseContext() { 125 masterContext.releaseContext(); 126 } 127 128 129 132 public void shutdown() { 133 masterContext.terminate(); 134 } 135 136 137 140 public MasterContext getMasterContext() { 141 return masterContext; 142 } 143 } 144 | Popular Tags |