From: Francisco R. <rev...@us...> - 2002-04-25 23:08:46
|
User: reverbel Date: 02/04/25 16:08:43 Modified: iiop/src/main/org/jboss/iiop CorbaORBService.java CorbaORBServiceMBean.java Log: Changes to make it easy plugging in other ORBs: - Attribute ORBPropertiesFileName added to CorbaORBServiceMBean. - MBean attributes IIOPServerName and IIOPPort removed, as there is no portable way to pass them to the ORB. An ORB-specific configuration file should be used for this purpose. - JacORB-specific configuration moved to jacorb.properties. Revision Changes Path 1.15 +21 -41 contrib/iiop/src/main/org/jboss/iiop/CorbaORBService.java Index: CorbaORBService.java =================================================================== RCS file: /cvsroot/jboss/contrib/iiop/src/main/org/jboss/iiop/CorbaORBService.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- CorbaORBService.java 23 Apr 2002 23:50:50 -0000 1.14 +++ CorbaORBService.java 25 Apr 2002 23:08:43 -0000 1.15 @@ -7,6 +7,7 @@ package org.jboss.iiop; +import java.io.InputStream; import java.util.Properties; import java.util.Hashtable; @@ -45,7 +46,7 @@ * for JBoss to use. * * @author <a href="mailto:os...@sp...">Ole Husgaard</a> - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ */ public class CorbaORBService extends ServiceMBeanSupport @@ -65,10 +66,8 @@ private String orbClass = null; private String orbSingletonClass = null; private String orbSingletonDelegate = null; - private String iiopServerName = "JBoss"; - private int iiopPort = 0; + private String orbPropertiesFileName = "orb-properties-file-not-defined"; private String portableInterceptorInitializerClass = null; - private int verbosity = 0; // Static -------------------------------------------------------- @@ -98,8 +97,15 @@ protected void startService() throws Exception { - // Initialize the ORB + Properties props = new Properties(); + + // Read orb properties file into props + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + InputStream is = cl.getResourceAsStream(orbPropertiesFileName); + props.load(is); + + // Initialize the ORB Properties systemProps = System.getProperties(); if (orbClass != null) { props.put("org.omg.CORBA.ORBClass", orbClass); @@ -112,21 +118,15 @@ if (orbSingletonDelegate != null) systemProps.put(org.jboss.system.ORBSingleton.DELEGATE_CLASS_KEY, orbSingletonDelegate); - systemProps.put("jacorb.verbosity", Integer.toString(verbosity)); + String jacorbVerbosity = props.getProperty("jacorb.verbosity"); + // JacORB-specific hack: we add jacorb.verbosity to the system properties + // just to avoid the warning "jacorb.properties not found". + if (jacorbVerbosity != null) + systemProps.put("jacorb.verbosity", jacorbVerbosity); System.setProperties(systemProps); - if (iiopPort != 0) - props.put("OAPort", Integer.toString(iiopPort)); if (portableInterceptorInitializerClass != null) props.put("org.omg.PortableInterceptor.ORBInitializerClass." + portableInterceptorInitializerClass, ""); - // JacORB-specific stuff - props.put("jacorb.implname", iiopServerName); - props.put("jacorb.hashtable_class", "org.jacorb.util.WeakHashtable"); - props.put("jacorb.poa.thread_pool_min","4"); - props.put("jacorb.poa.thread_pool_max","4"); - props.put("org.omg.PortableInterceptor.ORBInitializerClass.standard_init", - "org.jacorb.orb.standardInterceptors.IORInterceptorInitializer"); - props.put("jacorb.orb.print_version", ((verbosity == 0) ? "off" : "on")); orb = ORB.init(new String[0], props); bind(ORB_NAME, "org.omg.CORBA.ORB"); @@ -279,26 +279,16 @@ this.orbSingletonDelegate = orbSingletonDelegate; } - public void setIIOPServerName(String iiopServerName) + public void setORBPropertiesFileName(String orbPropertiesFileName) { - this.iiopServerName = iiopServerName; + this.orbPropertiesFileName = orbPropertiesFileName; } - - public String getIIOPServerName() - { - return iiopServerName; - } - - public void setIIOPPort(int iiopPort) + + public String getORBPropertiesFileName() { - this.iiopPort = iiopPort; + return orbPropertiesFileName; } - public int getIIOPPort() - { - return iiopPort; - } - public String getPortableInterceptorInitializerClass() { return portableInterceptorInitializerClass; @@ -309,16 +299,6 @@ { this.portableInterceptorInitializerClass = portableInterceptorInitializerClass; - } - - public void setVerbosity(int verbosity) - { - this.verbosity = verbosity; - } - - public int getVerbosity() - { - return verbosity; } // ObjectFactory implementation ---------------------------------- 1.10 +3 -9 contrib/iiop/src/main/org/jboss/iiop/CorbaORBServiceMBean.java Index: CorbaORBServiceMBean.java =================================================================== RCS file: /cvsroot/jboss/contrib/iiop/src/main/org/jboss/iiop/CorbaORBServiceMBean.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- CorbaORBServiceMBean.java 23 Apr 2002 23:50:50 -0000 1.9 +++ CorbaORBServiceMBean.java 25 Apr 2002 23:08:43 -0000 1.10 @@ -16,7 +16,7 @@ * * @author <a href="mailto:os...@sp...">Ole Husgaard</a> * @author <a href="mailto:rev...@im...">Francisco Reverbel</a> - * @version $Revision: 1.9 $ + * @version $Revision: 1.10 $ */ public interface CorbaORBServiceMBean extends org.jboss.system.ServiceMBean @@ -35,18 +35,12 @@ public String getORBSingletonDelegate(); public void setORBSingletonDelegate(String orbSingletonDelegate); - public void setIIOPServerName(String iiopServerName); - public String getIIOPServerName(); - - public void setIIOPPort(int iiopPort); - public int getIIOPPort(); + public void setORBPropertiesFileName(String orbPropertiesFileName); + public String getORBPropertiesFileName(); public String getPortableInterceptorInitializerClass(); public void setPortableInterceptorInitializerClass( String portableInterceptorInitializerClass); - - public void setVerbosity(int verbosity); - public int getVerbosity(); } |