cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r683714 - in /cxf/trunk: distribution/src/main/release/samples/corba/bank_ws_addressing/ rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/ rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/ rt/bindings/co...
Date Thu, 07 Aug 2008 21:05:13 GMT
Author: dkulp
Date: Thu Aug  7 14:05:12 2008
New Revision: 683714

URL: http://svn.apache.org/viewvc?rev=683714&view=rev
Log:
Bunches of updates to CORBA binding to enhance performance a bit as well as abstract out 
some more of the stuff that is ORB specific.  Make some more stuff visible to possible 
orb specific subclasses and such.

Added:
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java
Modified:
    cxf/trunk/distribution/src/main/release/samples/corba/bank_ws_addressing/BankWS-corba.wsdl
    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/CorbaConduit.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/CorbaServerConduit.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamInInterceptor.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/SystemExceptionHelper.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServant.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/HandlerIterator.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/CorbaUtils.java
    cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/utils/OrbConfig.java
    cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
    cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaBindingFactoryTest.java

Modified: cxf/trunk/distribution/src/main/release/samples/corba/bank_ws_addressing/BankWS-corba.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/corba/bank_ws_addressing/BankWS-corba.wsdl?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/corba/bank_ws_addressing/BankWS-corba.wsdl (original)
+++ cxf/trunk/distribution/src/main/release/samples/corba/bank_ws_addressing/BankWS-corba.wsdl Thu Aug  7 14:05:12 2008
@@ -384,7 +384,7 @@
     <wsdl:service name="BankCORBAService">
         <wsdl:port name="BankCORBAPort" binding="tns:BankCORBABinding">
             <corba:address location="corbaname::localhost:1050#Bank" />
-            <corba:policy poaname="Bank" serviceid="Bank" persistent="true" />
+            <corba:policy poaname="Bank" serviceid="Bank" persistent="false" />
         </wsdl:port>
     </wsdl:service>
 </wsdl:definitions>

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=683714&r1=683713&r2=683714&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 Thu Aug  7 14:05:12 2008
@@ -23,9 +23,7 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
-import javax.xml.bind.JAXBException;
 
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
@@ -43,56 +41,21 @@
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
-import org.apache.cxf.wsdl.JAXBExtensionHelper;
-import org.apache.cxf.wsdl.TExtensibilityElementImpl;
-import org.apache.cxf.wsdl.WSDLManager;
 
 public class CorbaBindingFactory extends AbstractBindingFactory
     implements ConduitInitiator, DestinationFactory {
     
-    private static final String YOKO_NAMESPACE = "http://schemas.apache.org/yoko/bindings/corba";
+    protected List<String> transportIds;
+    protected OrbConfig orbConfig = new OrbConfig();
 
-    private List<String> transportIds;
-    private OrbConfig orbConfig = new OrbConfig();
-
-    @Resource(name = "orbClass")
     public void setOrbClass(String cls) {
         orbConfig.setOrbClass(cls);
     }
     
-    @Resource(name = "orbSingletonClass")
     public void setOrbSingletonClass(String cls) {
         orbConfig.setOrbSingletonClass(cls);
     }
-    
-    @PostConstruct
-    void registerYokoCompatibleExtensors() {
-        WSDLManager manager = this.getBus().getExtension(WSDLManager.class);
-        createCompatExtensor(manager, javax.wsdl.Binding.class,
-                             org.apache.cxf.binding.corba.wsdl.BindingType.class);
-        createCompatExtensor(manager, javax.wsdl.BindingOperation.class,
-                             org.apache.cxf.binding.corba.wsdl.OperationType.class);
-        createCompatExtensor(manager, javax.wsdl.Definition.class,
-                             org.apache.cxf.binding.corba.wsdl.TypeMappingType.class);
-        createCompatExtensor(manager, javax.wsdl.Port.class,
-                             org.apache.cxf.binding.corba.wsdl.AddressType.class);
-        createCompatExtensor(manager, javax.wsdl.Port.class,
-                             org.apache.cxf.binding.corba.wsdl.PolicyType.class);
-    }
-
-    private void createCompatExtensor(WSDLManager manager,
-                                      Class<?> parentType,
-                                      Class<? extends TExtensibilityElementImpl> elementType) {
-        try {
-            JAXBExtensionHelper.addExtensions(manager.getExtensionRegistry(),
-                                              parentType, 
-                                              elementType,
-                                              YOKO_NAMESPACE);
-        } catch (JAXBException e) {
-            //ignore, just won't support the yoko extensors
-        }
-        
-    }
+   
 
     public Binding createBinding(BindingInfo bindingInfo) {
         CorbaBinding binding = new CorbaBinding();
@@ -131,7 +94,6 @@
         transportIds = ids;
     }
 
-    @Resource
     public void setOrbArgs(List<String> args) {
         orbConfig.setOrbArgs(args);
     }

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaConduit.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaConduit.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaConduit.java Thu Aug  7 14:05:12 2008
@@ -177,7 +177,7 @@
         return endpointInfo.getAddress();
     }
         
-    protected void buildRequest(CorbaMessage message, OperationType opType) throws Exception {        
+    public void buildRequest(CorbaMessage message, OperationType opType) throws Exception {        
         ServiceInfo service = message.getExchange().get(ServiceInfo.class);
         NVList nvlist = getArguments(message);
         NamedValue ret = getReturn(message);
@@ -221,7 +221,7 @@
         }
     }
        
-    protected NVList getArguments(CorbaMessage message) {
+    public NVList getArguments(CorbaMessage message) {
         if (orb == null) {
             prepareOrb();
         }
@@ -243,7 +243,7 @@
         return list;        
     }
     
-    protected NamedValue getReturn(CorbaMessage message) {
+    public NamedValue getReturn(CorbaMessage message) {
         if (orb == null) {
             prepareOrb();
         }
@@ -262,7 +262,7 @@
         return ret;        
     }
     
-    protected ExceptionList getExceptionList(Map<TypeCode, RaisesType> exceptions,
+    public ExceptionList getExceptionList(Map<TypeCode, RaisesType> exceptions,
                                              CorbaMessage message, 
                                              OperationType opType) {
         if (orb == null) {
@@ -285,7 +285,7 @@
         return exList;
     }
             
-    protected Request getRequest(CorbaMessage message,
+    public Request getRequest(CorbaMessage message,
                                  String opName,
                                  org.omg.CORBA.NVList nvlist, 
                                  org.omg.CORBA.NamedValue ret, 
@@ -311,7 +311,7 @@
         return request;
     }
         
-    protected Map<TypeCode, RaisesType> getOperationExceptions(
+    public Map<TypeCode, RaisesType> getOperationExceptions(
                                          OperationType operation, 
                                          CorbaTypeMap map) {
         if (orb == null) {

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=683714&r1=683713&r2=683714&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 Thu Aug  7 14:05:12 2008
@@ -23,7 +23,7 @@
 import java.net.URI;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.logging.Level;
+import java.util.Map;
 import java.util.logging.Logger;
 
 import org.apache.cxf.binding.corba.runtime.CorbaDSIServant;
@@ -37,20 +37,25 @@
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
-import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.MultiplexDestination;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.Policy;
+import org.omg.PortableServer.Current;
 import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.IdUniquenessPolicyValue;
 import org.omg.PortableServer.LifespanPolicyValue;
 import org.omg.PortableServer.POA;
 import org.omg.PortableServer.POAHelper;
 import org.omg.PortableServer.POAManager;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.Servant;
 import org.omg.PortableServer.ThreadPolicyValue;
 
-public class CorbaDestination implements Destination {
+public class CorbaDestination implements MultiplexDestination {
     
     private static final String IOR_SHARED_KEY = "ior:shared-key";
     private static final Logger LOG = LogUtils.getL7dLogger(CorbaDestination.class);
@@ -88,7 +93,6 @@
         } else {
             typeMap = TypeMapCache.get(binding.getService());
         }
-        isPersistent = orbConfig.isPersistentPoa();
         PolicyType policy = ei.getExtensor(PolicyType.class);
         if (policy != null) {
             poaName = policy.getPoaname();
@@ -152,11 +156,7 @@
         if (CorbaUtils.isIOR(location)) {
             location = IOR_SHARED_KEY;
         }
-        orb = CorbaBindingHelper.getAddressSpecificORB(location);
-        if (orb == null) {
-            orb = ORB.init(orbArgs.toArray(new String[orbArgs.size()]), props);
-            CorbaBindingHelper.addAddressSpecificORB(location, orb);
-        }
+        orb = CorbaBindingHelper.getAddressSpecificORB(location, props, orbArgs);
 
         // Get the binding helper to remember that we need this ORB kept alive, even if another
         // destination tries to destroy it.
@@ -235,6 +235,11 @@
                 poaName = getEndPointInfo().getName().getLocalPart().replace('.', '_');                
             }
             setCorbaLocArgs(addressURI, orbArgs);
+        } else if ("corbaname".equals(scheme)) {
+            int idx = location.indexOf("#");
+            if (idx != -1) {
+                serviceId = location.substring(idx + 1);
+            }
         }
 
         if (isPersistent) {
@@ -251,13 +256,7 @@
 
         orb = getORB(orbArgs, location, props);        
         
-        if (orb == null) {
-            LOG.log(Level.INFO, "Creating ORB with address " + location);
-            orb = CorbaBindingHelper.createAddressSpecificORB(location, orbConfig);
-        }
-        // Need to indicate that this ORB can't be destroyed while we are using it
-        CorbaBindingHelper.keepORBAlive(location);
-        
+
         try {
             POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
             POAManager poaManager = rootPOA.the_POAManager();
@@ -276,7 +275,7 @@
             // exception at this point during the activation, we should see an
             // exception if we try
             // an activate two objects with the same servant ID instead.
-            if (bindingPOA != null && !isPersistent) {
+            if (bindingPOA != null && !isPersistent && serviceId == null) {
                 throw new CorbaBindingException(
                         "Corba Port activation failed because the poa "
                                 + poaName + " already exists");
@@ -304,8 +303,9 @@
             } else {                
                 objectId = bindingPOA.activate_object(servant);
             }
+            bindingPOA.set_servant(servant);
             obj = bindingPOA.id_to_reference(objectId);
-            CorbaUtils.exportObjectReference(orb, obj, location, address, orbConfig);
+            orbConfig.exportObjectReference(orb, obj, location, address);
             
             populateEpr(orb.object_to_string(obj));
             LOG.info("Object Reference: " + orb.object_to_string(obj));
@@ -388,8 +388,6 @@
 
     protected POA createPOA(String name, POA parentPOA, POAManager poaManager) {
         List<Policy> policies = new ArrayList<Policy>();
-
-        
         policies.add(parentPOA
                 .create_thread_policy(ThreadPolicyValue.ORB_CTRL_MODEL));
 
@@ -403,11 +401,15 @@
 
         if (serviceId != null) {
             policies.add(parentPOA
-                            .create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID));
+                         .create_id_assignment_policy(IdAssignmentPolicyValue.USER_ID));
+            
         }
 
+        policies.add(parentPOA.create_id_uniqueness_policy(IdUniquenessPolicyValue.MULTIPLE_ID));
+        RequestProcessingPolicyValue value = RequestProcessingPolicyValue.USE_DEFAULT_SERVANT;
+        policies.add(parentPOA.create_request_processing_policy(value));        
         
-        policies.addAll(orbConfig.getExtraPolicies());
+        orbConfig.addPOAPolicies(orb, name, parentPOA, poaManager, policies);
         
         Policy[] policyList = (Policy[])policies.toArray(new Policy[policies.size()]);
 
@@ -418,5 +420,45 @@
                     "Could not create POA during activation", ex);
         }
     }
+    public EndpointReferenceType getAddressWithId(String id) {
+        EndpointReferenceType ref = null;
+        if (bindingPOA == null) {
+            throw new CorbaBindingException(
+                 "getAddressWithId failed because the poa is null");
+        }
+        try {
+            Servant servant = bindingPOA.id_to_servant(objectId);
+            org.omg.CORBA.Object objRef 
+                = bindingPOA.create_reference_with_id(id.getBytes(),
+                                               servant._all_interfaces(bindingPOA, objectId)[0]);
+            AddressType addr = new AddressType();
+            orbConfig.exportObjectReference(orb, objRef,
+                                            address.getLocation(),
+                                            addr);
+            ref = EndpointReferenceUtils.getEndpointReference(addr.getLocation());
+            EndpointInfo ei = getEndPointInfo();
+            if (ei.getService() != null) {
+                EndpointReferenceUtils.setServiceAndPortName(ref, ei.getService().getName(), 
+                                                             ei.getName().getLocalPart());
+            }
+        } catch (Exception e) {
+            throw new CorbaBindingException("Failed to getAddressWithId, reason:" + e.toString(), e);
+        }
+        return ref;
+    }
+
+    public String getId(Map contextMap) {
+        String id = null;
+        try {
+            Current currentPoa = (Current) orb
+                .resolve_initial_references("POACurrent");
+            byte[] idBytes = currentPoa.get_object_id();
+            id = new String(idBytes);
+        } catch (Exception e) {
+            throw new CorbaBindingException("Unable to getId, current is unavailable, reason: "
+                                             + e, e);
+        }
+        return id;
+    }
 
 }

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaServerConduit.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaServerConduit.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaServerConduit.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/CorbaServerConduit.java Thu Aug  7 14:05:12 2008
@@ -109,7 +109,7 @@
     }
     
     
-    protected void buildRequestResult(CorbaMessage msg) {        
+    public void buildRequestResult(CorbaMessage msg) {        
         Exchange exg = msg.getExchange();        
         ServerRequest request = exg.get(ServerRequest.class);
         try {

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamFaultOutInterceptor.java Thu Aug  7 14:05:12 2008
@@ -112,7 +112,7 @@
         }
 
         if (ex instanceof SystemException) {
-            setSystemException(message, ex);
+            setSystemException(message, ex, destination);
             return;
         }
         
@@ -221,12 +221,12 @@
     }
 
     protected void setSystemException(CorbaMessage message,
-                                      Throwable ex) {
+                                      Throwable ex,
+                                      CorbaDestination dest) {
         SystemException sysEx = (SystemException)ex;
         message.setSystemException(sysEx);
         ServerRequest request  = message.getExchange().get(ServerRequest.class);
-        Any exAny = orb.create_any();
-        SystemExceptionHelper.insert(exAny, sysEx);
+        Any exAny = dest.getOrbConfig().createSystemExceptionAny(orb, sysEx);
         request.set_exception(exAny);
     }
 

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamInInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamInInterceptor.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamInInterceptor.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/CorbaStreamInInterceptor.java Thu Aug  7 14:05:12 2008
@@ -64,9 +64,6 @@
 
 public class CorbaStreamInInterceptor extends AbstractPhaseInterceptor<Message> {
 
-    private ORB orb;
-    private ServiceInfo service;
-    private CorbaDestination destination;
 
 
     public CorbaStreamInInterceptor() {
@@ -74,13 +71,6 @@
     }   
 
     public void handleMessage(Message message) throws Fault {
-        if (message.getDestination() != null) {
-            destination = (CorbaDestination)message.getDestination();
-        } else {
-            destination = (CorbaDestination)message.getExchange().getDestination();
-        }
-        service = destination.getBindingInfo().getService();
-
         if (ContextUtils.isRequestor(message)) {
             handleReply(message);
         } else {
@@ -89,6 +79,16 @@
     }
 
     private void handleReply(Message msg) {
+        ORB orb;
+        ServiceInfo service;
+        CorbaDestination destination;
+        if (msg.getDestination() != null) {
+            destination = (CorbaDestination)msg.getDestination();
+        } else {
+            destination = (CorbaDestination)msg.getExchange().getDestination();
+        }
+        service = destination.getBindingInfo().getService();
+
         CorbaMessage message = (CorbaMessage)msg;
         if (message.getStreamableException() != null || message.getSystemException() != null) {
             Endpoint ep = message.getExchange().get(Endpoint.class);
@@ -131,6 +131,15 @@
     }
 
     private void handleRequest(Message msg) {
+        ORB orb;
+        ServiceInfo service;
+        CorbaDestination destination;
+        if (msg.getDestination() != null) {
+            destination = (CorbaDestination)msg.getDestination();
+        } else {
+            destination = (CorbaDestination)msg.getExchange().getDestination();
+        }
+        service = destination.getBindingInfo().getService();
 
         CorbaMessage message = (CorbaMessage) msg;
 
@@ -161,7 +170,9 @@
         orb = (ORB)exchange.get(ORB.class);
 
         ServerRequest request = exchange.get(ServerRequest.class);
-        NVList list = prepareArguments(message, info, opType, opQName, typeMap);
+        NVList list = prepareArguments(message, info, opType, 
+                                       opQName, typeMap,
+                                       destination, service);
         request.arguments(list);
         message.setList(list);
 
@@ -194,7 +205,9 @@
                                       InterfaceInfo info,
                                       OperationType opType,
                                       QName opQName,
-                                      CorbaTypeMap typeMap) {        
+                                      CorbaTypeMap typeMap,
+                                      CorbaDestination destination,
+                                      ServiceInfo service) {        
         BindingInfo bInfo = destination.getBindingInfo();                              
         EndpointInfo eptInfo = destination.getEndPointInfo();
         BindingOperationInfo bOpInfo = bInfo.getOperation(opQName);
@@ -215,7 +228,10 @@
                        
         List<ParamType> paramTypes = opType.getParam();       
         CorbaStreamable[] arguments = new CorbaStreamable[paramTypes.size()];                               
-        NVList list = prepareDIIArgsList(corbaMsg, bOpInfo, arguments, paramTypes, typeMap);         
+        NVList list = prepareDIIArgsList(corbaMsg, bOpInfo, 
+                                         arguments, paramTypes, 
+                                         typeMap,
+                                         exg.get(ORB.class), service);         
         
         return list;
         
@@ -225,7 +241,9 @@
                                         BindingOperationInfo boi,
                                         CorbaStreamable[] streamables, 
                                         List<ParamType> paramTypes,
-                                        CorbaTypeMap map) {
+                                        CorbaTypeMap map,
+                                        ORB orb,
+                                        ServiceInfo service) {
         try {
             // Build the list of DII arguments, returns, and exceptions        
             NVList list = orb.create_list(streamables.length);        

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/SystemExceptionHelper.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/SystemExceptionHelper.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/SystemExceptionHelper.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/interceptors/SystemExceptionHelper.java Thu Aug  7 14:05:12 2008
@@ -19,14 +19,17 @@
 package org.apache.cxf.binding.corba.interceptors;
 
 import org.omg.CORBA.Any;
-import org.omg.CORBA.CompletionStatusHelper;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.StructMember;
 import org.omg.CORBA.SystemException;
 import org.omg.CORBA.TCKind;
 import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
 
-public final class SystemExceptionHelper {
+public final class SystemExceptionHelper 
+    implements org.omg.CORBA.portable.Streamable {
+    
     private static final int BAD_CONTEXT = 0;
     private static final int BAD_INV_ORDER = 1;
     private static final int BAD_OPERATION = 2;
@@ -64,41 +67,6 @@
     private static final int TRANSIENT = 34;
     private static final int UNKNOWN = 35;
     
-    
-
-    private static final String[] CLASSES = {
-        "org.omg.CORBA.BAD_CONTEXT", "org.omg.CORBA.BAD_INV_ORDER",
-        "org.omg.CORBA.BAD_OPERATION", "org.omg.CORBA.BAD_PARAM",
-        "org.omg.CORBA.BAD_QOS", "org.omg.CORBA.BAD_TYPECODE",
-        "org.omg.CORBA.CODESET_INCOMPATIBLE", "org.omg.CORBA.COMM_FAILURE",
-        "org.omg.CORBA.DATA_CONVERSION", "org.omg.CORBA.FREE_MEM",
-        "org.omg.CORBA.IMP_LIMIT", "org.omg.CORBA.INITIALIZE",
-        "org.omg.CORBA.INTERNAL", "org.omg.CORBA.INTF_REPOS",
-        "org.omg.CORBA.INVALID_TRANSACTION", "org.omg.CORBA.INV_FLAG",
-        "org.omg.CORBA.INV_IDENT", "org.omg.CORBA.INV_OBJREF",
-        "org.omg.CORBA.INV_POLICY", "org.omg.CORBA.MARSHAL",
-        "org.omg.CORBA.NO_IMPLEMENT", "org.omg.CORBA.NO_MEMORY",
-        "org.omg.CORBA.NO_PERMISSION", "org.omg.CORBA.NO_RESOURCES",
-        "org.omg.CORBA.NO_RESPONSE", "org.omg.CORBA.OBJECT_NOT_EXIST",
-        "org.omg.CORBA.OBJ_ADAPTER", "org.omg.CORBA.PERSIST_STORE",
-        "org.omg.CORBA.REBIND", "org.omg.CORBA.TIMEOUT",
-        "org.omg.CORBA.TRANSACTION_MODE",
-        "org.omg.CORBA.TRANSACTION_REQUIRED",
-        "org.omg.CORBA.TRANSACTION_ROLLEDBACK",
-        "org.omg.CORBA.TRANSACTION_UNAVAILABLE", "org.omg.CORBA.TRANSIENT",
-        "org.omg.CORBA.UNKNOWN"};
-
-    private static final String[] NAMES = {
-        "BAD_CONTEXT", "BAD_INV_ORDER", "BAD_OPERATION", "BAD_PARAM",
-        "BAD_QOS", "BAD_TYPECODE", "CODESET_INCOMPATIBLE", "COMM_FAILURE",
-        "DATA_CONVERSION", "FREE_MEM", "IMP_LIMIT", "INITIALIZE", "INTERNAL",
-        "INTF_REPOS", "INVALID_TRANSACTION", "INV_FLAG", "INV_IDENT",
-        "INV_OBJREF", "INV_POLICY", "MARSHAL", "NO_IMPLEMENT", "NO_MEMORY",
-        "NO_PERMISSION", "NO_RESOURCES", "NO_RESPONSE", "OBJECT_NOT_EXIST",
-        "OBJ_ADAPTER", "PERSIST_STORE", "REBIND", "TIMEOUT",
-        "TRANSACTION_MODE", "TRANSACTION_REQUIRED", "TRANSACTION_ROLLEDBACK",
-        "TRANSACTION_UNAVAILABLE", "TRANSIENT", "UNKNOWN"};
-
     private static final String[] IDS = {
         "IDL:omg.org/CORBA/BAD_CONTEXT:1.0",
         "IDL:omg.org/CORBA/BAD_INV_ORDER:1.0",
@@ -127,11 +95,17 @@
         "IDL:omg.org/CORBA/TRANSACTION_UNAVAILABLE:1.0",
         "IDL:omg.org/CORBA/TRANSIENT:1.0", "IDL:omg.org/CORBA/UNKNOWN:1.0"};
 
-    private static TypeCode typeCode;
 
+    SystemException value;
+    TypeCode typeCode;
+    
     private SystemExceptionHelper() {
-        //utility class
     }
+    private SystemExceptionHelper(SystemException ex) {
+        value = ex;
+    }
+    
+    
 
     private static int binarySearch(String[] arr, String value) {
         int left = 0;
@@ -154,80 +128,13 @@
         return index;
     }
 
-    private static TypeCode createTypeCode(String id, String name) {
-        ORB orb = ORB.init();
-        StructMember[] members = new StructMember[2];
-        members[0] = new StructMember();
-        members[0].name = "minor";
-        members[0].type = orb.get_primitive_tc(TCKind.tk_ulong);
-        members[1] = new StructMember();
-        members[1].name = "completed";
-        members[1].type = CompletionStatusHelper.type();
-        return orb.create_exception_tc(id, name, members);
-    }
-
-    private static void writeImpl(org.omg.CORBA.portable.OutputStream out, 
-                                  SystemException val, String id) {
-        out.write_string(id);
-        out.write_ulong(val.minor);
-        out.write_ulong(val.completed.value());
-    }
 
     public static void insert(Any any, SystemException val) {
-        String className = val.getClass().getName();
-        int index = binarySearch(CLASSES, className);
-
-        String id;
-        if (index == -1) {
-            id = IDS[UNKNOWN];
-        } else {
-            id = IDS[index];
-        }
-
-        org.omg.CORBA.portable.OutputStream out = any.create_output_stream();
-        writeImpl(out, val, id);
-        any.read_value(out.create_input_stream(), createTypeCode(id, NAMES[index]));
-    }
-
-    public static SystemException extract(Any any) {
-        try {
-            TypeCode tc = any.type();
-            String id = tc.id();
-            if (tc.kind() == TCKind.tk_except && (id.length() == 0 || binarySearch(IDS, id) != -1)) {
-                return read(any.create_input_stream());
-            }
-        } catch (org.omg.CORBA.TypeCodePackage.BadKind ex) {
-            //ignore
-        }
-
-        throw new org.omg.CORBA.BAD_OPERATION();
-    }
-
-    public static synchronized TypeCode type() {
-        if (typeCode == null) {
-            typeCode = createTypeCode(id(), "SystemException");
-        }
-
-        return typeCode;
-    }
-
-    public static String id() {
-        return "IDL:omg.org/CORBA/SystemException:1.0";
-    }
-    public static void write(org.omg.CORBA.portable.OutputStream out, SystemException val) {
-        String className = val.getClass().getName();
-        int index = binarySearch(CLASSES, className);
-
-        String id;
-        if (index == -1) {
-            id = IDS[UNKNOWN];
-        } else {
-            id = IDS[index];
-        }
-
-        writeImpl(out, val, id);
+        any.insert_Streamable(new SystemExceptionHelper(val));
     }
 
+    
+    
     //CHECKSTYLE:OFF 
     //NCSS is to high for this due to the massive switch statement
     public static SystemException read(org.omg.CORBA.portable.InputStream in) {
@@ -350,5 +257,56 @@
         }
         return ex;
     }
+    //CHECKSTYLE:ON
+    
+    
+    
+    public void _read(InputStream instream) {
+        value = read(instream);
+    }
+    
+    public TypeCode _type() {
+        if (typeCode == null) {
+            ORB orb = ORB.init();
+            StructMember[] smBuf = new StructMember[2];
+            TypeCode minortc = orb.get_primitive_tc(TCKind.tk_long);
+            smBuf[0] = new StructMember("minor", minortc, null);
+
+            String csLabels[] = {"COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE"};
+            TypeCode completedtc = orb
+                .create_enum_tc("IDL:omg.org/CORBA/CompletionStatus:1.0",
+                              "CompletionStatus", csLabels);
+
+            smBuf[1] = new StructMember("completed", completedtc, null);
+            String id;
+            String name;
+            if (value == null) {
+                name = "SystemException";
+                id = "IDL:omg.org/CORBA/SystemException:1.0";
+            } else {
+                String className = value.getClass().getName();
+                name = className.substring(className.lastIndexOf('.') + 1);
+                id = "IDL:omg.org/CORBA/" + name + ":1.0";
+            }
+            
+            typeCode = orb.create_exception_tc(id, name, smBuf);
+        }
+        return typeCode;
+    }
+    public void _write(OutputStream outstream) {
+        String id;
+        if (value == null) {
+            value = new org.omg.CORBA.UNKNOWN();
+            id = "IDL:omg.org/CORBA/UNKNOWN";
+        } else {
+            String className = value.getClass().getName();
+            id = "IDL:omg.org/CORBA/" 
+                + className.substring(className.lastIndexOf('.') + 1) + ":1.0";
+        }
+
+        outstream.write_string(id);
+        outstream.write_ulong(value.minor);
+        outstream.write_ulong(value.completed.value());
+    }
 
 }

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServant.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServant.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServant.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaDSIServant.java Thu Aug  7 14:05:12 2008
@@ -114,15 +114,15 @@
         }
     }
 
-    protected MessageObserver getObserver() {
+    public MessageObserver getObserver() {
         return incomingObserver;
     }
     
-    protected void setObserver(MessageObserver observer) {
+    public void setObserver(MessageObserver observer) {
         incomingObserver = observer;
     }
     
-    protected ORB getOrb() {
+    public ORB getOrb() {
         return orb;
     }
 

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectReader.java Thu Aug  7 14:05:12 2008
@@ -21,6 +21,8 @@
 
 import java.lang.reflect.Array;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -50,7 +52,9 @@
 import org.apache.cxf.binding.corba.wsdl.Unionbranch;
 import org.apache.cxf.common.logging.LogUtils;
 import org.omg.CORBA.Any;
+import org.omg.CORBA.NO_IMPLEMENT;
 import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
 import org.omg.CORBA.portable.InputStream;
 
 public class CorbaObjectReader {
@@ -232,18 +236,20 @@
         }
     }
 
+    private BigInteger convertLongToULong(long l) {
+        if (l < 0) {
+            long l2 = l & 0x7FFFFFFFFFFFFFL;
+            BigInteger i = BigInteger.valueOf(l2);
+            BigInteger i2 = BigInteger.valueOf(0);
+            i2.setBit(63);
+            i = i.or(i2);
+            return i;
+        }
+        return BigInteger.valueOf(l);
+    }
     public BigInteger readULongLong() throws CorbaBindingException {
         try {
-            long l = stream.read_ulonglong();
-            if (l < 0) {
-                long l2 = l & 0x7FFFFFFFFFFFFFL;
-                BigInteger i = BigInteger.valueOf(l2);
-                BigInteger i2 = BigInteger.valueOf(0);
-                i2.setBit(63);
-                i = i.or(i2);
-                return i;
-            }
-            return BigInteger.valueOf(l);
+            return convertLongToULong(stream.read_ulonglong());
         } catch (org.omg.CORBA.MARSHAL ex) {
             LOG.log(Level.SEVERE, "CorbaObjectReader: could not read unsigned long long");
             throw new CorbaBindingException("CorbaObjectReader: readULongLong MARSHAL exception", ex);
@@ -328,9 +334,21 @@
     public void readFixed(CorbaObjectHandler obj) throws CorbaBindingException {
         CorbaFixedHandler fixedHandler = (CorbaFixedHandler)obj;
         long scale = fixedHandler.getScale();
-        
-        java.math.BigDecimal fixedValue = stream.read_fixed().movePointLeft((int)scale);
-        fixedHandler.setValue(fixedValue);
+        try {
+            java.math.BigDecimal fixedValue = stream.read_fixed().movePointLeft((int)scale);
+            fixedHandler.setValue(fixedValue);
+        } catch (NO_IMPLEMENT ex) {
+            //the read_fixed method is a "late addition" and not all orbs implement it.
+            //Some of them have a "read_fixed(TypeCode)" method, we'll try that
+            Method m = null;
+            try {
+                m = stream.getClass().getMethod("read_fixed", new Class[] {TypeCode.class});
+                BigDecimal fixedValue = (BigDecimal)m.invoke(stream, new Object[] {obj.getTypeCode()});
+                fixedHandler.setValue(fixedValue);
+            } catch (Throwable e1) {
+                throw ex;
+            }
+        }
     }
 
     public void readEnumDiscriminator(CorbaUnionHandler unionHandler, CorbaEnumHandler disc)
@@ -393,6 +411,7 @@
         }
     }
 
+    //CHECKSTYLE:OFF  -  processing the typecodes in a switch makes this method fairly long/complex
     public void readArray(CorbaObjectHandler obj) throws CorbaBindingException {
         CorbaArrayHandler arrayObj = (CorbaArrayHandler)obj;
         List<CorbaObjectHandler> arrayElements = arrayObj.getElements();
@@ -446,7 +465,12 @@
             case TCKind._tk_ulong: {
                 int[] values = new int[arraySize];
                 stream.read_ulong_array(values, 0, arraySize);
-                val = values;
+                long[] v2 = new long[arraySize];
+                for (int x = 0; x < arraySize; x++) {
+                    v2[x] = values[x];
+                    v2[x] &= 0xFFFFFFFFL;
+                }
+                val = v2;
                 break;
             }
             case TCKind._tk_longlong: {
@@ -458,7 +482,11 @@
             case TCKind._tk_ulonglong: {
                 long[] values = new long[arraySize];
                 stream.read_ulonglong_array(values, 0, arraySize);
-                val = values;
+                BigInteger[] v2 = new BigInteger[arraySize];
+                for (int x = 0; x < arraySize; x++) {
+                    v2[x] = convertLongToULong(values[x]);
+                }
+                val = v2;
                 break;
             }
             case TCKind._tk_float: {
@@ -486,7 +514,8 @@
             }
         }
     }
-    
+    //CHECKSTYLE:ON
+
     public void readSequence(CorbaObjectHandler obj) throws CorbaBindingException {
         if (obj instanceof CorbaOctetSequenceHandler) {
             int length = stream.read_ulong();

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/runtime/CorbaObjectWriter.java Thu Aug  7 14:05:12 2008
@@ -18,6 +18,8 @@
  */
 package org.apache.cxf.binding.corba.runtime;
 
+import java.lang.reflect.Method;
+import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.List;
 
@@ -297,8 +299,18 @@
 
     public void writeFixed(CorbaObjectHandler obj) throws CorbaBindingException {
         CorbaFixedHandler fixedHandler = (CorbaFixedHandler)obj;
-        long scale = fixedHandler.getScale();
-        stream.write_fixed(fixedHandler.getValue().movePointRight((int)scale));
+        short scale = (short)fixedHandler.getScale();
+        short fixed = (short)fixedHandler.getDigits();
+        //the write_fixed method is a "late addition" and not all orbs implement it.
+        //Some of them have a "write_fixed(BigDecimal, short, short)" method, we'll try that
+        try {
+            Method m = stream.getClass().getMethod("write_fixed", new Class[] {BigDecimal.class,
+                                                                               Short.TYPE,
+                                                                               Short.TYPE});
+            m.invoke(stream, fixedHandler.getValue(), fixed, scale);
+        } catch (Throwable e1) {
+            stream.write_fixed(fixedHandler.getValue().movePointRight(scale));
+        }
     }
 
     public void writeUnion(CorbaObjectHandler obj) throws CorbaBindingException {

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/CorbaPrimitiveHandler.java Thu Aug  7 14:05:12 2008
@@ -29,6 +29,7 @@
 
     private static final int UNSIGNED_MAX = 256; 
     private Object value;
+    private String valueAsString;
     private boolean objectSet;
     private Any any;
     
@@ -39,6 +40,9 @@
     public Object getValue() {
         return value;
     }
+    public Any getAny() {
+        return any;
+    }
     
     public void setIntoAny(Any val, CorbaStreamable stream, boolean output) {
         any = val;
@@ -108,6 +112,9 @@
         if (!objectSet && any != null) {
             return getDataFromAny();
         }
+        if (valueAsString != null) {
+            return valueAsString;
+        }
         String data = "";
 
         switch (this.typeCode.kind().value()) {
@@ -169,6 +176,7 @@
             // it needs.
             data = value.toString();
         }
+        valueAsString = data;
         return data;
     }
     
@@ -244,6 +252,10 @@
     }
     public String getDataFromAny() {
         String data = "";
+        if (valueAsString != null) {
+            return valueAsString;
+        }
+
         switch (this.typeCode.kind().value()) {
         case TCKind._tk_boolean:
             data = any.extract_boolean() ? "true" : "false";
@@ -305,10 +317,13 @@
             //should not get here
             throw new RuntimeException("Unknown tc: " + this.typeCode);
         }
+        valueAsString = data;
         return data;
     }
     
     public void clear() {
         value = null;
+        objectSet = false;
+        valueAsString = null;
     }
 }

Modified: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/HandlerIterator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/HandlerIterator.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/HandlerIterator.java (original)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/types/HandlerIterator.java Thu Aug  7 14:05:12 2008
@@ -49,6 +49,12 @@
                     || mode == org.omg.CORBA.ARG_INOUT.value) {
                     next = params[count].getObject();
                 }
+                if (!isServer 
+                    && mode == org.omg.CORBA.ARG_INOUT.value
+                    && next instanceof CorbaPrimitiveHandler) {
+                    CorbaPrimitiveHandler prim = (CorbaPrimitiveHandler)next;
+                    prim.clear();
+                }
                 count++;
             }
         }

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=683714&r1=683713&r2=683714&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 Thu Aug  7 14:05:12 2008
@@ -21,10 +21,10 @@
 
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Logger;
 
 import org.apache.cxf.binding.corba.CorbaBindingException;
@@ -34,8 +34,8 @@
 public final class CorbaBindingHelper {
 
     private static final Logger LOG = LogUtils.getL7dLogger(CorbaBindingHelper.class);
-    private static Map<String, ORB> orbList = new ConcurrentHashMap<String, ORB>();
-    private static Map<String, Integer> orbUseCount = new ConcurrentHashMap<String, Integer>();
+    private static Map<String, ORB> orbList = new HashMap<String, ORB>();
+    private static Map<String, Integer> orbUseCount = new HashMap<String, Integer>();
     private static ORB defaultORB;
     
     private CorbaBindingHelper() {
@@ -61,7 +61,19 @@
         return defaultORB;
     }
     
-    public static ORB createAddressSpecificORB(String address, OrbConfig config) {
+    public static synchronized ORB getAddressSpecificORB(String address, 
+                                                         Properties props, 
+                                                         List<String> orbArgs) {
+        ORB orb = orbList.get(getORBNameFromAddress(address));
+        if (orb == null) {
+            orb = createAddressSpecificORB(address, props, orbArgs);
+        }
+        return orb;
+    }
+
+    private static ORB createAddressSpecificORB(String address, 
+                                                Properties props, 
+                                                List<String> orbArgs) {
         ORB orb = null;
         
         URI addressURI = null;
@@ -71,15 +83,6 @@
             throw new CorbaBindingException("Unable to create ORB with address " + address);
         }
 
-        Properties props = System.getProperties();
-        if (config.getOrbClass() != null) {
-            props.put("org.omg.CORBA.ORBClass", config.getOrbClass());
-        }
-        if (config.getOrbSingletonClass() != null) {
-            props.put("org.omg.CORBA.ORBSingletonClass", config.getOrbSingletonClass());
-        }
-        List<String> orbArgs = config.getOrbArgs();
-        
         String scheme = addressURI.getScheme();
         // A corbaloc address gives us host and port information to use when setting up the
         // endpoint for the ORB.  Other types of references will just create ORBs on the 
@@ -124,15 +127,9 @@
         return orb;
     }
     
-    public static ORB getAddressSpecificORB(String address) {
-        return orbList.get(getORBNameFromAddress(address));
-    }
 
-    public static void addAddressSpecificORB(String address, ORB orb) {
-        orbList.put(getORBNameFromAddress(address), orb);
-    }
     
-    public static String getORBNameFromAddress(String address) {
+    private static String getORBNameFromAddress(String address) {
         String name = null;
        
         URI addressURI = null;
@@ -173,7 +170,7 @@
 
     // This indicates that we need to keep the ORB alive.  This allows multiple objects to share the
     // same ORB and not have one of the objects destroy it while other objects are using it.
-    public static void keepORBAlive(String address) {
+    public static synchronized void keepORBAlive(String address) {
         Integer count = orbUseCount.get(getORBNameFromAddress(address));
 
         if (count == null) {
@@ -186,7 +183,7 @@
     // Signals that the ORB should be tested to see if it can be destroyed.  Actual destruction will
     // only occur if the ORB is not being used by someone else.  If it is, then we simply decrement
     // the count.
-    public static void destroyORB(String address, ORB orb) throws CorbaBindingException {
+    public static synchronized void destroyORB(String address, ORB orb) throws CorbaBindingException {
         Integer count = orbUseCount.get(getORBNameFromAddress(address));
 
         if (count == null) {
@@ -207,7 +204,6 @@
         } else {
             orbUseCount.put(getORBNameFromAddress(address), count);
         }
-
     }
 
 }

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=683714&r1=683713&r2=683714&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 Thu Aug  7 14:05:12 2008
@@ -18,19 +18,12 @@
  */
 package org.apache.cxf.binding.corba.utils;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Stack;
-import java.util.StringTokenizer;
 import java.util.logging.Logger;
 
 import javax.xml.namespace.QName;
@@ -38,7 +31,6 @@
 import org.apache.cxf.binding.corba.CorbaBindingException;
 import org.apache.cxf.binding.corba.CorbaStreamable;
 import org.apache.cxf.binding.corba.CorbaTypeMap;
-import org.apache.cxf.binding.corba.wsdl.AddressType;
 import org.apache.cxf.binding.corba.wsdl.Alias;
 import org.apache.cxf.binding.corba.wsdl.Anonarray;
 import org.apache.cxf.binding.corba.wsdl.Anonfixed;
@@ -76,9 +68,6 @@
 import org.omg.CORBA.TCKind;
 import org.omg.CORBA.TypeCode;
 import org.omg.CORBA.UnionMember;
-import org.omg.CosNaming.NameComponent;
-import org.omg.CosNaming.NamingContext;
-import org.omg.CosNaming.NamingContextHelper;
 
 public final class CorbaUtils {
 
@@ -444,7 +433,7 @@
             map = new CorbaTypeMap(tmType.getTargetNamespace());
 
             List<CorbaTypeImpl> types = tmType.getStructOrExceptionOrUnion();
-            LOG.info("Found " + types.size() + " types defined in the typemap");
+            LOG.fine("Found " + types.size() + " types defined in the typemap");
             for (Iterator<CorbaTypeImpl> it = types.iterator(); it.hasNext();) {
                 CorbaTypeImpl corbaType = it.next();
                 String name = corbaType.getName();
@@ -458,7 +447,7 @@
                 }
                     
                 map.addType(name, corbaType);
-                LOG.info("Adding type " + name);
+                LOG.fine("Adding type " + name);
             }
         }
         return map;
@@ -508,152 +497,6 @@
         return ior;
     }
 
-    public static void exportObjectReference(ORB orb,
-                                             org.omg.CORBA.Object ref,
-                                             String url,
-                                             AddressType address,
-                                             OrbConfig config) 
-        throws URISyntaxException, IOException {
-        
-        if ((url.startsWith("ior:")) || (url.startsWith("IOR:"))) {
-            // make use of Thread cache of last exported IOR
-            String ior = exportObjectReference(ref, orb);
-            address.setLocation(ior);
-        } else if (url.startsWith("file:")) {
-            URI uri = new URI(url);
-            exportObjectReferenceToFile(orb, ref, uri);
-        } else if (url.startsWith("relfile:")) {
-            URI uri = new URI(url.substring(3));
-            exportObjectReferenceToFile(orb, ref, uri);
-        } else if (url.startsWith("corbaloc:")) {
-            config.exportObjectReferenceToCorbaloc(orb, ref, url);
-        } else if (url.startsWith("corbaname:")) {
-            int hashPos = url.lastIndexOf("#");
-        
-            String namingServiceLocation;
-            String path;
-
-            if (hashPos == -1) {
-                namingServiceLocation = "corbaloc:" + url.substring(10);
-                path = url;
-            } else {
-                namingServiceLocation = "corbaloc:" + url.substring(10, hashPos - 12);
-                path = url.substring(hashPos + 1);
-            }
-
-            int nameServiceObjectKeyPos = namingServiceLocation.indexOf("/NameService");
-
-            if (nameServiceObjectKeyPos == -1
-                || nameServiceObjectKeyPos != namingServiceLocation.length() - 12) {
-                namingServiceLocation += "/NameService";
-            }
-
-            exportObjectReferenceToNamingService(orb,
-                                                 namingServiceLocation,
-                                                 ref,
-                                                 path);
-        } else {
-            String ior = orb.object_to_string(ref);
-            address.setLocation(ior);
-            URI uri = new URI("endpoint.ior");
-            CorbaUtils.exportObjectReferenceToFile(orb, ref, uri);
-        }
-    }
-
-
-    public static void exportObjectReferenceToFile(ORB orb,
-                                                   org.omg.CORBA.Object obj,
-                                                   URI iorFile) 
-        throws IOException {
-        String ref = orb.object_to_string(obj);
-        File f = null;
-        if (iorFile.isOpaque()) {
-            f = new File(iorFile.getSchemeSpecificPart());
-        } else {
-            f = new File(iorFile);
-        }
-        FileOutputStream file = new FileOutputStream(f);
-        PrintWriter out = new PrintWriter(file);
-        out.println(ref);
-        out.flush();
-        file.close();
-    }
-
-    private static void exportObjectReferenceToNamingService(NamingContext namingService,
-                                                             org.omg.CORBA.Object object,
-                                                             String path) {
-        NameComponent[] names = namingServiceStringToNameComponents(path);
-
-
-        // (re)bind the object into the Naming Service
-        //
-        try {
-            namingService.rebind(names, object);
-        } catch (Throwable t) {
-            throw new RuntimeException(t);
-        }
-    }
-
-    private static NameComponent[] namingServiceStringToNameComponents(String str) {
-        if ("".equals(str)) {
-            return new NameComponent[0];
-        }
-
-        // Split the string into NameComponents, delimited by '/'
-        //
-        StringTokenizer components = new StringTokenizer(str, "/");
-        if (!components.hasMoreTokens()) {
-            return new NameComponent[0];
-        }
-
-        // Allocate space for the result
-        //
-        NameComponent[] result = new NameComponent[components.countTokens()];
-
-        if (components.countTokens() == 1) {
-            result[0] = new NameComponent(str, "");
-            return result;
-        }
-        
-        // Iterate over all the components, splitting each into
-        // its "id" and "kind" fields, and copying into "result".
-        //
-        int count = 0;
-        while (components.hasMoreTokens()) {
-            StringTokenizer idAndKind = new StringTokenizer(components.nextToken(), ".");
-            if (!idAndKind.hasMoreTokens()) {
-                return new NameComponent[0];
-            }
-            if (idAndKind.countTokens() > 2) {
-                return new NameComponent[0];
-            }
-            result[count] = new NameComponent();
-            result[count].id = idAndKind.nextToken().replaceAll("\\", "");
-            if (idAndKind.hasMoreTokens()) {
-                result[count].kind = idAndKind.nextToken().replaceAll("\\", "");
-            } else {
-                result[count].kind = "";
-            }
-            count++;
-        }
-
-        return result;
-    }
-
-
-    private static void exportObjectReferenceToNamingService(ORB orb,
-                                                             String namingServiceLocation,
-                                                             org.omg.CORBA.Object object,
-                                                             String path) {
-        org.omg.CORBA.Object obj = orb.string_to_object(namingServiceLocation);
-        NamingContext namingService = NamingContextHelper.narrow(obj);
-        if (namingService == null) {
-            throw new RuntimeException("NamingContext for " + namingServiceLocation + " not found");
-        }
-        exportObjectReferenceToNamingService(namingService,
-                                             object,
-                                             path);
-    }
 
 
     public static org.omg.CORBA.Object importObjectReference(ORB orb,

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=683714&r1=683713&r2=683714&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 Thu Aug  7 14:05:12 2008
@@ -19,22 +19,34 @@
 
 package org.apache.cxf.binding.corba.utils;
 
+import java.io.File;
+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.ArrayList;
 import java.util.List;
 
 import org.apache.cxf.binding.corba.CorbaBindingException;
+import org.apache.cxf.binding.corba.interceptors.SystemExceptionHelper;
+import org.apache.cxf.binding.corba.wsdl.AddressType;
+import org.omg.CORBA.Any;
 import org.omg.CORBA.ORB;
 import org.omg.CORBA.Policy;
+import org.omg.CORBA.SystemException;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAManager;
 
 public class OrbConfig {
 
-    String orbClass;
-    String orbSingletonClass;
-    List<String> orbArgs = new ArrayList<String>();
-    List<Policy> policies = new ArrayList<Policy>();
-    
-    boolean persistentPoa;
+    protected String orbClass;
+    protected String orbSingletonClass;
+    protected List<String> orbArgs = new ArrayList<String>();
     
     public OrbConfig() {
         //nothing
@@ -64,18 +76,67 @@
         return orbArgs;
     }
     
-    public void setPersistentPoa(boolean b) {
-        persistentPoa = b;
-    }
-    public boolean isPersistentPoa() {
-        return persistentPoa;
-    }
     
-    public List<Policy> getExtraPolicies() {
-        return policies;
+    public void addPOAPolicies(ORB orb, 
+                               String poaName,
+                               POA parentPOA,
+                               POAManager poaManager,
+                               List<Policy> policies) {
+        //nothing
     }
     
     
+    public Any createSystemExceptionAny(ORB orb, SystemException sysEx) {
+        Any exAny = orb.create_any();
+        SystemExceptionHelper.insert(exAny, sysEx);
+        return exAny;
+    }
+    
+    public void exportObjectReference(ORB orb,
+                                       org.omg.CORBA.Object ref,
+                                       String url,
+                                       AddressType address) 
+        throws URISyntaxException, IOException {
+        
+        if ((url.startsWith("ior:")) || (url.startsWith("IOR:"))) {
+            // make use of Thread cache of last exported IOR
+            String ior = CorbaUtils.exportObjectReference(ref, orb);
+            address.setLocation(ior);
+        } else if (url.startsWith("file:")) {
+            URI uri = new URI(url);
+            exportObjectReferenceToFile(orb, ref, uri);
+        } else if (url.startsWith("relfile:")) {
+            URI uri = new URI(url.substring(3));
+            exportObjectReferenceToFile(orb, ref, uri);
+        } else if (url.startsWith("corbaloc:")) {
+            exportObjectReferenceToCorbaloc(orb, ref, url);
+        } else if (url.startsWith("corbaname:")) {
+            exportObjectReferenceToNamingService(orb,
+                                                 ref,
+                                                 url);
+        } else {
+            String ior = orb.object_to_string(ref);
+            address.setLocation(ior);
+            URI uri = new URI("endpoint.ior");
+            exportObjectReferenceToFile(orb, ref, uri);
+        }
+    }
+    public void exportObjectReferenceToNamingService(ORB orb,
+                                                     org.omg.CORBA.Object ref,
+                                                     String location) {
+        int idx = location.indexOf("#");
+        String name = location.substring(idx + 1);
+        
+        //Register in NameService
+        try {
+            org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
+            NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
+            NameComponent[] nc = rootContext.to_name(name);
+            rootContext.rebind(nc, ref);
+        } catch (Exception ex) {
+            throw new CorbaBindingException(ex);
+        }
+    }
     public void exportObjectReferenceToCorbaloc(ORB orb,
                                                 org.omg.CORBA.Object object,
                                                 String location) {
@@ -100,4 +161,23 @@
         }
     }
 
+
+    public void exportObjectReferenceToFile(ORB orb,
+                                              org.omg.CORBA.Object obj,
+                                              URI iorFile) 
+        throws IOException {
+        String ref = orb.object_to_string(obj);
+        File f = null;
+        if (iorFile.isOpaque()) {
+            f = new File(iorFile.getSchemeSpecificPart());
+        } else {
+            f = new File(iorFile);
+        }
+        FileOutputStream file = new FileOutputStream(f);
+        PrintWriter out = new PrintWriter(file);
+        out.println(ref);
+        out.flush();
+        file.close();
+    }
+
 }

Added: cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java?rev=683714&view=auto
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java (added)
+++ cxf/trunk/rt/bindings/corba/src/main/java/org/apache/cxf/binding/corba/wsdl/WSDLExtensionRegister.java Thu Aug  7 14:05:12 2008
@@ -0,0 +1,73 @@
+/**
+ * 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.wsdl;
+
+import javax.annotation.PostConstruct;
+import javax.annotation.Resource;
+import javax.xml.bind.JAXBException;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.wsdl.JAXBExtensionHelper;
+import org.apache.cxf.wsdl.TExtensibilityElementImpl;
+import org.apache.cxf.wsdl.WSDLManager;
+
+/**
+ * 
+ */
+public final class WSDLExtensionRegister {
+    private static final String YOKO_NAMESPACE = "http://schemas.apache.org/yoko/bindings/corba";
+
+    Bus bus;
+    
+    @Resource
+    public void setBus(Bus b) {
+        bus = b;
+    }
+    
+    @PostConstruct
+    void registerYokoCompatibleExtensors() {
+        WSDLManager manager = bus.getExtension(WSDLManager.class);
+        createCompatExtensor(manager, javax.wsdl.Binding.class,
+                             org.apache.cxf.binding.corba.wsdl.BindingType.class);
+        createCompatExtensor(manager, javax.wsdl.BindingOperation.class,
+                             org.apache.cxf.binding.corba.wsdl.OperationType.class);
+        createCompatExtensor(manager, javax.wsdl.Definition.class,
+                             org.apache.cxf.binding.corba.wsdl.TypeMappingType.class);
+        createCompatExtensor(manager, javax.wsdl.Port.class,
+                             org.apache.cxf.binding.corba.wsdl.AddressType.class);
+        createCompatExtensor(manager, javax.wsdl.Port.class,
+                             org.apache.cxf.binding.corba.wsdl.PolicyType.class);
+    }
+
+    private void createCompatExtensor(WSDLManager manager,
+                                      Class<?> parentType,
+                                      Class<? extends TExtensibilityElementImpl> elementType) {
+        try {
+            JAXBExtensionHelper.addExtensions(manager.getExtensionRegistry(),
+                                              parentType, 
+                                              elementType,
+                                              YOKO_NAMESPACE);
+        } catch (JAXBException e) {
+            //ignore, just won't support the yoko extensors
+        }
+        
+    }
+
+}

Modified: cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml (original)
+++ cxf/trunk/rt/bindings/corba/src/main/resources/META-INF/cxf/cxf-extension-corba.xml Thu Aug  7 14:05:12 2008
@@ -35,10 +35,12 @@
         </property>
         <property name="transportIds">
             <list>
-		        <value>http://cxf.apache.org/bindings/corba</value>
-	            <value>http://schemas.apache.org/yoko/bindings/corba</value>
+		<value>http://cxf.apache.org/bindings/corba</value>
+	        <value>http://schemas.apache.org/yoko/bindings/corba</value>
             </list>
         </property>
     </bean>
+    
+    <bean class="org.apache.cxf.binding.corba.wsdl.WSDLExtensionRegister" lazy-init="false"/>
 
 </beans>

Modified: cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaBindingFactoryTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaBindingFactoryTest.java?rev=683714&r1=683713&r2=683714&view=diff
==============================================================================
--- cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaBindingFactoryTest.java (original)
+++ cxf/trunk/rt/bindings/corba/src/test/java/org/apache/cxf/binding/corba/CorbaBindingFactoryTest.java Thu Aug  7 14:05:12 2008
@@ -60,7 +60,6 @@
     
     @Before
     public void setUp() throws Exception {
-        System.setProperty("cxf.config.file", "cxf-extension-corba.xml");
         bus = BusFactory.getDefaultBus();       
         BindingFactoryManager bfm = bus.getExtension(BindingFactoryManager.class);        
         factory = (CorbaBindingFactory)bfm.getBindingFactory("http://cxf.apache.org/bindings/corba");



Mime
View raw message