1 16 package org.apache.axis.wsdl.toJava; 17 18 import org.apache.axis.wsdl.gen.Generator; 19 import org.apache.axis.wsdl.symbolTable.ServiceEntry; 20 import org.apache.axis.wsdl.symbolTable.SymbolTable; 21 22 import javax.wsdl.Service; 23 import java.io.IOException ; 24 25 29 public class JavaServiceWriter implements Generator { 30 31 32 protected Generator serviceIfaceWriter = null; 33 34 35 protected Generator serviceImplWriter = null; 36 37 38 protected Generator testCaseWriter = null; 39 40 41 public static final String PORT_NAME = "port name"; 42 43 44 protected Emitter emitter; 45 46 47 protected Service service; 48 49 50 protected SymbolTable symbolTable; 51 52 59 public JavaServiceWriter(Emitter emitter, Service service, 60 SymbolTable symbolTable) { 61 this.emitter = emitter; 62 this.service = service; 63 this.symbolTable = symbolTable; 64 } 66 72 protected void setGenerators() { 73 ServiceEntry sEntry = symbolTable.getServiceEntry(service.getQName()); 74 75 if (sEntry.isReferenced()) { 76 serviceIfaceWriter = new JavaServiceIfaceWriter(emitter, sEntry, 77 symbolTable); 78 serviceImplWriter = new JavaServiceImplWriter(emitter, sEntry, 79 symbolTable); 80 81 if (emitter.isTestCaseWanted()) { 82 testCaseWriter = new JavaTestCaseWriter(emitter, sEntry, 83 symbolTable); 84 } 85 } 86 } 87 88 91 protected void postSetGenerators() { 92 if (emitter.isDeploy()) { 93 serviceIfaceWriter = null; 94 serviceImplWriter = null; 95 } 96 } 97 98 103 public void generate() throws IOException { 104 setGenerators(); 105 postSetGenerators(); 106 107 if (serviceIfaceWriter != null) { 108 serviceIfaceWriter.generate(); 109 } 110 111 if (serviceImplWriter != null) { 112 serviceImplWriter.generate(); 113 } 114 115 if (testCaseWriter != null) { 116 testCaseWriter.generate(); 117 } 118 } } | Popular Tags |