You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/22 05:12:54 UTC

svn commit: r358482 - /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java

Author: dims
Date: Wed Dec 21 20:12:51 2005
New Revision: 358482

URL: http://svn.apache.org/viewcvs?rev=358482&view=rev
Log:
added prettify for adb java beans as well

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?rev=358482&r1=358481&r2=358482&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Wed Dec 21 20:12:51 2005
@@ -8,6 +8,7 @@
 import org.apache.axis2.util.URLProcessor;
 import org.apache.axis2.util.XSLTTemplateProcessor;
 import org.apache.axis2.util.XSLTUtils;
+import org.apache.axis2.wsdl.codegen.writer.PrettyPrinter;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
 import org.apache.ws.commons.schema.XmlSchemaSimpleType;
@@ -149,7 +150,7 @@
         try {
             if (wrapClasses) {
 
-                OutputStream out = createOutFile(packageName, WRAPPED_DATABINDING_CLASS_NAME);
+                File out = createOutFile(packageName, WRAPPED_DATABINDING_CLASS_NAME);
                 //parse with the template and create the files
                 parse(globalWrappedDocument, out);
             }
@@ -232,7 +233,7 @@
             //make the XML
             model.appendChild(getBeanElement(model, className, originalName, packageName, qName, isElement, metainf, propertyNames, typeMap));
             //create the file
-            OutputStream out = createOutFile(packageName, className);
+            File out = createOutFile(packageName, className);
             //parse with the template and create the files
             parse(model, out);
             fullyqualifiedClassName = packageName + "." + className;
@@ -420,30 +421,28 @@
      * @param fileName
      * @throws Exception
      */
-    private OutputStream createOutFile(String packageName, String fileName) throws Exception {
-        File outputFile = org.apache.axis2.util.FileWriter.createClassFile(this.rootDir,
+    private File createOutFile(String packageName, String fileName) throws Exception {
+        return org.apache.axis2.util.FileWriter.createClassFile(this.rootDir,
                 packageName,
                 fileName,
                 ".java");
-        return new FileOutputStream(outputFile);
-
     }
 
     /**
      * Writes the output file
      *
-     * @param documentStream
+     * @param doc
+     * @param outputFile
      * @throws Exception
      */
-    private void parse(Document doc, OutputStream outStream) throws Exception {
-
+    private void parse(Document doc, File outputFile) throws Exception {
+        OutputStream outStream = new FileOutputStream(outputFile);
         XSLTTemplateProcessor.parse(outStream,
                 doc,
                 this.templateCache.newTransformer());
         outStream.flush();
         outStream.close();
 
+        PrettyPrinter.prettify(outputFile);
     }
-
-
 }