incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r507660 - in /incubator/yoko/trunk/bindings/src: main/java/org/apache/yoko/bindings/corba/ main/resources/META-INF/cxf/ test/java/org/apache/yoko/bindings/corba/
Date Wed, 14 Feb 2007 19:15:58 GMT
Author: bravi
Date: Wed Feb 14 11:15:57 2007
New Revision: 507660

URL: http://svn.apache.org/viewvc?view=rev&rev=507660
Log:
[YOKO-291] - Allow for configurable orb  argumentss & properties in the corba binding.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingFactory.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDestination.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerConduit.java
    incubator/yoko/trunk/bindings/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaDestinationTest.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaServerConduitTest.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingFactory.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingFactory.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaBindingFactory.java
Wed Feb 14 11:15:57 2007
@@ -59,6 +59,7 @@
     private Bus bus;
     private Collection<String> activationNamespaces;
     private List<String> transportIds;
+    private OrbConfig orbConfig = new OrbConfig();
 
     @Resource
     public void setBus(Bus b) {
@@ -70,6 +71,16 @@
         activationNamespaces = ans;
     }
 
+    @Resource
+    public void setOrbClass(String cls) {
+        orbConfig.setOrbClass(cls);
+    }
+    
+    @Resource
+    public void setOrbSingletonClass(String cls) {
+        orbConfig.setOrbSingletonClass(cls);
+    }
+
     @PostConstruct
     void registerSelf() {
         if (null == bus) {
@@ -115,12 +126,12 @@
 
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target)
         throws IOException {
-        return new CorbaConduit(endpointInfo, target);
+        return new CorbaConduit(endpointInfo, target, orbConfig);
     }
 
     public Destination getDestination(EndpointInfo endpointInfo)
         throws IOException {
-        return new CorbaDestination(endpointInfo);
+        return new CorbaDestination(endpointInfo, orbConfig);
     }
 
     public List<String> getTransportIds() {
@@ -132,6 +143,11 @@
         transportIds = ids;
     }
 
+    @Resource
+    public void setOrbArgs(List<String> args) {
+        orbConfig.setOrbArgs(args);
+    }
+    
     public Set<String> getUriPrefixes() {
         return CastUtils.cast(Collections.EMPTY_SET);
     }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaConduit.java
Wed Feb 14 11:15:57 2007
@@ -71,20 +71,20 @@
     private EndpointReferenceType target;
     private MessageObserver incomingObserver;
     private ORB orb;
+    private OrbConfig orbConfig;
 
-    public CorbaConduit(EndpointInfo ei, EndpointReferenceType ref) {
+    public CorbaConduit(EndpointInfo ei, EndpointReferenceType ref, OrbConfig config) {
         endpointInfo = ei;
         target = getTargetReference(ref);
+        orbConfig = config;
         // TODO: Set any additional properties needed to initialize the ORB  before
-        // we initialize it. We will get this information from the Celtix configuration 
-        // that is used with the current application.
+        // we initialize it.
         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("org.omg.CORBA.ORBClass", orbConfig.getOrbClass());
+        props.put("org.omg.CORBA.ORBSingletonClass", orbConfig.getOrbSingletonClass());
         props.put("yoko.orb.id", "Yoko-Client-Binding");
-
-        orb = ORB.init(new String[0], props);
+        List<String> orbArgs = orbConfig.getOrbArgs();
+        orb = ORB.init(orbArgs.toArray(new String[orbArgs.size()]), props);
         if (orb == null) {
             LOG.severe("Could not create instance of the ORB");
             throw new CorbaBindingException("Could not create instance of the ORB");
@@ -344,7 +344,7 @@
             LOG.log(Level.FINE, "incoming observer is " + incomingObserver);
             Exchange exchange = message.getExchange();            
             MessageImpl inMessage = new MessageImpl();
-            CorbaDestination destination = new CorbaDestination(endpointInfo);
+            CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
             inMessage.setDestination(destination);
             exchange.put(ORB.class, orb);
             inMessage.setExchange(exchange);

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDestination.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDestination.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDestination.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaDestination.java
Wed Feb 14 11:15:57 2007
@@ -20,6 +20,7 @@
 package org.apache.yoko.bindings.corba;
 
 import java.io.IOException;
+import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -49,8 +50,9 @@
     private ORB orb;
     private BindingInfo binding;
     private EndpointInfo endpointInfo;
+    private OrbConfig orbConfig;
 
-    public CorbaDestination(EndpointInfo ei) {
+    public CorbaDestination(EndpointInfo ei, OrbConfig config) {
         address = ei.getExtensor(AddressType.class);
         binding = ei.getBinding();
         reference = new EndpointReferenceType();
@@ -58,6 +60,7 @@
         addr.setValue(address.getLocation());
         reference.setAddress(addr);
         endpointInfo = ei;
+        orbConfig = config;
     }
 
     public EndpointReferenceType getAddress() {
@@ -68,7 +71,7 @@
                                   Message partialResponse,
                                   EndpointReferenceType ref)
         throws IOException {
-        return  new CorbaServerConduit(endpointInfo, reference);                
+        return  new CorbaServerConduit(endpointInfo, reference, orbConfig);             
  
     }
 
     public BindingInfo getBindingInfo() {
@@ -104,8 +107,8 @@
         
         // 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("org.omg.CORBA.ORBClass", orbConfig.getOrbClass());
+        props.put("org.omg.CORBA.ORBSingletonClass", orbConfig.getOrbSingletonClass());
         props.put("yoko.orb.id", "Yoko-Server-Binding");
 
         // If we have one of these two types of addresses, we should specify the address
@@ -130,7 +133,8 @@
             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);
+        List<String> orbArgs = orbConfig.getOrbArgs();
+        orb = ORB.init(orbArgs.toArray(new String[orbArgs.size()]), props);
         activate(observer);
     }
 

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerConduit.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerConduit.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerConduit.java
(original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaServerConduit.java
Wed Feb 14 11:15:57 2007
@@ -21,6 +21,7 @@
 
 import java.io.IOException;
 import java.io.OutputStream;
+import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -52,19 +53,18 @@
     private MessageObserver incomingObserver;
     private ORB orb;
 
-    public CorbaServerConduit(EndpointInfo ei, EndpointReferenceType ref) {
+    public CorbaServerConduit(EndpointInfo ei, EndpointReferenceType ref, OrbConfig config)
{
         endpointInfo = ei;
         target = getTargetReference(ref);
         // TODO: Set any additional properties needed to initialize the ORB  before
         // we initialize it. We will get this information from the Celtix configuration 
         // that is used with the current application.
         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("org.omg.CORBA.ORBClass", config.getOrbClass());
+        props.put("org.omg.CORBA.ORBSingletonClass", config.getOrbSingletonClass());
         props.put("yoko.orb.id", "Yoko-Client-Binding");
-
-        orb = ORB.init(new String[0], props);
+        List<String> orbArgs = config.getOrbArgs();
+        orb = ORB.init(orbArgs.toArray(new String[orbArgs.size()]), props);
         if (orb == null) {
             LOG.severe("Could not create instance of the ORB");
             throw new CorbaBindingException("Could not create instance of the ORB");

Modified: incubator/yoko/trunk/bindings/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/resources/META-INF/cxf/cxf-extension-corba.xml?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
(original)
+++ incubator/yoko/trunk/bindings/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
Wed Feb 14 11:15:57 2007
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -34,6 +34,17 @@
         <property name="transportIds">
             <list>
 	        <value>http://schemas.apache.org/yoko/bindings/corba</value>
+            </list>
+        </property>
+        <property name="orbClass">
+            <value>org.apache.yoko.orb.CORBA.ORB</value>
+        </property>
+        <property name="orbSingletonClass">
+            <value>org.apache.yoko.orb.CORBA.ORBSingleton</value>
+        </property>
+        <property name="orbArgs">
+            <list>
+                <value/>
             </list>
         </property>
     </bean>

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaConduitTest.java
Wed Feb 14 11:15:57 2007
@@ -74,6 +74,7 @@
     Message inMessage;
     CorbaBindingFactory factory;
     TestUtils testUtils;
+    OrbConfig orbConfig;
 
     public CorbaConduitTest(String arg0) {
         super(arg0);
@@ -84,15 +85,18 @@
     }
     
     public void setUp() throws Exception {
-     control = EasyMock.createNiceControl();
+        control = EasyMock.createNiceControl();
      
-     bus = BusFactory.newInstance().getDefaultBus(); 
+        bus = BusFactory.newInstance().getDefaultBus(); 
      
-     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");
-     orb = ORB.init(new String[0], props);     
+        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");
+        orb = ORB.init(new String[0], props);
+        orbConfig = new OrbConfig();
+        orbConfig.setOrbClass("org.apache.yoko.orb.CORBA.ORB");
+        orbConfig.setOrbSingletonClass("org.apache.yoko.orb.CORBA.ORBSingleton");
     }
     
     public void tearDown() {
@@ -115,8 +119,8 @@
                          "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                          "SimpleCORBAPort");
 
-        CorbaDestination destination = new CorbaDestination(endpointInfo);
-        CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress());
+        CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
+        CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress(), orbConfig);
         Message message = new MessageImpl();
         try {
             conduit.send(message);
@@ -137,8 +141,8 @@
                          "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                          "SimpleCORBAPort");
 
-        CorbaDestination destination = new CorbaDestination(endpointInfo);
-        CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress());
+        CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
+        CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress(), orbConfig);
         
         EndpointReferenceType t = null;
         EndpointReferenceType ref = conduit.getTargetReference(t);
@@ -150,9 +154,9 @@
                          "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                          "SimpleCORBAPort");
 
-        CorbaDestination destination = new CorbaDestination(endpointInfo);
+        CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
         endpointInfo.setAddress("corbaloc::localhost:40000/Simple");
-        CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress());
          
+        CorbaConduit conduit = new CorbaConduit(endpointInfo, destination.getAddress(), orbConfig);
          
         String address = conduit.getAddress();
         assertTrue("address should not be null", address != null);
         assertEquals(address, "corbaloc::localhost:40000/Simple");                
@@ -379,7 +383,7 @@
     protected CorbaConduit setupCorbaConduit(boolean send) {
         target = EasyMock.createMock(EndpointReferenceType.class);                   
         endpointInfo = EasyMock.createMock(EndpointInfo.class);
-        CorbaConduit corbaConduit = new CorbaConduit(endpointInfo, target);
+        CorbaConduit corbaConduit = new CorbaConduit(endpointInfo, target, orbConfig);
         
         if (send) {
             // setMessageObserver

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaDestinationTest.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaDestinationTest.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaDestinationTest.java
Wed Feb 14 11:15:57 2007
@@ -40,6 +40,7 @@
     
     protected static TestUtils testUtils;
     EndpointInfo endpointInfo;
+    OrbConfig orbConfig;
     
     public CorbaDestinationTest() {
         super();
@@ -52,6 +53,9 @@
     protected void setUp() throws Exception {
         super.setUp();     
         testUtils = new TestUtils();
+        orbConfig = new OrbConfig();
+        orbConfig.setOrbClass("org.apache.yoko.orb.CORBA.ORB");
+        orbConfig.setOrbSingletonClass("org.apache.yoko.orb.CORBA.ORBSingleton");
     }
     
     public void tearDown() {        
@@ -61,7 +65,7 @@
        endpointInfo = testUtils.setupServiceInfo("http://yoko.apache.org/simple",
                         "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                         "SimpleCORBAPort");
-       CorbaDestination destination = new CorbaDestination(endpointInfo);
+       CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
        
        EndpointReferenceType  rtype = destination.getAddress();
        assertTrue("EndpointReferenceType should not be null", rtype != null);       

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaServerConduitTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaServerConduitTest.java?view=diff&rev=507660&r1=507659&r2=507660
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaServerConduitTest.java
(original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaServerConduitTest.java
Wed Feb 14 11:15:57 2007
@@ -56,6 +56,7 @@
     Message inMessage;
     CorbaBindingFactory factory;
     TestUtils testUtils;
+    OrbConfig orbConfig;
 
     public CorbaServerConduitTest(String arg0) {
         super(arg0);
@@ -66,15 +67,18 @@
     }
     
     public void setUp() throws Exception {
-     control = EasyMock.createNiceControl();
+        control = EasyMock.createNiceControl();
      
-     bus = BusFactory.newInstance().getDefaultBus(); 
+        bus = BusFactory.newInstance().getDefaultBus(); 
      
-     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");
-     orb = ORB.init(new String[0], props);
+        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");
+        orb = ORB.init(new String[0], props);
+        orbConfig = new OrbConfig();
+        orbConfig.setOrbClass("org.apache.yoko.orb.CORBA.ORB");
+        orbConfig.setOrbSingletonClass("org.apache.yoko.orb.CORBA.ORBSingleton");
     }
     
     public void tearDown() {        
@@ -97,9 +101,8 @@
         setupServiceInfo("http://yoko.apache.org/simple",
                          "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                          "SimpleCORBAPort");
-
-        CorbaDestination destination = new CorbaDestination(endpointInfo);
-        CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress());
+        CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
+        CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress(),
orbConfig);
         Message message = new MessageImpl();
         try {
             conduit.send(message);
@@ -121,8 +124,8 @@
                          "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                          "SimpleCORBAPort");
 
-        CorbaDestination destination = new CorbaDestination(endpointInfo);
-        CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress());
+        CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
+        CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress(),
orbConfig);
         
         EndpointReferenceType t = null;
         EndpointReferenceType ref = conduit.getTargetReference(t);
@@ -135,9 +138,9 @@
                          "/wsdl/simpleIdl.wsdl", "SimpleCORBAService",
                          "SimpleCORBAPort");
 
-        CorbaDestination destination = new CorbaDestination(endpointInfo);
+        CorbaDestination destination = new CorbaDestination(endpointInfo, orbConfig);
         endpointInfo.setAddress("corbaloc::localhost:40000/Simple");
-        CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress());
          
+        CorbaServerConduit conduit = new CorbaServerConduit(endpointInfo, destination.getAddress(),
orbConfig);           
         String address = conduit.getAddress();
         assertTrue("address should not be null", address != null);
         assertEquals(address, "corbaloc::localhost:40000/Simple");        
@@ -267,7 +270,7 @@
         target = EasyMock.createMock(EndpointReferenceType.class);                   
         endpointInfo = EasyMock.createMock(EndpointInfo.class);
         CorbaServerConduit CorbaServerConduit = 
-            new CorbaServerConduit(endpointInfo, target);
+            new CorbaServerConduit(endpointInfo, target, orbConfig);
         
         if (send) {
             // setMessageObserver



Mime
View raw message