Author: dkulp
Date: Mon Jun 8 19:17:00 2009
New Revision: 782730
URL: http://svn.apache.org/viewvc?rev=782730&view=rev
Log:
[CXF-2245] Update corba binding to make it easier to configure the ORB.
Patch from Eamonn Dwyer applied.
Added:
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java
(with props)
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java
(with props)
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
(with props)
Modified:
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/CorbaBindingHelper.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/CorbaDestination.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaDestination.java?rev=782730&r1=782729&r2=782730&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
Mon Jun 8 19:17:00 2009
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import java.util.logging.Logger;
import org.apache.cxf.binding.corba.runtime.CorbaDSIServant;
@@ -192,6 +193,8 @@
public void activate() {
java.util.Properties props = new java.util.Properties();
+ Properties configSpecifiedOrbProperties = orbConfig.getOrbProperties();
+ props.putAll(configSpecifiedOrbProperties);
if (orbConfig.getOrbClass() != null) {
props.put("org.omg.CORBA.ORBClass", orbConfig.getOrbClass());
}
Added:
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java?rev=782730&view=auto
==============================================================================
---
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java
(added)
+++
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java
Mon Jun 8 19:17:00 2009
@@ -0,0 +1,69 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.binding.corba.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import javax.annotation.PostConstruct;
+
+import org.apache.cxf.binding.corba.CorbaBindingFactory;
+
+public class OrbConfigurer {
+
+ private CorbaBindingFactory factory;
+ private List<String> orbArgs = new ArrayList<String>();
+ private Properties orbProperties = new Properties();
+
+ public OrbConfigurer() {
+ }
+
+ public void setOrbArgs(List<String> args) {
+ orbArgs = args;
+ }
+
+ public List<String> getOrbArgs() {
+ return orbArgs;
+ }
+
+ public Properties getOrbProperties() {
+ return orbProperties;
+ }
+
+ public void setOrbProperties(Properties props) {
+ orbProperties = props;
+ }
+
+ public void setFactory(CorbaBindingFactory cFactory) {
+ this.factory = cFactory;
+ }
+
+ public CorbaBindingFactory getFactory() {
+ return factory;
+ }
+
+ @PostConstruct
+ public void register() {
+ if (factory != null) {
+ factory.getOrbConfig().setOrbArgs(orbArgs);
+ factory.getOrbConfig().setOrbProperties(orbProperties);
+ }
+ }
+}
Propchange:
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/OrbConfigurer.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Modified:
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaBindingHelper.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaBindingHelper.java?rev=782730&r1=782729&r2=782730&view=diff
==============================================================================
---
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaBindingHelper.java
(original)
+++
cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/CorbaBindingHelper.java
Mon Jun 8 19:17:00 2009
@@ -45,6 +45,8 @@
public static synchronized ORB getDefaultORB(OrbConfig config) {
if (defaultORB == null) {
Properties props = System.getProperties();
+ Properties configSpecifiedOrbProperties =
config.getOrbProperties();
+ props.putAll(configSpecifiedOrbProperties);
if (config.getOrbClass() != null) {
props.put("org.omg.CORBA.ORBClass", config.getOrbClass());
}
@@ -205,5 +207,5 @@
orbUseCount.put(getORBNameFromAddress(address), count);
}
}
-
+
}
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=782730&r1=782729&r2=782730&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
Mon Jun 8 19:17:00 2009
@@ -28,6 +28,7 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Properties;
import org.apache.cxf.binding.corba.CorbaBindingException;
import org.apache.cxf.binding.corba.interceptors.SystemExceptionHelper;
@@ -47,6 +48,7 @@
protected String orbClass;
protected String orbSingletonClass;
protected List<String> orbArgs = new ArrayList<String>();
+ protected Properties orbProperties = new Properties();
public OrbConfig() {
//nothing
@@ -76,6 +78,13 @@
return orbArgs;
}
+ public void setOrbProperties(Properties props) {
+ orbProperties = props;
+ }
+
+ public Properties getOrbProperties() {
+ return orbProperties;
+ }
public void addPOAPolicies(ORB orb,
String poaName,
Added:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java?rev=782730&view=auto
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java
(added)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java
Mon Jun 8 19:17:00 2009
@@ -0,0 +1,92 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.corba;
+
+
+import java.net.URL;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.binding.BindingFactoryManager;
+import org.apache.cxf.binding.corba.CorbaBindingFactory;
+import org.apache.cxf.binding.corba.utils.OrbConfig;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.common.classloader.ClassLoaderUtils;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.junit.Test;
+
+
+public class CorbaBindingFactoryConfigurerTest extends
AbstractBusClientServerTestBase {
+
+
+ public CorbaBindingFactoryConfigurerTest() {
+ }
+
+
+
+ @Test
+ public void testOrbConfiguration() throws Exception {
+ SpringBusFactory bf = new SpringBusFactory();
+ URL cxfConfig = null;
+
+ cxfConfig =
ClassLoaderUtils.getResource("corba_binding_factory_configurer.xml",
this.getClass());
+
+ bus = bf.createBus(cxfConfig);
+ BusFactory.setDefaultBus(bus);
+
+ BindingFactoryManager bfm =
bus.getExtension(BindingFactoryManager.class);
+ CorbaBindingFactory factory =
+
(CorbaBindingFactory)bfm.getBindingFactory("http://cxf.apache.org/bindings/corba");
+ OrbConfig orbConfig = (OrbConfig)factory.getOrbConfig();
+ assertTrue("CorbaBindingFactoryConfigurer is null", orbConfig != null);
+ Properties props = orbConfig.getOrbProperties();
+ assertTrue("probs is null", props != null);
+ assertTrue("prob1 is not equal to value1",
+ "value1".equals(props.get("prop1")));
+ assertTrue("prob2 is not equal to value2",
+ "value2".equals(props.get("prop2")));
+ assertTrue("ORBClass is not equal to MyORBImpl",
+
"com.orbimplco.MyORBImpl".equals(props.get("org.omg.CORBA.ORBClass")));
+ assertTrue("ORBSingletonClass is not equal to MyORBSingleton",
+
"com.orbimplco.MyORBSingleton".equals(props.get("org.omg.CORBA.ORBSingletonClass")));
+ List <String> orbArgs = orbConfig.getOrbArgs();
+ assertTrue("orbArgs is null", orbArgs != null);
+ String domainNameId = orbArgs.get(0);
+ assertTrue("domainNameId is not equal to -ORBdomain_name",
+ "-ORBdomain_name".equals(domainNameId));
+ String domainNameValue = orbArgs.get(1);
+ assertTrue("domainNameValue is not equal to test-domain",
+ "test-domain".equals(domainNameValue));
+ String configDomainsDirId = orbArgs.get(2);
+ assertTrue("configDomainsDirId is not equal to
-ORBconfig_domains_dir",
+ "-ORBconfig_domains_dir".equals(configDomainsDirId));
+ String configDomainsDirValue = orbArgs.get(3);
+ assertTrue("configDomainsDirValue is not equal to src/test/resources",
+ "src/test/resources".equals(configDomainsDirValue));
+ String orbNameId = orbArgs.get(4);
+ assertTrue("orbNameId is not equal to -ORBname",
+ "-ORBname".equals(orbNameId));
+ String orbNameValue = orbArgs.get(5);
+ assertTrue("orbNameValue is not equal to test",
+ "test".equals(orbNameValue));
+ }
+}
+
Propchange:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/CorbaBindingFactoryConfigurerTest.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
URL:
http://svn.apache.org/viewvc/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml?rev=782730&view=auto
==============================================================================
---
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
(added)
+++
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
Mon Jun 8 19:17:00 2009
@@ -0,0 +1,64 @@
+<?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
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:http="http://cxf.apache.org/transports/http/configuration"
+ xmlns:jms="http://cxf.apache.org/transports/jms"
+ xmlns:jaxws="http://cxf.apache.org/jaxws"
+ xsi:schemaLocation="
+ http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+http://cxf.apache.org/transports/jms
http://cxf.apache.org/schemas/configuration/jms.xsd
+http://cxf.apache.org/transports/http/configuration
http://cxf.apache.org/schemas/configuration/http-conf.xsd
+http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
+
+
+ <bean id="myOrbConfigurer"
+ class="org.apache.cxf.binding.corba.runtime.OrbConfigurer">
+ <property name="orbProperties">
+ <props>
+ <prop key="prop1">
+ value1
+ </prop>
+ <prop key="prop2">
+ value2
+ </prop>
+ <prop key="org.omg.CORBA.ORBClass">
+ com.orbimplco.MyORBImpl
+ </prop>
+ <prop key="org.omg.CORBA.ORBSingletonClass">
+ com.orbimplco.MyORBSingleton
+ </prop>
+
+ </props>
+ </property>
+
+ <property name="orbArgs">
+ <list>
+ <value>-ORBdomain_name</value>
+ <value>test-domain</value>
+ <value>-ORBconfig_domains_dir</value>
+ <value>src/test/resources</value>
+ <value>-ORBname</value>
+ <value>test</value>
+ </list>
+ </property>
+ <property name="factory"
ref="org.apache.cxf.binding.corba.CorbaBindingFactory"/>
+ </bean>
+</beans>
Propchange:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
------------------------------------------------------------------------------
svn:keywords = Rev Date
Propchange:
cxf/trunk/systests/src/test/java/org/apache/cxf/systest/corba/corba_binding_factory_configurer.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml