cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r579912 - in /incubator/cxf/trunk/tools: javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/ javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/ wsdlto/core/src/...
Date Thu, 27 Sep 2007 06:27:02 GMT
Author: ema
Date: Wed Sep 26 23:27:01 2007
New Revision: 579912

URL: http://svn.apache.org/viewvc?rev=579912&view=rev
Log:
Refactored AbstractGenerator.java to remove the hard code outputDir

Modified:
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsClientGenerator.java
    incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
    incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java?rev=579912&r1=579911&r2=579912&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/AbstractJaxwsGenerator.java
Wed Sep 26 23:27:01 2007
@@ -18,54 +18,30 @@
  */
 package org.apache.cxf.tools.java2wsdl.processor.internal.jaxws.generator;
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.ClassCollector;
-import org.apache.cxf.tools.util.FileWriterUtil;
 import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
 
 public abstract class AbstractJaxwsGenerator extends AbstractGenerator {
     protected static final Logger LOG = LogUtils.getL7dLogger(AbstractJaxwsGenerator.class);
-    protected static final String TEMPLATE_BASE = "org/apache/cxf/tools" 
-        + "/java2wsdl/processor/internal/jaxws/generator/template";
+    protected static final String TEMPLATE_BASE = "org/apache/cxf/tools"
+                                                  + "/java2wsdl/processor/internal/jaxws/generator/template";
 
     public abstract boolean passthrough();
 
     public abstract void generate(ToolContext penv) throws ToolException;
-    
-    @Override
-    protected Writer parseOutputName(String packageName, String filename, String ext) throws
ToolException {
-        FileWriterUtil fw = null;
-        Writer writer = null;
-
-        if (wantToKeep() && isCollision(packageName, filename, ext)) {
-            Message msg = new Message("SKIP_GEN", LOG, packageName + "." + filename + ext);
-            LOG.log(Level.INFO, msg.toString());
-            return null;
-        }
-
-        fw = new FileWriterUtil((String)env.get(ToolConstants.CFG_SOURCEDIR));
-        try {
-            writer = fw.getWriter(packageName, filename + ext);
-        } catch (IOException ioe) {
-            Message msg = new Message("FAIL_TO_WRITE_FILE", LOG, packageName + "." + filename
+ ext);
-            throw new ToolException(msg, ioe);
-        }
 
-        return writer;
-    }
-    
     public void register(final ClassCollector collector, String packageName, String fileName)
{
-        
+
     }
 
-}
+    public String getOutputDir() {
+        return (String)env.get(ToolConstants.CFG_SOURCEDIR);
+    }
 
+}

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsClientGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsClientGenerator.java?rev=579912&r1=579911&r2=579912&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsClientGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/jaxws/generator/JaxwsClientGenerator.java
Wed Sep 26 23:27:01 2007
@@ -33,9 +33,7 @@
 
     private static final String CLIENT_TEMPLATE = TEMPLATE_BASE + "/javafirst-client.vm";
 
-    public JaxwsClientGenerator() {
-        this.name = ToolConstants.CLT_GENERATOR;
-    }
+
 
     public boolean passthrough() {
         if (env.optionSet(ToolConstants.CFG_CLIENT)) {

Modified: incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java?rev=579912&r1=579911&r2=579912&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
(original)
+++ incubator/cxf/trunk/tools/javato/ws/src/main/java/org/apache/cxf/tools/java2wsdl/processor/internal/simple/generator/AbstractSimpleGenerator.java
Wed Sep 26 23:27:01 2007
@@ -18,18 +18,13 @@
  */
 package org.apache.cxf.tools.java2wsdl.processor.internal.simple.generator;
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.tools.common.ToolConstants;
 import org.apache.cxf.tools.common.ToolContext;
 import org.apache.cxf.tools.common.ToolException;
 import org.apache.cxf.tools.util.ClassCollector;
-import org.apache.cxf.tools.util.FileWriterUtil;
 import org.apache.cxf.tools.wsdlto.core.AbstractGenerator;
 
 public abstract class AbstractSimpleGenerator extends AbstractGenerator {
@@ -40,30 +35,12 @@
     public abstract boolean passthrough();
 
     public abstract void generate(ToolContext penv) throws ToolException;
+
     public void register(final ClassCollector collector, String packageName, String fileName)
{
         
     }
+    public String getOutputDir() {
+        return (String)env.get(ToolConstants.CFG_SOURCEDIR);           
+    } 
     
-    protected Writer parseOutputName(String packageName, String filename, String ext) throws
ToolException {
-        FileWriterUtil fw = null;
-        Writer writer = null;
-
-        if (wantToKeep() && isCollision(packageName, filename, ext)) {
-            Message msg = new Message("SKIP_GEN", LOG, packageName + "." + filename + ext);
-            LOG.log(Level.INFO, msg.toString());
-            return null;
-        }
-
-        fw = new FileWriterUtil((String)env.get(ToolConstants.CFG_SOURCEDIR));
-        try {
-            writer = fw.getWriter(packageName, filename + ext);
-        } catch (IOException ioe) {
-            Message msg = new Message("FAIL_TO_WRITE_FILE", LOG, packageName + "." + filename
+ ext);
-            throw new ToolException(msg, ioe);
-        }
-
-        return writer;
-    }
-    
-
 }

Modified: incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java?rev=579912&r1=579911&r2=579912&view=diff
==============================================================================
--- incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java
(original)
+++ incubator/cxf/trunk/tools/wsdlto/core/src/main/java/org/apache/cxf/tools/wsdlto/core/AbstractGenerator.java
Wed Sep 26 23:27:01 2007
@@ -52,7 +52,7 @@
         }
     }
 
-    protected boolean isCollision(String packageName, String filename) throws ToolException
{        
+    protected boolean isCollision(String packageName, String filename) throws ToolException
{
         return isCollision(packageName, filename, ".java");
     }
 
@@ -78,7 +78,7 @@
             return null;
         }
 
-        fw = new FileWriterUtil((String)env.get(ToolConstants.CFG_OUTPUTDIR));
+        fw = new FileWriterUtil(getOutputDir());
         try {
             writer = fw.getWriter(packageName, filename + ext);
         } catch (IOException ioe) {
@@ -111,11 +111,14 @@
 
     public void setEnvironment(ToolContext penv) {
         this.env = penv;
-
     }
 
     public ToolContext getEnvironment() {
         return this.env;
+    }
+
+    public String getOutputDir() {
+        return (String)env.get(ToolConstants.CFG_OUTPUTDIR);           
     }
 
     public String getName() {



Mime
View raw message