incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmidd...@apache.org
Subject svn commit: r415752 - /incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerBinding.java
Date Tue, 20 Jun 2006 18:11:45 GMT
Author: dmiddlem
Date: Tue Jun 20 11:11:44 2006
New Revision: 415752

URL: http://svn.apache.org/viewvc?rev=415752&view=rev
Log:
Adding support to handle additional object reference types.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerBinding.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerBinding.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerBinding.java?rev=415752&r1=415751&r2=415752&view=diff
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerBinding.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerBinding.java
Tue Jun 20 11:11:44 2006
@@ -19,6 +19,7 @@
 package org.apache.yoko.bindings.corba;
 
 import java.io.IOException;
+import java.util.logging.Logger;
 
 import javax.wsdl.WSDLException;
 
@@ -30,6 +31,7 @@
 import org.objectweb.celtix.bindings.DataBindingCallback;
 import org.objectweb.celtix.bindings.ServerBinding;
 import org.objectweb.celtix.bindings.ServerBindingEndpointCallback;
+import org.objectweb.celtix.common.logging.LogUtils;
 import org.objectweb.celtix.context.OutputStreamMessageContext;
 import org.objectweb.celtix.ws.addressing.EndpointReferenceType;
 
@@ -41,6 +43,8 @@
 
 public class CorbaServerBinding extends AbstractBindingBase implements ServerBinding {
 
+    private static final Logger LOG = LogUtils.getL7dLogger(CorbaBindingImpl.class);
+
     protected final CorbaBindingImpl corbaBinding;
     protected ServerBindingEndpointCallback sbeCallback;
     private ORB orb;
@@ -50,11 +54,41 @@
 
         sbeCallback = cbFactory;
 
+        String location = "";
+        AddressType address = CorbaUtils.getCorbaAddressType(bus, ref);
+        if (address != null) {
+            location = address.getLocation();
+        }
+        LOG.info("Service address retrieved: " + location);
+
         // TODO: Get any configuration options for the ORB and set the appropriate properties.
         java.util.Properties props = System.getProperties();
         props.put("org.omg.CORBA.ORBClass", "org.apache.yoko.orb.CORBA.ORB");
         props.put("org.omg.CORBA.ORBSingletonClass", "org.apache.yoko.orb.CORBA.ORBSingleton");
         props.put("yoko.orb.id", "Yoko-Server-Binding");
+
+        // If we have one of these two types of addresses, we should specify the address
+        // and port information as properties to the ORB during initialization.
+        if (location.startsWith("IOR:")) {
+            // TODO: How to handle this? Can we obtain port/host information from the IOR
+            // or do we just want to let the ORB pick the port and export the IOR to the

+            // Logs?
+        } else if (location.startsWith("corbaloc")) {
+            int corbalocIndex = location.indexOf(":");
+            int protocolIndex = location.indexOf(":", corbalocIndex + 1);
+            String protocol = location.substring(corbalocIndex + 1, protocolIndex);
+            int hostIndex = location.indexOf(":", protocolIndex + 1);
+            String host = location.substring(protocolIndex + 1, hostIndex);
+            // the port number should be followed by a '/' character
+            int portIndex = location.indexOf("/", hostIndex + 1);
+            String port = location.substring(hostIndex + 1, portIndex);
+            if (protocol.length() == 0) {
+                // This means no protocol was defined.  Default to iiop
+                protocol = "iiop";
+            }
+            props.put("yoko.orb.oa.endpoint", new String(protocol + " --host " + host + "
--port " + port));
+            LOG.info("Set server endpoint: " + protocol + " --host " + host + " --port "
+ port);
+        }
         orb = ORB.init(new String[0], props);
 
         corbaBinding = new CorbaBindingImpl(b, ref, orb, true);
@@ -69,7 +103,8 @@
         // TODO - add support for files which contain IORs
         return address.startsWith("IOR:") 
                || address.startsWith("corbaloc:") 
-               || address.startsWith("relfile");
+               || address.startsWith("relfile") 
+               || address.startsWith("file");
     }
 
     // -- from ServerBinding interface --
@@ -109,9 +144,17 @@
             if (location.startsWith("relfile:/")) {
                 String iorFile = location.substring("relfile:/".length(), location.length());
                 CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
+            } else if (location.startsWith("file:/")) {
+                String iorFile = location.substring("file:/".length(), location.length());
+                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
             } else {
-                // TODO: Provide other export mechanisms 
+                String ior = orb.object_to_string(obj);
+                address.setLocation(ior);
+                String iorFile = "endpoint.ior";
+                CorbaUtils.exportObjectReferenceToFile(obj, orb, iorFile);
+                LOG.info("Object Reference: " + orb.object_to_string(obj));
             }
+            // TODO: Provide other export mechanisms? 
             
             poaManager.activate();
         } catch (Exception ex) {



Mime
View raw message