1 22 package org.apache.beehive.wsm.axis.ant; 23 24 import java.io.File ; 25 26 import org.apache.tools.ant.AntClassLoader; 27 import org.apache.tools.ant.BuildException; 28 import org.apache.tools.ant.Task; 29 import org.apache.tools.ant.types.FileSet; 30 import org.apache.tools.ant.types.Path; 31 import org.apache.tools.ant.types.Reference; 32 33 38 public class AxisTypeGeneratorTask extends Task { 39 40 File mWSDL, mOutDir; 41 boolean generateJWS=false; 42 43 46 public boolean isGenerateJWS() { 47 return generateJWS; 48 } 49 52 public void setGenerateJWS(boolean generateJWS) { 53 this.generateJWS = generateJWS; 54 } 55 public void setWSDLDir(File wsdl) { 56 mWSDL = wsdl; 57 } 58 59 public void setOutputDir(File outputDir) { 60 mOutDir = outputDir; 61 } 62 63 public void execute() throws BuildException { 64 try { 65 AntClassLoader acl = (AntClassLoader)getClass().getClassLoader(); 66 if (mOutDir != null && mWSDL != null && mWSDL.isDirectory()) { 68 AxisTypeGenerator atg = new AxisTypeGenerator(); 69 for (File f : mWSDL.listFiles(new WSDLFilter())) { 70 atg.generateTypes(f.getPath(), 71 mOutDir.getPath()); 72 } 73 } 74 else { 75 throw new BuildException("Both a valid wsdl directory and an output directory must be provided."); 76 } 77 } 78 catch (Throwable e) { 79 e.printStackTrace(); 80 if (e instanceof BuildException) { 81 throw (BuildException)e; 82 } 83 else { 84 throw new BuildException(e.toString(), e); 85 } 86 } 87 } 88 } 89 | Popular Tags |