cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r681777 - in /cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba: CorbaBindingFactory.java CorbaDestination.java utils/CorbaUtils.java utils/OrbConfig.java
Date Fri, 01 Aug 2008 18:46:38 GMT
Author: dkulp
Date: Fri Aug  1 11:46:36 2008
New Revision: 681777

URL: http://svn.apache.org/viewvc?rev=681777&view=rev
Log:
The corbaloc registration stuff is very ORB specific.   Move that into the OrbConfig where
subclasses can be provided for different ORBs.

Modified:
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaBindingFactory.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaDestination.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/OrbConfig.java

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaBindingFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaBindingFactory.java?rev=681777&r1=681776&r2=681777&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaBindingFactory.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaBindingFactory.java
Fri Aug  1 11:46:36 2008
@@ -149,5 +149,7 @@
     public OrbConfig getOrbConfig() {
         return orbConfig;
     }
-
+    public void setOrbConfig(OrbConfig config) {
+        orbConfig = config;
+    }
 }

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaDestination.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaDestination.java?rev=681777&r1=681776&r2=681777&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaDestination.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaDestination.java
Fri Aug  1 11:46:36 2008
@@ -305,7 +305,7 @@
                 objectId = bindingPOA.activate_object(servant);
             }
             obj = bindingPOA.id_to_reference(objectId);
-            CorbaUtils.exportObjectReference(orb, obj, location, address);
+            CorbaUtils.exportObjectReference(orb, obj, location, address, orbConfig);
             
             populateEpr(orb.object_to_string(obj));
             LOG.info("Object Reference: " + orb.object_to_string(obj));

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java?rev=681777&r1=681776&r2=681777&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaUtils.java
Fri Aug  1 11:46:36 2008
@@ -22,7 +22,6 @@
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.PrintWriter;
-import java.lang.reflect.Method;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.HashMap;
@@ -512,7 +511,8 @@
     public static void exportObjectReference(ORB orb,
                                              org.omg.CORBA.Object ref,
                                              String url,
-                                             AddressType address) 
+                                             AddressType address,
+                                             OrbConfig config) 
         throws URISyntaxException, IOException {
         
         if ((url.startsWith("ior:")) || (url.startsWith("IOR:"))) {
@@ -526,7 +526,7 @@
             URI uri = new URI(url.substring(3));
             exportObjectReferenceToFile(orb, ref, uri);
         } else if (url.startsWith("corbaloc:")) {
-            exportObjectReferenceToCorbaloc(orb, ref, url);
+            config.exportObjectReferenceToCorbaloc(orb, ref, url);
         } else if (url.startsWith("corbaname:")) {
             int hashPos = url.lastIndexOf("#");
         
@@ -656,32 +656,6 @@
     }
 
 
-    private static void exportObjectReferenceToCorbaloc(ORB orb,
-                                                        org.omg.CORBA.Object object,
-                                                        String location) {
-        int keyIndex = location.indexOf('/');
-        String key = location.substring(keyIndex + 1);
-        try {
-            Class<?> bootMgrHelperClass = Class.forName("org.apache.yoko.orb.OB.BootManagerHelper");
-            Class<?> bootMgrClass = Class.forName("org.apache.yoko.orb.OB.BootManager");
-            Method narrowMethod =
-                bootMgrHelperClass.getMethod("narrow", org.omg.CORBA.Object.class);
-            java.lang.Object bootMgr = narrowMethod.invoke(null,
-                                                           orb.resolve_initial_references("BootManager"));
-            Method addBindingMethod = 
-                bootMgrClass.getMethod("add_binding", byte[].class, org.omg.CORBA.Object.class);
-            addBindingMethod.invoke(bootMgr, key.getBytes(), object);
-            LOG.info("Added key " + key + " to bootmanager");
-        } catch (ClassNotFoundException ex) {
-            //Not supported by the orb. skip it.
-        } catch (java.lang.reflect.InvocationTargetException ex) {
-            //Not supported by the orb. skip it.
-        } catch (java.lang.Exception ex) {
-            throw new CorbaBindingException(ex.getMessage(), ex);
-        }
-    }
-    
-
     public static org.omg.CORBA.Object importObjectReference(ORB orb,
                                                              String url) {
         org.omg.CORBA.Object result;

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/OrbConfig.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/OrbConfig.java?rev=681777&r1=681776&r2=681777&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/OrbConfig.java
(original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/OrbConfig.java
Fri Aug  1 11:46:36 2008
@@ -19,9 +19,12 @@
 
 package org.apache.cxf.binding.corba.utils;
 
+import java.lang.reflect.Method;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.cxf.binding.corba.CorbaBindingException;
+import org.omg.CORBA.ORB;
 import org.omg.CORBA.Policy;
 
 public class OrbConfig {
@@ -71,5 +74,30 @@
     public List<Policy> getExtraPolicies() {
         return policies;
     }
+    
+    
+    public void exportObjectReferenceToCorbaloc(ORB orb,
+                                                org.omg.CORBA.Object object,
+                                                String location) {
+        int keyIndex = location.indexOf('/');
+        String key = location.substring(keyIndex + 1);
+        try {
+            Class<?> bootMgrHelperClass = Class.forName("org.apache.yoko.orb.OB.BootManagerHelper");
+            Class<?> bootMgrClass = Class.forName("org.apache.yoko.orb.OB.BootManager");
+            Method narrowMethod =
+                bootMgrHelperClass.getMethod("narrow", org.omg.CORBA.Object.class);
+            java.lang.Object bootMgr = narrowMethod.invoke(null,
+                                                           orb.resolve_initial_references("BootManager"));
+            Method addBindingMethod = 
+                bootMgrClass.getMethod("add_binding", byte[].class, org.omg.CORBA.Object.class);
+            addBindingMethod.invoke(bootMgr, key.getBytes(), object);
+        } catch (ClassNotFoundException ex) {
+            //Not supported by the orb. skip it.
+        } catch (java.lang.reflect.InvocationTargetException ex) {
+            //Not supported by the orb. skip it.
+        } catch (java.lang.Exception ex) {
+            throw new CorbaBindingException(ex.getMessage(), ex);
+        }
+    }
 
 }



Mime
View raw message