Author: jkaputin
Date: Thu Nov 16 05:22:46 2006
New Revision: 475725

URL: http://svn.apache.org/viewvc?view=rev&rev=475725
Log:
WODEN-89 binding extensions are now created depending 
on binding 'type' attribute, not on the presence
of extension attribute namespaces in the WSDL.

Modified:
    
incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java

Modified: 
incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
URL: 
http://svn.apache.org/viewvc/incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java?view=diff&rev=475725&r1=475724&r2=475725
==============================================================================
--- 
incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
 (original)
+++ 
incubator/woden/trunk/java/src/org/apache/woden/internal/util/ComponentModelBuilder.java
 Thu Nov 16 05:22:46 2006
@@ -405,316 +405,54 @@
        private void buildBindingExtensions(BindingImpl binding) {
         
         /*
-         * Create a ComponentExtensions object for each registered extension
-         * namespace used within this binding by extension elements or 
attributes.
+         * Create a ComponentExtensions subtype specific to the binding type.
          */
-               ExtensionRegistry er = fDesc.getExtensionRegistry();
-               URI[] extNamespaces = er
-                               
.queryComponentExtensionNamespaces(Binding.class);
-
-               for (int i = 0; i < extNamespaces.length; i++) {
-                       URI extNS = extNamespaces[i];
-                       if (binding.hasExtensionAttributesForNamespace(extNS)
-                                       || 
binding.hasExtensionElementsForNamespace(extNS)) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               Binding.class, binding, extNS);
-                               binding.setComponentExtensions(extNS, compExt);
-                       }
-               }
-
-               /*
-                * Second, apply the rules from WSDL 2.0 Part 2 Adjuncts spec 
for
-                * default values for SOAP and HTTP extension properties to 
create
-                * ComponentExtension objects even if the related extension 
attributes
-                * or elements do not exist in the WSDL.
-                * 
-                * TODO chg this hardcoded behaviour so that any default rules 
for SOAP,
-                * HTTP or user-defined extensions can be registered in some 
way and
-                * interpreted here at run time.
-                */
-               if (ComponentExtensions.URI_NS_SOAP.equals(binding.getType())) {
-            
-            fBindingType = ComponentExtensions.URI_NS_SOAP;
-            
-                       /*
-                        * If the binding type is SOAP and a 
SOAPBindingExtensions object has
-             * not already been created, create one now.
-                        */
-                       if (binding
-                                       
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               Binding.class, binding, 
ComponentExtensions.URI_NS_SOAP);
-                               
binding.setComponentExtensions(ComponentExtensions.URI_NS_SOAP,
-                                               compExt);
-                       }
-
-                       SOAPBindingExtensions sbe = (SOAPBindingExtensions) 
binding
-                                       
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP);
-
-            URI soapUnderlyingProtocol = sbe.getSoapUnderlyingProtocol();
-            String protocol = soapUnderlyingProtocol != null ? 
soapUnderlyingProtocol.toString() : null;
-                       if (SOAPConstants.PROTOCOL_URI_HTTP.equals(protocol)) {
-                
-                fIsSoapUnderlyingProtocolHttp = true;
-                
-                               /*
-                                * If the binding type is SOAP and the {soap 
underlying protocol}
-                 * property is HTTP, then if an HTTPBindingExtensions object 
has
-                                * not already been created, create one now.
-                                */
-                               if (binding
-                                               
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                                       ComponentExtensions compExt = 
createComponentExtensions(
-                                                       Binding.class, binding,
-                                                       
ComponentExtensions.URI_NS_HTTP);
-                                       binding.setComponentExtensions(
-                                                       
ComponentExtensions.URI_NS_HTTP, compExt);
-                               }
-                       }
-               }
-
-               if (ComponentExtensions.URI_NS_HTTP.equals(binding.getType())) {
-            
-            fBindingType = ComponentExtensions.URI_NS_HTTP;
-            
-                       /*
-                        * If the binding type is HTTP, then if an 
HTTPBindingExtensions 
-             * object has not already been created, create one now.
-                        */
-                       if (binding
-                                       
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               Binding.class, binding, 
ComponentExtensions.URI_NS_HTTP);
-                               
binding.setComponentExtensions(ComponentExtensions.URI_NS_HTTP,
-                                               compExt);
-                       }
-               }
-
+        
+        fBindingType = binding.getType();
+        if(fBindingType != null) {
+            ComponentExtensions compExt = createComponentExtensions(
+                    Binding.class, binding, fBindingType);
+            binding.setComponentExtensions(fBindingType, compExt);
+        }
        }
 
        private void buildBindingFaultExtensions(BindingFaultImpl bindFault) {
         
         /*
-         * Create a ComponentExtensions object for each registered extension
-         * namespace used within this binding fault by extension elements 
-         * or attributes.
+         * Create a ComponentExtensions subtype specific to the binding type.
          */
-               ExtensionRegistry er = fDesc.getExtensionRegistry();
-               URI[] extNamespaces = er
-                               
.queryComponentExtensionNamespaces(BindingFault.class);
-
-               for (int i = 0; i < extNamespaces.length; i++) {
-                       URI extNS = extNamespaces[i];
-                       if (bindFault.hasExtensionAttributesForNamespace(extNS)
-                                       || 
bindFault.hasExtensionElementsForNamespace(extNS)) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingFault.class, bindFault, 
extNS);
-                               bindFault.setComponentExtensions(extNS, 
compExt);
-                       }
-               }
-
-               /*
-                * Second, apply the rules from WSDL 2.0 Part 2 Adjuncts spec 
for
-                * default values for SOAP and HTTP extension properties to 
create
-                * ComponentExtension objects even if the related extension 
attributes
-                * or elements do not exist in the WSDL.
-                * 
-                * TODO chg this hardcoded behaviour so that any default rules 
for SOAP,
-                * HTTP or user-defined extensions can be registered in some 
way and
-                * interpreted here at run time.
-                */
-               if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) {
-                       /*
-                        * If the binding type is SOAP and a 
SOAPBindingFaultExtensions object
-             * has not already been created, create one now.
-                        */
-                       if (bindFault
-                                       
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingFault.class, bindFault,
-                                               
ComponentExtensions.URI_NS_SOAP);
-                               bindFault.setComponentExtensions(
-                                               
ComponentExtensions.URI_NS_SOAP, compExt);
-                       }
-            
-            if (fIsSoapUnderlyingProtocolHttp) {
-                /*
-                 * If the binding type is SOAP and the {soap underlying 
protocol}
-                 * property is HTTP, then if an HTTPBindingFaultExtensions 
object
-                 * has not already been created, create one now.
-                 */
-                if (bindFault
-                        
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                    ComponentExtensions compExt = createComponentExtensions(
-                            BindingFault.class, bindFault,
-                            ComponentExtensions.URI_NS_HTTP);
-                    bindFault.setComponentExtensions(
-                            ComponentExtensions.URI_NS_HTTP, compExt);
-                }
-            }
-               }
-
-               if (ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) {
-                       /*
-                        * If the binding type is HTTP and an 
HTTPBindingFaultExtensions object 
-             * has not already been created, create one now.
-                        */
-                       if (bindFault
-                                       
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingFault.class, bindFault,
-                                               
ComponentExtensions.URI_NS_HTTP);
-                               bindFault.setComponentExtensions(
-                                               
ComponentExtensions.URI_NS_HTTP, compExt);
-                       }
-               }
-
+        
+        if(fBindingType != null) {
+            ComponentExtensions compExt = createComponentExtensions(
+                    BindingFault.class, bindFault, fBindingType);
+            bindFault.setComponentExtensions(fBindingType, compExt);
+        }
        }
 
        private void buildBindingOperationExtensions(BindingOperationImpl 
bindOper) {
         
         /*
-         * Create a ComponentExtensions object for each registered extension
-         * namespace used within this binding operation by extension elements 
-         * or attributes.
+         * Create a ComponentExtensions subtype specific to the binding type.
          */
-               ExtensionRegistry er = fDesc.getExtensionRegistry();
-               URI[] extNamespaces = er
-                               
.queryComponentExtensionNamespaces(BindingOperation.class);
-
-               for (int i = 0; i < extNamespaces.length; i++) {
-                       URI extNS = extNamespaces[i];
-                       if (bindOper.hasExtensionAttributesForNamespace(extNS)
-                                       || 
bindOper.hasExtensionElementsForNamespace(extNS)) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingOperation.class, 
bindOper, extNS);
-                               bindOper.setComponentExtensions(extNS, compExt);
-                       }
-               }
-
-               /*
-                * Second, apply the rules from WSDL 2.0 Part 2 Adjuncts spec 
for
-                * default values for SOAP and HTTP extension properties to 
create
-                * ComponentExtension objects even if the related extension 
attributes
-                * or elements do not exist in the WSDL.
-                * 
-                * TODO chg this hardcoded behaviour so that any default rules 
for SOAP,
-                * HTTP or user-defined extensions can be registered in some 
way and
-                * interpreted here at run time.
-                */
-        if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) {
-            /*
-             * If the binding type is SOAP and a 
SOAPBindingOperationExtensions object
-             * has not already been created, create one now.
-             */
-            if (bindOper
-                    
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) {
-                ComponentExtensions compExt = createComponentExtensions(
-                        BindingOperation.class, bindOper,
-                        ComponentExtensions.URI_NS_SOAP);
-                bindOper.setComponentExtensions(
-                        ComponentExtensions.URI_NS_SOAP, compExt);
-            }
-            
-            if (fIsSoapUnderlyingProtocolHttp) {
-                /*
-                 * If the binding type is SOAP and the {soap underlying 
protocol}
-                 * property is HTTP, then if an HTTPBindingOperationExtensions 
object
-                 * has not already been created, create one now.
-                 */
-                if (bindOper
-                        
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                    ComponentExtensions compExt = createComponentExtensions(
-                            BindingOperation.class, bindOper,
-                            ComponentExtensions.URI_NS_HTTP);
-                    bindOper.setComponentExtensions(
-                            ComponentExtensions.URI_NS_HTTP, compExt);
-                }
-            }
-        }
         
-               if (ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) {
-                       /*
-                        * If the binding type is HTTP and an 
HTTPBindingOperationExtensions
-             * object has not already been created, create one now.
-                        */
-                       if (bindOper
-                                       
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingOperation.class, 
bindOper,
-                                               
ComponentExtensions.URI_NS_HTTP);
-                               bindOper.setComponentExtensions(
-                                               
ComponentExtensions.URI_NS_HTTP, compExt);
-                       }
-               }
+        if(fBindingType != null) {
+            ComponentExtensions compExt = createComponentExtensions(
+                    BindingOperation.class, bindOper, fBindingType);
+            bindOper.setComponentExtensions(fBindingType, compExt);
+        }
        }
 
        private void buildBindingMessageReferenceExtensions(
                        BindingMessageReferenceImpl bindMsgRef) {
         
         /*
-         * Create a ComponentExtensions object for each registered extension
-         * namespace used within this binding message reference by extension 
-         * elements or attributes.
+         * Create a ComponentExtensions subtype specific to the binding type.
          */
-               ExtensionRegistry er = fDesc.getExtensionRegistry();
-               URI[] extNamespaces = er
-                               
.queryComponentExtensionNamespaces(BindingMessageReference.class);
-
-               for (int i = 0; i < extNamespaces.length; i++) {
-                       URI extNS = extNamespaces[i];
-                       if (bindMsgRef.hasExtensionAttributesForNamespace(extNS)
-                                       || 
bindMsgRef.hasExtensionElementsForNamespace(extNS)) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingMessageReference.class, 
bindMsgRef, extNS);
-                               bindMsgRef.setComponentExtensions(extNS, 
compExt);
-                       }
-               }
         
-        if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) {
-            /*
-             * If the binding type is SOAP and a 
SOAPBindingMessageReferenceExtensions 
-             * object has not already been created, create one now.
-             */
-            if (bindMsgRef
-                    
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) {
-                ComponentExtensions compExt = createComponentExtensions(
-                        BindingMessageReference.class, bindMsgRef,
-                        ComponentExtensions.URI_NS_SOAP);
-                bindMsgRef.setComponentExtensions(
-                        ComponentExtensions.URI_NS_SOAP, compExt);
-            }
-            
-            if (fIsSoapUnderlyingProtocolHttp) {
-                /*
-                 * If the binding type is SOAP and the {soap underlying 
protocol}
-                 * property is HTTP, then if an 
HTTPBindingMessageReferenceExtensions 
-                 * object has not already been created, create one now.
-                 */
-                if (bindMsgRef
-                        
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                    ComponentExtensions compExt = createComponentExtensions(
-                            BindingMessageReference.class, bindMsgRef,
-                            ComponentExtensions.URI_NS_HTTP);
-                    bindMsgRef.setComponentExtensions(
-                            ComponentExtensions.URI_NS_HTTP, compExt);
-                }
-            }
-        }
-        
-        if (ComponentExtensions.URI_NS_HTTP.equals(fBindingType)) {
-            /*
-             * If the binding type is HTTP and an 
HTTPBindingMessageReferenceExtensions
-             * object has not already been created, create one now.
-             */
-            if (bindMsgRef
-                    
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_HTTP) == null) {
-                ComponentExtensions compExt = createComponentExtensions(
-                        BindingMessageReference.class, bindMsgRef,
-                        ComponentExtensions.URI_NS_HTTP);
-                bindMsgRef.setComponentExtensions(
-                        ComponentExtensions.URI_NS_HTTP, compExt);
-            }
+        if(fBindingType != null) {
+            ComponentExtensions compExt = createComponentExtensions(
+                    BindingMessageReference.class, bindMsgRef, fBindingType);
+            bindMsgRef.setComponentExtensions(fBindingType, compExt);
         }
        }
 
@@ -722,37 +460,13 @@
                        BindingFaultReferenceImpl bindFaultRef) {
         
         /*
-         * Create a ComponentExtensions object for each registered extension
-         * namespace used within this binding message reference by extension 
-         * elements or attributes.
+         * Create a ComponentExtensions subtype specific to the binding type.
          */
-               ExtensionRegistry er = fDesc.getExtensionRegistry();
-               URI[] extNamespaces = er
-                               
.queryComponentExtensionNamespaces(BindingFaultReference.class);
-
-               for (int i = 0; i < extNamespaces.length; i++) {
-                       URI extNS = extNamespaces[i];
-                       if 
(bindFaultRef.hasExtensionAttributesForNamespace(extNS)
-                                       || 
bindFaultRef.hasExtensionElementsForNamespace(extNS)) {
-                               ComponentExtensions compExt = 
createComponentExtensions(
-                                               BindingFaultReference.class, 
bindFaultRef, extNS);
-                               bindFaultRef.setComponentExtensions(extNS, 
compExt);
-                       }
-               }
         
-        if (ComponentExtensions.URI_NS_SOAP.equals(fBindingType)) {
-            /*
-             * If the binding type is SOAP and a 
SOAPBindingFaultReferenceExtensions 
-             * object has not already been created, create one now.
-             */
-            if (bindFaultRef
-                    
.getComponentExtensionsForNamespace(ComponentExtensions.URI_NS_SOAP) == null) {
-                ComponentExtensions compExt = createComponentExtensions(
-                        BindingFaultReference.class, bindFaultRef,
-                        ComponentExtensions.URI_NS_SOAP);
-                bindFaultRef.setComponentExtensions(
-                        ComponentExtensions.URI_NS_SOAP, compExt);
-            }
+        if(fBindingType != null) {
+            ComponentExtensions compExt = createComponentExtensions(
+                    BindingFaultReference.class, bindFaultRef, fBindingType);
+            bindFaultRef.setComponentExtensions(fBindingType, compExt);
         }
        }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to