cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r704937 - in /cxf/trunk: parent/ rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/ rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/polic...
Date Wed, 15 Oct 2008 14:59:50 GMT
Author: dkulp
Date: Wed Oct 15 07:59:50 2008
New Revision: 704937

URL: http://svn.apache.org/viewvc?rev=704937&view=rev
Log:
Work around https://jaxb.dev.java.net/issues/show_bug.cgi?id=557 if JAXB 2.1.8 is used instead
of 2.1.7.


Modified:
    cxf/trunk/parent/pom.xml
    cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
    cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/BindingBuilder.java
    cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
    cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java

Modified: cxf/trunk/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/parent/pom.xml?rev=704937&r1=704936&r2=704937&view=diff
==============================================================================
--- cxf/trunk/parent/pom.xml (original)
+++ cxf/trunk/parent/pom.xml Wed Oct 15 07:59:50 2008
@@ -47,7 +47,7 @@
         <jaxb.xjc.version>2.1.7</jaxb.xjc.version>
         <jetty.version>6.1.11</jetty.version>
         <saaj.version>1.3</saaj.version>
-        <saaj.impl.version>1.3</saaj.impl.version>
+        <saaj.impl.version>1.3.2</saaj.impl.version>
         <spring.version>2.5.5</spring.version>
         <spring.mock>spring-test</spring.mock>
         <wsdl4j.version>1.6.2</wsdl4j.version>

Modified: cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java?rev=704937&r1=704936&r2=704937&view=diff
==============================================================================
--- cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
(original)
+++ cxf/trunk/rt/databinding/jaxb/src/main/java/org/apache/cxf/endpoint/dynamic/DynamicClientFactory.java
Wed Oct 15 07:59:50 2008
@@ -21,6 +21,7 @@
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
@@ -321,11 +322,18 @@
         
     }
 
+    @SuppressWarnings("deprecation")
     private void addSchemas(String wsdlUrl, Collection<SchemaInfo> schemas, SchemaCompiler
compiler) {
         int num = 1;
         for (SchemaInfo schema : schemas) {
             Element el = schema.getElement();
-            
+
+            //For JAXB 2.1.8
+            InputSource is = new InputSource((InputStream)null);
+            is.setSystemId(wsdlUrl + "#types" + num);
+            is.setPublicId(wsdlUrl + "#types" + num);
+            compiler.getOptions().addGrammar(is);
+
             compiler.parseSchema(wsdlUrl + "#types" + num, el);
             num++;
         }

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java?rev=704937&r1=704936&r2=704937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/policy/builders/SecureConversationTokenBuilder.java
Wed Oct 15 07:59:50 2008
@@ -29,6 +29,7 @@
 import org.apache.cxf.ws.policy.AssertionBuilder;
 import org.apache.cxf.ws.policy.PolicyAssertion;
 import org.apache.cxf.ws.policy.PolicyBuilder;
+import org.apache.cxf.ws.policy.PolicyConstants;
 import org.apache.cxf.ws.security.policy.SP11Constants;
 import org.apache.cxf.ws.security.policy.SP12Constants;
 import org.apache.cxf.ws.security.policy.SPConstants;
@@ -67,47 +68,55 @@
 
         conversationToken.setInclusion(consts.getInclusionFromAttributeValue(inclusionValue));
 
-        Element issuer = DOMUtils.getFirstChildWithName(element, consts.getNamespace(), SPConstants.ISSUER);
-        if (issuer != null) {
-            conversationToken.setIssuerEpr(DOMUtils.getFirstElement(issuer));
-        }
-
-        element = DOMUtils.getFirstChildWithName(element, SPConstants.POLICY);
-        if (element != null) {
-            if (DOMUtils.getFirstChildWithName(element, 
-                                               consts.getNamespace(),
-                                               SPConstants.REQUIRE_DERIVED_KEYS) != null)
{
-                conversationToken.setDerivedKeys(true);
-            } else if (DOMUtils.getFirstChildWithName(element, 
-                                                      SP12Constants.REQUIRE_IMPLIED_DERIVED_KEYS)
!= null) {
-                conversationToken.setImpliedDerivedKeys(true);
-            } else if (DOMUtils.getFirstChildWithName(element, 
-                                                      SP12Constants.REQUIRE_EXPLICIT_DERIVED_KEYS)
!= null) {
-                conversationToken.setExplicitDerivedKeys(true);
-            }
-
-
-            if (DOMUtils.getFirstChildWithName(element,
-                                               consts.getNamespace(),
-                                               SPConstants.REQUIRE_EXTERNAL_URI_REFERENCE)
!= null) {
-                conversationToken.setRequireExternalUriRef(true);
-            }
-
-            if (DOMUtils.getFirstChildWithName(element, 
-                                               consts.getNamespace(),
-                                               SPConstants.SC10_SECURITY_CONTEXT_TOKEN) !=
null) {
-                conversationToken.setSc10SecurityContextToken(true);
-            }
-
-            Element bootstrapPolicyElement = DOMUtils.getFirstChildWithName(element, 
-                                                                            consts.getNamespace(),
-                                                                            SPConstants.BOOTSTRAP_POLICY);
-            if (bootstrapPolicyElement != null) {
-                Policy policy = builder.getPolicy(DOMUtils.getFirstElement(bootstrapPolicyElement));
-                conversationToken.setBootstrapPolicy(policy);
+        
+        Element elem = DOMUtils.getFirstElement(element);
+        while (elem != null) {
+            QName qn = DOMUtils.getElementQName(elem);
+            if (PolicyConstants.isPolicyElem(qn)) {
+                if (DOMUtils.getFirstChildWithName(elem, 
+                                                   consts.getNamespace(),
+                                                   SPConstants.REQUIRE_DERIVED_KEYS) != null)
{
+                    conversationToken.setDerivedKeys(true);
+                } else if (DOMUtils.getFirstChildWithName(elem, 
+                                                          SP12Constants
+                                                              .REQUIRE_IMPLIED_DERIVED_KEYS)

+                                                          != null) {
+                    conversationToken.setImpliedDerivedKeys(true);
+                } else if (DOMUtils.getFirstChildWithName(elem, 
+                                                          SP12Constants
+                                                              .REQUIRE_EXPLICIT_DERIVED_KEYS)
+                                                              != null) {
+                    conversationToken.setExplicitDerivedKeys(true);
+                }
+
+
+                if (DOMUtils.getFirstChildWithName(elem,
+                                                   consts.getNamespace(),
+                                                   SPConstants.REQUIRE_EXTERNAL_URI_REFERENCE)
!= null) {
+                    conversationToken.setRequireExternalUriRef(true);
+                }
+
+                if (DOMUtils.getFirstChildWithName(elem, 
+                                                   consts.getNamespace(),
+                                                   SPConstants.SC10_SECURITY_CONTEXT_TOKEN)
!= null) {
+                    conversationToken.setSc10SecurityContextToken(true);
+                }
+
+                Element bootstrapPolicyElement = DOMUtils.getFirstChildWithName(elem, 
+                                                                                consts.getNamespace(),
+                                                                                SPConstants.BOOTSTRAP_POLICY);
+                if (bootstrapPolicyElement != null) {
+                    Policy policy = builder.getPolicy(DOMUtils.getFirstElement(bootstrapPolicyElement));
+                    conversationToken.setBootstrapPolicy(policy);
+                }
+
+            } else if (consts.getNamespace().equals(qn.getNamespaceURI())
+                && SPConstants.ISSUER.equals(qn.getLocalPart())) {
+                conversationToken.setIssuerEpr(DOMUtils.getFirstElement(elem));         
      
             }
+            elem = DOMUtils.getNextElement(elem);
         }
-
+        
         return conversationToken;
     }
 

Modified: cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/BindingBuilder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/BindingBuilder.java?rev=704937&r1=704936&r2=704937&view=diff
==============================================================================
--- cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/BindingBuilder.java
(original)
+++ cxf/trunk/rt/ws/security/src/main/java/org/apache/cxf/ws/security/wss4j/policyhandlers/BindingBuilder.java
Wed Oct 15 07:59:50 2008
@@ -614,7 +614,8 @@
         List<Element> found = new ArrayList<Element>();
         if (includeBody) {
             if (sign) {
-                result.add(new WSEncryptionPart(addWsuIdToElement(saaj.getSOAPBody())));
+                result.add(new WSEncryptionPart(addWsuIdToElement(saaj.getSOAPBody()),
+                                                null, WSConstants.PART_TYPE_BODY));
             } else {
                 result.add(new WSEncryptionPart(addWsuIdToElement(saaj.getSOAPBody()),
                                                 "Content", WSConstants.PART_TYPE_BODY));
@@ -634,7 +635,8 @@
                         if (sign) {
                             result.add(new WSEncryptionPart(el.getLocalName(), 
                                                             part.getNamespace(),
-                                                            "Content"));
+                                                            "Content",
+                                                            WSConstants.PART_TYPE_HEADER));
                         } else {
                             WSEncryptionPart encryptedHeader 
                                 = new WSEncryptionPart(el.getLocalName(),
@@ -686,11 +688,14 @@
                         if (sign) {
                             result.add(new WSEncryptionPart(el.getLocalName(),
                                                             el.getNamespaceURI(), 
-                                                            "Content"));
+                                                            "Content",
+                                                            WSConstants.PART_TYPE_ELEMENT));
                         } else {
                             WSEncryptionPart encryptedElem = new WSEncryptionPart(el.getLocalName(),
                                                                                   el.getNamespaceURI(),
-                                                                                  "Element");
+                                                                                  "Element",
+                                                                                  WSConstants
+                                                                                      .PART_TYPE_ELEMENT);
                             String wsuId = el.getAttributeNS(WSConstants.WSU_NS, "Id");
                             
                             if (!StringUtils.isEmpty(wsuId)) {

Modified: cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java?rev=704937&r1=704936&r2=704937&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
(original)
+++ cxf/trunk/tools/wsdlto/databinding/jaxb/src/main/java/org/apache/cxf/tools/wsdlto/databinding/jaxb/JAXBDataBinding.java
Wed Oct 15 07:59:50 2008
@@ -19,6 +19,7 @@
 package org.apache.cxf.tools.wsdlto.databinding.jaxb;
 import java.io.File;
 import java.io.IOException;
+import java.io.InputStream;
 import java.io.Writer;
 import java.lang.reflect.Field;
 import java.net.URL;
@@ -130,7 +131,6 @@
         SchemaCompilerImpl schemaCompiler = (SchemaCompilerImpl)XJC.createSchemaCompiler();
         ClassCollector classCollector = context.get(ClassCollector.class);
         
-        
         ClassNameAllocatorImpl allocator 
             = new ClassNameAllocatorImpl(classCollector,
                                          c.optionSet(ToolConstants.CFG_AUTORESOLVE));
@@ -143,22 +143,14 @@
         List<InputSource> jaxbBindings = context.getJaxbBindingFile();
         Map<String, Element> schemaLists = CastUtils.cast((Map<?, ?>)context.get(ToolConstants.SCHEMA_MAP));
 
-        for (String key : schemaLists.keySet()) {
-            Element ele = schemaLists.get(key);
-            ele = removeImportElement(ele);
-            String tns = ele.getAttribute("targetNamespace");
-            if (StringUtils.isEmpty(tns)) {
-                continue;
-            }
-            if (context.get(ToolConstants.CFG_VALIDATE_WSDL) != null) {
-                validateSchema(ele);
-            }           
-            schemaCompiler.parseSchema(key, ele);
+        
+        Options opts = null;
+        opts = getOptions(schemaCompiler);
 
-        }
+        addSchemas(opts, schemaCompiler, schemaLists);
 
         for (InputSource binding : jaxbBindings) {
-            schemaCompiler.parseSchema(binding);
+            opts.addBindFile(binding);
         }
 
                        
@@ -176,8 +168,6 @@
             schemaCompiler.setDefaultPackageName(context.getPackageName());
         }  
         
-        Options opts = null;
-        opts = getOptions(schemaCompiler);
         
         Vector<String> args = new Vector<String>();
         if (context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null) {
@@ -185,7 +175,7 @@
             args.add("-extension");
             URL bindingFileUrl = getClass().getResource("W3CEPRJaxbBinding.xml");
             InputSource ins = new InputSource(bindingFileUrl.toString());
-            schemaCompiler.parseSchema(ins);
+            opts.addBindFile(ins);
         }
         
         if (context.get(ToolConstants.CFG_XJC_ARGS) != null) {
@@ -200,7 +190,6 @@
         if (context.get(ToolConstants.CFG_NO_ADDRESS_BINDING) == null
             || context.get(ToolConstants.CFG_XJC_ARGS) != null) {
             try {
-
                 // keep parseArguments happy, supply dummy required command-line
                 // opts
                 opts.addGrammar(new InputSource("null"));
@@ -248,6 +237,25 @@
         initialized = true;
     }
 
+    private void addSchemas(Options opts, SchemaCompilerImpl schemaCompiler,
+                            Map<String, Element> schemaLists) {
+        for (String key : schemaLists.keySet()) {
+            Element ele = schemaLists.get(key);
+            ele = removeImportElement(ele);
+            String tns = ele.getAttribute("targetNamespace");
+            if (StringUtils.isEmpty(tns)) {
+                continue;
+            }
+            if (context.get(ToolConstants.CFG_VALIDATE_WSDL) != null) {
+                validateSchema(ele);
+            }           
+            InputSource is = new InputSource((InputStream)null);
+            is.setSystemId(key);
+            is.setPublicId(key);
+            opts.addGrammar(is);
+            schemaCompiler.parseSchema(key, ele);
+        }
+    }
     private String getPluginUsageString(Options opts) {
         StringBuffer buf = new StringBuffer();
         buf.append("\navaliable plugin options:\n");

Modified: cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java?rev=704937&r1=704936&r2=704937&view=diff
==============================================================================
--- cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
(original)
+++ cxf/trunk/tools/wsdlto/test/src/test/java/org/apache/cxf/tools/wsdlto/jaxws/CodeGenBugTest.java
Wed Oct 15 07:59:50 2008
@@ -280,7 +280,8 @@
 
     @Test
     public void testDefaultLoadNSMappingOFF() throws Exception {
-        String[] args = new String[] {"-dns", "false", "-d", output.getCanonicalPath(), "-noAddressBinding",
+        String[] args = new String[] {"-dns", "false",
+                                      "-d", output.getCanonicalPath(), "-noAddressBinding",
                                       getLocation("/wsdl2java_wsdl/basic_callback.wsdl")};
 
         WSDLToJava.main(args);



Mime
View raw message