[jboss-svn-commits] JBL Code SVN: r36841 - in labs/jbosstm/trunk: ArjunaJTS/orbportability/classes/com/arjuna/orbportability and 4 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Mar 17 12:44:00 EDT 2011


Author: jhalliday
Date: 2011-03-17 12:43:59 -0400 (Thu, 17 Mar 2011)
New Revision: 36841

Modified:
   labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBeanMBean.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/logging/orbportabilityI18NLogger.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java
   labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java
Log:
Classloading changes. JBTM-828


Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/common/ClassloadingUtility.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -65,19 +65,15 @@
     }
 
     /**
-     * Load, instantiate and return an instance of the named class, which is expected to be an implementation of
-     * the specified interface.
+     * Load and return the named class, which is expected to be an implementation of the specified interface.
      *
-     * In the event of error (ClassNotFound, ClassCast, can't instantiate, ...) this method will log the error and return null.
+     * In the event of error (ClassNotFound, ClassCast, ...) this method will log the error and return null.
      *
-     *
      * @param iface the expected interface type.
      * @param className the name of the class to load and instantiate.
-     * @param environmentBeanInstanceName When the class ctor requires a *EnvironmentBean instance, the name of the bean.
-     *   null for default ctor or default bean instance..
-     * @return an instance of the specified class, or null.
+     * @return the specified class, or null.
      */
-    public static <T> T loadAndInstantiateClass(Class<T> iface, String className, String environmentBeanInstanceName)
+    public static <T> Class<? extends T> loadClass(Class<T> iface, String className)
     {
         if (tsLogger.logger.isTraceEnabled()) {
             tsLogger.logger.trace("Loading class " + className);
@@ -93,10 +89,37 @@
             return null;
         }
 
+        try {
+            Class<? extends T> clazz2 = clazz.asSubclass(iface);
+            return clazz2;
+        } catch (ClassCastException e) {
+            tsLogger.i18NLogger.warn_common_ClassloadingUtility_3(className, iface.getName(), e);
+            return null;
+        }
+    }
+
+    /**
+     * Load, instantiate and return an instance of the named class, which is expected to be an implementation of
+     * the specified interface.
+     *
+     * In the event of error (ClassNotFound, ClassCast, can't instantiate, ...) this method will log the error and return null.
+     *
+     *
+     * @param iface the expected interface type.
+     * @param className the name of the class to load and instantiate.
+     * @param environmentBeanInstanceName When the class ctor requires a *EnvironmentBean instance, the name of the bean.
+     *   null for default ctor or default bean instance..
+     * @return an instance of the specified class, or null.
+     */
+    public static <T> T loadAndInstantiateClass(Class<T> iface, String className, String environmentBeanInstanceName)
+    {
         T instance = null;
 
         try {
-            Class<? extends T> clazz2 = clazz.asSubclass(iface);
+            Class<? extends T> clazz = loadClass(iface, className);
+            if(clazz == null) {
+                return null;
+            }
 
             Constructor[] ctors = clazz.getConstructors();
             Class environmentBeanClass = null;
@@ -111,11 +134,9 @@
             }
             if(environmentBeanClass == null && environmentBeanInstanceName == null) {
                 // no bean ctor, try default ctor
-                instance = (T)clazz2.newInstance();
+                instance = clazz.newInstance();
             }
 
-        } catch (ClassCastException e) {
-            tsLogger.i18NLogger.warn_common_ClassloadingUtility_3(className, iface.getName(), e);
         } catch (InstantiationException e) {
             tsLogger.i18NLogger.warn_common_ClassloadingUtility_4(className, e);
         } catch (IllegalAccessException e) {

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/ORBInfo.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -31,11 +31,10 @@
 
 package com.arjuna.orbportability;
 
+import com.arjuna.orbportability.common.opPropertyManager;
 import com.arjuna.orbportability.logging.opLogger;
 import com.arjuna.orbportability.internal.utils.SimpleXMLParser;
 
-import java.text.MessageFormat;
-
 /**
  * This class queries the ORB specific ORBData object for information
  * about the ORB.
@@ -148,57 +147,19 @@
         return minorVersion;
     }
 
-    public static final ORBData orbData ()
-    {
-	return _theData;
-    }
-
     private static ORBData          _theData = null;
     private static SimpleXMLParser  _xml = null;
 
-    private static final String _versionPackage = "com.arjuna.orbportability.internal.orbspecific.versions";
-
     static
     {
-        String className = null;
-
-        try
-        {
-            Thread.currentThread().getContextClassLoader().loadClass("org.jacorb.orb.ORB");
-
-            className = _versionPackage+".jacorb_2_0";
-        }
-        catch (ClassNotFoundException je)
-        {
-            try
-            {
-                Thread.currentThread().getContextClassLoader().loadClass("com.sun.corba.se.internal.Interceptors.PIORB");
-
-                className = _versionPackage+".javaidl_1_4";
-            }
-            catch (ClassNotFoundException joe)
-            {
-                opLogger.i18NLogger.fatal_ORBInfo_unsupportedorb(joe);
-
-                throw new ExceptionInInitializerError( joe );
-            }
-        }
-
-        try
-        {
-            Class c = Thread.currentThread().getContextClassLoader().loadClass(className);
-
-            _theData = (ORBData) c.newInstance();
-
+        try {
+            _theData = opPropertyManager.getOrbPortabilityEnvironmentBean().getOrbData();
             _xml = new SimpleXMLParser(_theData.getORBdata() );
         }
         catch (Exception e)
         {
-
             opLogger.i18NLogger.fatal_ORBInfo_creationfailed(e);
-
             throw new ExceptionInInitializerError( e );
         }
     }
-
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBean.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -23,7 +23,10 @@
 import com.arjuna.ats.internal.arjuna.common.ClassloadingUtility;
 import com.arjuna.common.internal.util.propertyservice.PropertyPrefix;
 import com.arjuna.common.internal.util.propertyservice.ConcatenationPrefix;
+import com.arjuna.orbportability.ORBData;
 import com.arjuna.orbportability.event.EventHandler;
+import com.arjuna.orbportability.oa.core.POAImple;
+import com.arjuna.orbportability.orb.core.ORBImple;
 
 import java.util.*;
 
@@ -44,8 +47,18 @@
     private volatile List<String> eventHandlerClassNames = new ArrayList<String>();
     private volatile List<EventHandler> eventHandlers = null;
 
-    private volatile String orbImplementation = null;
-    private volatile String oaImplementation = null;
+    // alternative: com.arjuna.orbportability.internal.orbspecific.javaidl.orb.implementations.javaidl_1_4
+    private volatile String orbImpleClassName = "com.arjuna.orbportability.internal.orbspecific.jacorb.orb.implementations.jacorb_2_0";
+    private volatile Class<? extends ORBImple> orbImpleClass = null;
+
+    // alternative: com.arjuna.orbportability.internal.orbspecific.javaidl.oa.implementations.javaidl_1_4
+    private volatile String poaImpleClassName = "com.arjuna.orbportability.internal.orbspecific.jacorb.oa.implementations.jacorb_2_0";
+    private volatile Class<? extends POAImple> poaImpleClass = null;
+
+    // alternative: com.arjuna.orbportability.internal.orbspecific.versions.javaidl_1_4
+    private volatile String orbDataClassName = "com.arjuna.orbportability.internal.orbspecific.versions.jacorb_2_0";
+    private volatile ORBData orbData = null;
+
     private volatile String bindMechanism = "CONFIGURATION_FILE";
 
     private volatile Map<String,String> orbInitializationProperties = new HashMap<String, String>();
@@ -230,52 +243,248 @@
     }
 
     /**
-     * Returns the classname of the ORBImple implementation.
+     * Returns the class name of the ORBImple implementation.
      *
-     * Default: null (i.e. use classpath based selection)
+     * Default: com.arjuna.orbportability.internal.orbspecific.jacorb.orb.implementations.jacorb_2_0
      * Equivalent deprecated property: com.arjuna.orbportability.orbImplementation
      *
      * @return the name of the class implementing ORBImple.
      */
-    public String getOrbImplementation()
+    public String getOrbImpleClassName()
     {
-        return orbImplementation;
+        return orbImpleClassName;
     }
 
     /**
-     * Sets the classname of the ORBImple implementation.
+     * Sets the class name of the ORBImple implementation. The class should have a public default constructor.
      *
-     * @param orbImplementation the name of the class implementing ORBImple.
+     * @param orbImpleClassName the name of the class implementing ORBImple.
      */
-    public void setOrbImplementation(String orbImplementation)
+    public void setOrbImpleClassName(String orbImpleClassName)
     {
-        this.orbImplementation = orbImplementation;
+        synchronized(this)
+        {
+            if(orbImpleClassName == null)
+            {
+                this.orbImpleClass = null;
+            }
+            else if(!orbImpleClassName.equals(this.orbImpleClassName))
+            {
+                this.orbImpleClass = null;
+            }
+            this.orbImpleClassName = orbImpleClassName;
+        }
     }
 
     /**
-     * Returns the classname of the POAImple implementation.
+     * Returns a class implementing ORBImple.
      *
-     * Default: null (i.e. user classpath based selection)
+     * If classloading fails,
+     * this method will log an appropriate warning and return null, not throw an exception.
+     *
+     * @return an ORBImple implementation instance, or null.
+     */
+    public Class<? extends ORBImple> getOrbImpleClass()
+    {
+        if(orbImpleClass == null && orbImpleClassName != null)
+        {
+            synchronized(this) {
+                if(orbImpleClass == null && orbImpleClassName != null) {
+                    Class<? extends ORBImple> clazz = ClassloadingUtility.loadClass(ORBImple.class, orbImpleClassName);
+                    orbImpleClass = clazz;
+                }
+            }
+        }
+
+        return orbImpleClass;
+    }
+
+    /**
+     * Sets the ORBImple implementation class. The class should have a public default constructor.
+     *
+     * @param orbImpleClass a Class that implements ORBImple
+     */
+    public void setOrbImpleClass(Class<? extends ORBImple> orbImpleClass)
+    {
+        synchronized(this)
+        {
+            Class<? extends ORBImple> oldClass = this.orbImpleClass;
+            this.orbImpleClass = orbImpleClass;
+
+            if(orbImpleClass == null)
+            {
+                this.orbImpleClassName = null;
+            }
+            else if(orbImpleClass != oldClass)
+            {
+                String name = orbImpleClass.getName();
+                this.orbImpleClassName = name;
+            }
+        }
+    }
+
+    /**
+     * Returns the class name of the POAImple implementation.
+     *
+     * Default: com.arjuna.orbportability.internal.orbspecific.jacorb.oa.implementations.jacorb_2_0
      * Equivalent deprecated property: com.arjuna.orbportability.oaImplementation
      *
      * @return the name of the class implementing POAImple.
      */
-    public String getOaImplementation()
+    public String getPoaImpleClassName()
     {
-        return oaImplementation;
+        return poaImpleClassName;
     }
 
     /**
-     * Sets the classname of the POAImple implementation.
+     * Sets the class name of the POAImple implementation. The class should have a public default constructor.
      *
-     * @param oaImplementation the name of the class implementing POAImple.
+     * @param poaImpleClassName the name of the class implementing POAImple.
      */
-    public void setOaImplementation(String oaImplementation)
+    public void setPoaImpleClassName(String poaImpleClassName)
     {
-        this.oaImplementation = oaImplementation;
+        synchronized(this)
+        {
+            if(poaImpleClassName == null)
+            {
+                this.poaImpleClass = null;
+            }
+            else if(!poaImpleClassName.equals(this.poaImpleClassName))
+            {
+                this.poaImpleClass = null;
+            }
+            this.poaImpleClassName = poaImpleClassName;
+        }
     }
 
     /**
+     * Returns a class implementing POAImple.
+     *
+     * If classloading fails,
+     * this method will log an appropriate warning and return null, not throw an exception.
+     *
+     * @return an POAImple implementation instance, or null.
+     */
+    public Class<? extends POAImple> getPoaImpleClass()
+    {
+        if(poaImpleClass == null && poaImpleClassName != null)
+        {
+            synchronized(this) {
+                if(poaImpleClass == null && poaImpleClassName != null) {
+                    Class<? extends POAImple> clazz = ClassloadingUtility.loadClass(POAImple.class, poaImpleClassName);
+                    poaImpleClass = clazz;
+                }
+            }
+        }
+
+        return poaImpleClass;
+    }
+
+    /**
+     * Sets the POAImple implementation class. The class should have a public default constructor.
+     *
+     * @param poaImpleClass a Class that implements POAImple
+     */
+    public void setPoaImpleClass(Class<? extends POAImple> poaImpleClass)
+    {
+        synchronized(this)
+        {
+            Class<? extends POAImple> oldClass = this.poaImpleClass;
+            this.poaImpleClass = poaImpleClass;
+
+            if(poaImpleClass == null)
+            {
+                this.poaImpleClassName = null;
+            }
+            else if(poaImpleClass != oldClass)
+            {
+                String name = poaImpleClass.getName();
+                this.poaImpleClassName = name;
+            }
+        }
+    }
+
+    /**
+     * Returns the class name of the ORBData implementation.
+     *
+     * Default: com.arjuna.orbportability.internal.orbspecific.versions.jacorb_2_0
+     *
+     * @return the name of the class implementing ORBData.
+     */
+    public String getOrbDataClassName()
+    {
+        return orbDataClassName;
+    }
+
+    /**
+     * Sets the class name of the ORBData implementation. The class should have a public default constructor.
+     *
+     * @param orbDataClassName the name of the class implementing ORBData.
+     */
+    public void setOrbDataClassName(String orbDataClassName)
+    {
+        synchronized(this)
+        {
+            if(orbDataClassName == null)
+            {
+                this.orbData = null;
+            }
+            else if(!orbDataClassName.equals(this.orbDataClassName))
+            {
+                this.orbData = null;
+            }
+            this.orbDataClassName = orbDataClassName;
+        }
+    }
+
+    /**
+     * Returns an instance of a class implementing ORBData.
+     *
+     * If there is no pre-instantiated instance set and classloading or instantiation fails,
+     * this method will log an appropriate warning and return null, not throw an exception.
+     *
+     * @return an ORBData implementation instance, or null.
+     */
+    public ORBData getOrbData()
+    {
+        if(orbData == null && orbDataClassName != null)
+        {
+            synchronized(this) {
+                if(orbData == null && orbDataClassName != null) {
+                    ORBData instance = ClassloadingUtility.loadAndInstantiateClass(ORBData.class,  orbDataClassName, null);
+                    orbData = instance;
+                }
+            }
+        }
+
+        return orbData;
+    }
+
+    /**
+     * Sets the instance of ORBData
+     *
+     * @param instance an Object that implements ORBData, or null.
+     */
+    public void setOrbData(ORBData instance)
+    {
+        synchronized(this)
+        {
+            ORBData oldInstance = this.orbData;
+            orbData = instance;
+
+            if(instance == null)
+            {
+                this.orbDataClassName = null;
+            }
+            else if(instance != oldInstance)
+            {
+                String name = ClassloadingUtility.getNameForClass(instance);
+                this.orbDataClassName = name;
+            }
+        }
+    }
+
+    /**
      * Returns the symbolic name of the configuration mechanism used for service bindings.
      *
      * Default: "CONFIGURATION_FILE"

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBeanMBean.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBeanMBean.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/common/OrbPortabilityEnvironmentBeanMBean.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -40,10 +40,12 @@
 
     List<String> getEventHandlerClassNames();
 
-    String getOrbImplementation();
+    String getOrbImpleClassName();
 
-    String getOaImplementation();
+    String getPoaImpleClassName();
 
+    String getOrbDataClassName();
+
     String getBindMechanism();
 
     public Map<String, String> getOrbInitializationProperties();

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/logging/orbportabilityI18NLogger.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/logging/orbportabilityI18NLogger.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/logging/orbportabilityI18NLogger.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -79,9 +79,9 @@
 	@LogMessage(level = FATAL)
 	public void fatal_ORBInfo_creationfailed(@Cause() Throwable arg0);
 
-	@Message(id = 21011, value = "ORBInfo ORB specific class creation failed - unable to find supported ORB", format = MESSAGE_FORMAT)
-    @LogMessage(level = FATAL)
-	public void fatal_ORBInfo_unsupportedorb(@Cause() Throwable arg0);
+//	@Message(id = 21011, value = "ORBInfo ORB specific class creation failed - unable to find supported ORB", format = MESSAGE_FORMAT)
+//    @LogMessage(level = FATAL)
+//	public void fatal_ORBInfo_unsupportedorb(@Cause() Throwable arg0);
 
 //	@Message(id = 21012, value = "{0} - could not open config file: {1}", format = MESSAGE_FORMAT)
 //	@LogMessage(level = WARN)

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/oa/core/OA.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -57,12 +57,24 @@
 
 public class OA
 {
-
     public OA(com.arjuna.orbportability.orb.core.ORB theORB)
     {
-        initialise();
-
         _theORB = theORB;
+
+        try
+        {
+            Class<? extends POAImple> clazz = opPropertyManager.getOrbPortabilityEnvironmentBean().getPoaImpleClass();
+
+            if (opLogger.logger.isTraceEnabled()) {
+                opLogger.logger.trace("OA.initialise() - using OA Implementation " + clazz.getCanonicalName());
+            }
+
+            _theOA = clazz.newInstance();
+        }
+        catch (Exception e)
+        {
+            throw new ExceptionInInitializerError( e );
+        }
     }
 
     public boolean initialised ()
@@ -72,47 +84,47 @@
 
     public void init () throws InvalidName, AdapterInactive, SystemException
     {
-        ((POAImple) _theOA).init(_theORB);
+        _theOA.init(_theORB);
     }
 
     public void createPOA (String adapterName, Policy[] policies)
             throws AdapterAlreadyExists, InvalidPolicy, AdapterInactive,
             SystemException
     {
-        ((POAImple) _theOA).createPOA(adapterName, policies);
+        _theOA.createPOA(adapterName, policies);
     }
 
     public void destroyRootPOA () throws SystemException
     {
-        ((POAImple) _theOA).destroyRootPOA();
+        _theOA.destroyRootPOA();
     }
 
     public void destroyPOA (String adapterName) throws SystemException
     {
-        ((POAImple) _theOA).destroyPOA(adapterName);
+        _theOA.destroyPOA(adapterName);
     }
 
     public org.omg.PortableServer.POA rootPoa () throws SystemException
     {
-        return ((POAImple) _theOA).rootPoa();
+        return _theOA.rootPoa();
     }
 
     public void rootPoa (org.omg.PortableServer.POA thePOA)
             throws SystemException
     {
-        ((POAImple) _theOA).rootPoa(thePOA);
+        _theOA.rootPoa(thePOA);
     }
 
     public org.omg.PortableServer.POA poa (String adapterName)
             throws SystemException
     {
-        return ((POAImple) _theOA).poa(adapterName);
+        return _theOA.poa(adapterName);
     }
 
     public void poa (String adapterName, org.omg.PortableServer.POA thePOA)
             throws SystemException
     {
-        ((POAImple) _theOA).poa(adapterName, thePOA);
+        _theOA.poa(adapterName, thePOA);
     }
 
     public void run (String name) throws SystemException
@@ -125,57 +137,8 @@
         _theOA.run(_theORB);
     }
 
-    @SuppressWarnings("unchecked")
-    private final void initialise ()
-    {
-        String className = opPropertyManager.getOrbPortabilityEnvironmentBean()
-                .getOaImplementation();
+    private final com.arjuna.orbportability.orb.core.ORB _theORB;
 
-        if (className == null)
-        {
+    private final com.arjuna.orbportability.oa.core.POAImple _theOA;
 
-            try
-            {
-                Thread.currentThread().getContextClassLoader().loadClass(
-                        "org.jacorb.orb.ORB");
-
-                className = "com.arjuna.orbportability.internal.orbspecific.jacorb.oa.implementations.jacorb_2_0";
-            }
-            catch (ClassNotFoundException ce)
-            {
-                try
-                {
-                    Thread.currentThread().getContextClassLoader().loadClass(
-                            "com.sun.corba.se.internal.corba.ORB");
-
-                    className = "com.arjuna.orbportability.internal.orbspecific.javaidl.oa.implementations.javaidl_1_4";
-                }
-                catch (ClassNotFoundException je)
-                {
-                    throw new ExceptionInInitializerError(je);
-                }
-            }
-        }
-
-        if (opLogger.logger.isTraceEnabled()) {
-            opLogger.logger.trace("OA.initialise() - using OA Implementation " + className);
-        }
-
-        try
-        {
-            Class c = Thread.currentThread().getContextClassLoader().loadClass(
-                    className);
-
-            _theOA = (POAImple) c.newInstance();
-        }
-        catch (Exception e)
-        {
-            throw new ExceptionInInitializerError( e );
-        }
-    }
-
-    private com.arjuna.orbportability.orb.core.ORB _theORB;
-
-    private com.arjuna.orbportability.oa.core.POAImple _theOA;
-
 }

Modified: labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java
===================================================================
--- labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java	2011-03-17 14:13:17 UTC (rev 36840)
+++ labs/jbosstm/trunk/ArjunaJTS/orbportability/classes/com/arjuna/orbportability/orb/core/ORB.java	2011-03-17 16:43:59 UTC (rev 36841)
@@ -52,102 +52,64 @@
 
 public class ORB
 {
-
-public ORB ()
+    public ORB ()
     {
-	initialise();
-    }
+        try
+        {
+            Class<? extends ORBImple> clazz = opPropertyManager.getOrbPortabilityEnvironmentBean().getOrbImpleClass();
 
-public boolean initialised ()
-    {
-	return _theORB.initialised();
+            if (opLogger.logger.isTraceEnabled()) {
+                opLogger.logger.trace("ORB.initialise() - using ORB Implementation " + clazz.getCanonicalName());
+            }
+
+            _theORB = clazz.newInstance();
+        }
+        catch (Exception e)
+        {
+            throw new ExceptionInInitializerError( e );
+        }
     }
 
-public void init () throws SystemException
+    public boolean initialised ()
     {
-	_theORB.init();
+        return _theORB.initialised();
     }
 
-public void init (Applet a, Properties p) throws SystemException
+    public void init () throws SystemException
     {
-	_theORB.init(a, p);
+        _theORB.init();
     }
 
-public void init (String[] s, Properties p) throws SystemException
+    public void init (Applet a, Properties p) throws SystemException
     {
-	_theORB.init(s, p);
+        _theORB.init(a, p);
     }
 
-public void shutdown () throws SystemException
+    public void init (String[] s, Properties p) throws SystemException
     {
-	_theORB.shutdown();
+        _theORB.init(s, p);
     }
 
-public void destroy () throws SystemException
+    public void shutdown () throws SystemException
     {
-	_theORB.destroy();
+        _theORB.shutdown();
     }
 
-public org.omg.CORBA.ORB orb () throws SystemException
+    public void destroy () throws SystemException
     {
-	return _theORB.orb();
+        _theORB.destroy();
     }
 
-public void orb (org.omg.CORBA.ORB o) throws SystemException
+    public org.omg.CORBA.ORB orb () throws SystemException
     {
-	_theORB.orb(o);
+        return _theORB.orb();
     }
 
-private final void initialise ()
+    public void orb (org.omg.CORBA.ORB o) throws SystemException
     {
-	/*
-	 * Let the application provide its own ORB implementation.
-	 */
-
-	String className = opPropertyManager.getOrbPortabilityEnvironmentBean().getOrbImplementation();
-
-        if (className == null)
-        {
-            try
-            {
-                Thread.currentThread().getContextClassLoader().loadClass("org.jacorb.orb.ORB");
-
-                className = "com.arjuna.orbportability.internal.orbspecific.jacorb.orb.implementations.jacorb_2_0";
-            }
-            catch (ClassNotFoundException ce)
-            {
-                //			ce.printStackTrace();
-
-                try
-                {
-                    Thread.currentThread().getContextClassLoader().loadClass("com.sun.corba.se.internal.corba.ORB");
-
-                    className = "com.arjuna.orbportability.internal.orbspecific.javaidl.orb.implementations.javaidl_1_4";
-                }
-                catch (ClassNotFoundException je)
-                {
-                    throw new ExceptionInInitializerError(je);
-                }
-            }
-        }
-
-        if (opLogger.logger.isTraceEnabled()) {
-            opLogger.logger.trace("ORB.initialise() - using ORB Implementation " + className);
-        }
-
-	try
-	{
-	    Class c = Thread.currentThread().getContextClassLoader().loadClass(className);
-
-	    _theORB = (ORBImple) c.newInstance();
-	}
-	catch (Exception e)
-	{
-	    throw new ExceptionInInitializerError( e );
-	}
+        _theORB.orb(o);
     }
 
-private ORBImple _theORB;
-
+    private final ORBImple _theORB;
 }
 



More information about the jboss-svn-commits mailing list