incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eno...@apache.org
Subject svn commit: r534851 - in /incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl: IDLToWSDLProcessor.java WSDLASTVisitor.java
Date Thu, 03 May 2007 13:36:04 GMT
Author: enolan
Date: Thu May  3 06:36:03 2007
New Revision: 534851

URL: http://svn.apache.org/viewvc?view=rev&rev=534851
Log:
Yoko-430 - updates.

Modified:
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/WSDLASTVisitor.java

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java?view=diff&rev=534851&r1=534850&r2=534851
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java
Thu May  3 06:36:03 2007
@@ -163,15 +163,7 @@
                 visitor.setBoundedStringOverride(true);
             }
             visitor.visit(idlTree);
-            if (outputWriter == null) {
-                FileWriterUtil fw = new FileWriterUtil(outputDir);
-                /*if (env.optionSet(ToolCorbaConstants.CFG_WSDL_ENCODING)) {
-                    String encoding = env.get(ToolCorbaConstants.CFG_WSDL_ENCODING).toString();
-                    outputWriter = fw.getWriter("", idl + ".wsdl", encoding);
-                } else {*/
-                outputWriter = fw.getWriter("", idl + ".wsdl");
-                //}
-            }
+            
             Definition def = visitor.getDefinition();
             Binding[] bindings = visitor.getCorbaBindings();
             generateCORBAService(def, bindings);
@@ -184,56 +176,56 @@
     
     private void writeDefinitions(WSDLASTVisitor visitor, String outputDir) 
         throws Exception {
-                
+                        
         if (env.optionSet(ToolCorbaConstants.CFG_LOGICAL)
             || env.optionSet(ToolCorbaConstants.CFG_PHYSICAL)
             || env.optionSet(ToolCorbaConstants.CFG_SCHEMA)
             || env.optionSet(ToolCorbaConstants.CFG_IMPORTSCHEMA)) {
-            if (logical != null) {
-                if (logicalOutputWriter == null) {
-                    FileWriterUtil fw = new FileWriterUtil(outputDir);
-                    /*if (env.optionSet(ToolCorbaConstants.CFG_WSDL_ENCODING)) {
-                        String encoding = env.get(ToolCorbaConstants.CFG_WSDL_ENCODING).toString();
-                        logicalOutputWriter = fw.getWriter("", logical, encoding);
-                    } else {*/
-                    logicalOutputWriter = fw.getWriter("", logical);
-                    //}
-                }                    
+                        
+            if (logical == null || physical == null) {
+                if (outputWriter == null) {
+                    outputWriter = getOutputWriter(idl, outputDir);            
+                }
+            }            
+            
+            if (logical != null && logicalOutputWriter == null) {
+                logicalOutputWriter = getOutputWriter(logical, outputDir);
             }
-            if (physical != null) {
-                if (physicalOutputWriter == null) {
-                    FileWriterUtil fw = new FileWriterUtil(outputDir);
-                    /*if (env.optionSet(ToolCorbaConstants.CFG_WSDL_ENCODING)) {
-                        String encoding = env.get(ToolCorbaConstants.CFG_WSDL_ENCODING).toString();
-                        physicalOutputWriter = fw.getWriter("", physical, encoding);
-                    } else {*/
-                    physicalOutputWriter = fw.getWriter("", physical);
-                    //}
-                }                    
+            if (physical != null && physicalOutputWriter == null) {
+                physicalOutputWriter = getOutputWriter(physical, outputDir);
             }
             
-            if (schemaFilename != null) {
-                if (schemaOutputWriter == null) {
-                    FileWriterUtil fw = new FileWriterUtil(outputDir);
-                    /*if (env.optionSet(ToolCorbaConstants.CFG_WSDL_ENCODING)) {
-                        String encoding = env.get(ToolCorbaConstants.CFG_WSDL_ENCODING).toString();
-                        schemaOutputWriter = fw.getWriter("", schemaFilename, encoding);
-                    } else {*/
-                    schemaOutputWriter = fw.getWriter("", schemaFilename);
-                    //}
-                }
+            if (schemaFilename != null && schemaOutputWriter == null) {
+                schemaOutputWriter = getOutputWriter(schemaFilename, outputDir);
             }
             if (importSchemaFilename != null) {               
                 visitor.setImportSchema(importSchemaFilename);
             }
             
-            visitor.setIdlFile(idl + ".wsdl");           
+            visitor.setIdlFile(idl + ".wsdl");            
             visitor.writeDefinitions(outputWriter, schemaOutputWriter,
                                      logicalOutputWriter, physicalOutputWriter, 
                                      schemaFilename, logical, physical);
-        } else {            
+        } else {
+            if (outputWriter == null) {
+                outputWriter = getOutputWriter(idl, outputDir);
+            }
             visitor.writeDefinition(outputWriter);
         }         
+    }
+    
+    private Writer getOutputWriter(String filename, String outputDir) throws Exception {
+
+        FileWriterUtil fw = new FileWriterUtil(outputDir);
+        // REVISIT - Waiting on a change in CXF
+        /*
+         * if (env.optionSet(ToolCorbaConstants.CFG_WSDL_ENCODING)) { String
+         * encoding = env.get(ToolCorbaConstants.CFG_WSDL_ENCODING).toString();
+         * outputWriter = fw.getWriter("", idl + ".wsdl", encoding); } else {
+         */
+        return fw.getWriter("", filename + ".wsdl");
+        // }
+
     }
     
     public void setEnvironment(ProcessorEnvironment penv) {

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/WSDLASTVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/WSDLASTVisitor.java?view=diff&rev=534851&r1=534850&r2=534851
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/WSDLASTVisitor.java
(original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/WSDLASTVisitor.java
Thu May  3 06:36:03 2007
@@ -124,7 +124,7 @@
             throw new RuntimeException(ex);
         }
     }
-    
+           
     public void setIdlFile(String idl) {
         idlFile = idl;
     }



Mime
View raw message