cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bimargul...@apache.org
Subject svn commit: r1023414 - in /cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs: ext/codegen/CodeGeneratorProvider.java model/wadl/WadlGenerator.java
Date Sun, 17 Oct 2010 02:29:54 GMT
Author: bimargulies
Date: Sun Oct 17 02:29:53 2010
New Revision: 1023414

URL: http://svn.apache.org/viewvc?rev=1023414&view=rev
Log:
Rest of the unit tests passing.

Modified:
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java
    cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java?rev=1023414&r1=1023413&r2=1023414&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/ext/codegen/CodeGeneratorProvider.java
Sun Oct 17 02:29:53 2010
@@ -35,6 +35,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
@@ -62,7 +63,6 @@ import javax.ws.rs.core.UriBuilder;
 import javax.ws.rs.core.UriInfo;
 import javax.xml.namespace.QName;
 
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
@@ -89,6 +89,7 @@ import org.apache.cxf.jaxrs.model.wadl.W
 import org.apache.cxf.jaxrs.provider.ProviderFactory;
 import org.apache.cxf.jaxrs.utils.JAXRSUtils;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.staxutils.StaxUtils;
 
 public class CodeGeneratorProvider implements RequestHandler {
     public static final String CODE_QUERY = "_code";
@@ -186,9 +187,9 @@ public class CodeGeneratorProvider imple
                 zipSource(srcDir, zipDir);
                 return getLink(zipDir, m);
             } catch (Exception ex) {
-                LOG.warning("Code can not be generated for " 
-                            + resourceClass != null ? resourceClass.getServiceClass().getName()

-                                : "this service");
+                LOG.log(Level.WARNING, "Code can not be generated for " 
+                            + (resourceClass != null ? resourceClass.getServiceClass().getName()

+                                : "this service"), ex);
                 FileUtils.removeDir(zipDir);
                 return Response.noContent().build();
             } finally {
@@ -769,8 +770,7 @@ public class CodeGeneratorProvider imple
     
     private Element readWadl(String wadl) {
         try {
-            Document doc = DOMUtils.readXml(new StringReader(wadl));
-            return doc.getDocumentElement();
+            return StaxUtils.read(new InputSource(new StringReader(wadl))).getDocumentElement();
         } catch (Exception ex) {
             throw new IllegalStateException("Unable to read wadl", ex);
         }
@@ -801,21 +801,22 @@ public class CodeGeneratorProvider imple
     
     private JCodeModel createCodeModel(List<Element> schemaElements, Set<String>
type) {
         
-        SchemaCompiler compiler = createCompiler(type);
 
+        SchemaCompiler compiler = createCompiler(type);
         addSchemas(schemaElements, compiler);
         
-        S2JJAXBModel intermediateModel = compiler.bind();
         
         Object elForRun = ReflectionInvokationHandler
             .createProxyWrapper(new InnerErrorListener(),
                             JAXBUtils.getParamClass(compiler, "setErrorListener"));
         
+        compiler.setErrorListener(elForRun);
+        S2JJAXBModel intermediateModel = compiler.bind();
         JCodeModel codeModel = intermediateModel.generateCode(null, elForRun);
         JAXBUtils.logGeneratedClassNames(LOG, codeModel);
         return codeModel;
     }
-    
+
     private SchemaCompiler createCompiler(Set<String> typeClassNames) {
         return JAXBUtils.createSchemaCompilerWithDefaultAllocator(typeClassNames);
     }

Modified: cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java?rev=1023414&r1=1023413&r2=1023414&view=diff
==============================================================================
--- cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
(original)
+++ cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/model/wadl/WadlGenerator.java
Sun Oct 17 02:29:53 2010
@@ -62,6 +62,7 @@ import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
 import org.apache.cxf.BusFactory;
+import org.apache.cxf.common.WSDLConstants;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PackageUtils;
 import org.apache.cxf.common.util.ReflectionInvokationHandler;
@@ -999,7 +1000,8 @@ public class WadlGenerator implements Re
 
         public void write(StringBuilder sb) {
             for (XmlSchema xs : coll.getXmlSchemas()) {
-                if (xs.getItems().isEmpty()) {
+                if (xs.getItems().isEmpty()
+                    || WSDLConstants.NS_SCHEMA_XSD.equals(xs.getTargetNamespace())) {
                     continue;
                 }
                 StringWriter writer = new StringWriter();



Mime
View raw message