/** * init the Carol configuration, * A server can call this static method * for instantiate the carol communication layer */ public static void init(LoggerFactory lf) throws RMIConfigurationException { // init Trace TraceCarol.configure(lf); new CarolConfiguration(); }
/** * Get a RMI environment with his architecture name * @return RMIConfiguration the environment, null if not existe */ public static RMIConfiguration getRMIConfiguration(String name) throws RMIConfigurationException { if (configurationLoaded) { return (RMIConfiguration) rmiConfigurationTable.get(name); } else { loadCarolConfiguration(); return (RMIConfiguration) rmiConfigurationTable.get(name); } }
defaultsProps = getDefaultsProperties(); carolProps = getCarolProperties(); jndiProps = getJndiProperties(); boolean cc = checkCarolConfiguration(); if (jndiProps != null) jndiProps = jndi2Carol(jndiProps);
icHashtable = new Hashtable(); Hashtable allRMIConfiguration = CarolConfiguration.getAllRMIConfiguration(); int nbProtocol = allRMIConfiguration.size(); for (Enumeration e = allRMIConfiguration.elements() ; e.hasMoreElements() ;) { icHashtable.put(rmiName, currentConf.getJndiProperties()); defaultRMI = CarolConfiguration.getDefaultProtocol().getName();
/** * Add interceptors facility for protocols * @param String protocol name * @param String Interceptor Intializer class name */ public static void addInterceptors(String protocolName, String interceptorInitializer) throws RMIConfigurationException { RMIConfiguration rc = getRMIConfiguration(protocolName); if (rc!=null) { String pref=rc.getInterceptorPrefix(); if (pref!=null) { System.setProperty(pref+"."+interceptorInitializer,""); if (TraceCarol.isDebugCarol()) { TraceCarol.debugCarol("Add Initializer for " + protocolName + ": " +pref+"."+interceptorInitializer); } } } }
/** * private constructor for unicicity */ private NameServiceManager() { if (TraceCarol.isDebugJndiCarol()) { TraceCarol.debugJndiCarol("NameServiceManager.NameServiceManager()"); } try { nsTable = new Hashtable(); //get rmi configuration hashtable Hashtable allRMIConfiguration = CarolConfiguration.getAllRMIConfiguration(); int nbProtocol = allRMIConfiguration.size(); for (Enumeration e = allRMIConfiguration.elements() ; e.hasMoreElements() ;) { RMIConfiguration currentConf = (RMIConfiguration)e.nextElement(); String rmiName = currentConf.getName(); NameService nsC = (NameService)Class.forName(currentConf.getNameService()).newInstance(); nsC.setPort(currentConf.getPort()); // get the Name Service nsTable.put(rmiName, nsC); } } catch (Exception e) { String msg = "NameServiceManager.NameServiceManager() fail"; TraceCarol.error(msg,e); } }
/** * Constructor * Read the communication context */ public CarolConfiguration() throws RMIConfigurationException { if (!configurationLoaded) { loadCarolConfiguration(); } }
/** * Get all RMI environment * @return Hashtable the rmi configuration hashtable */ public static Hashtable getAllRMIConfiguration() throws RMIConfigurationException { if (configurationLoaded) { return rmiConfigurationTable; } else { loadCarolConfiguration(); return rmiConfigurationTable; } } /**