001package net.gdface.codegen.webclient; 002 003import org.apache.commons.cli.Options; 004 005import net.gdface.cli.Context; 006import net.gdface.codegen.generator.CodeWriter; 007import net.gdface.codegen.generator.CxxCodeWriter; 008import net.gdface.codegen.generator.GeneratorConfiguration; 009 010public class GSoapClientGenerator extends WebClientGenerator { 011 private final GSoapClientOptions options = GSoapClientOptions.getInstance(); 012 protected GSoapClientConfiguration config; 013 014 public GSoapClientGenerator() { 015 config = new GSoapClientConfiguration(); 016 } 017 018 public static void main(String[] args) { 019 new GSoapClientGenerator().parseCommandLine(args).initEngine().generate(); 020 } 021 022 023 @Override 024 protected CodeWriter getCodeWriter() { 025 return new CxxCodeWriter(config.getOutputLocation()); 026 } 027 028 @SuppressWarnings({ "unchecked", "rawtypes" }) 029 @Override 030 protected Context createEngineContext() { 031 Context context = super.createEngineContext(); 032 GSoapClient newSourceInfo = new GSoapClient(config.getInterfaceClass(), config.getRefClass(), 033 config.getServiceClass(), config.getServiceName(), config.getStubFolder(), config.getStubPrefix()); 034 if (!newSourceInfo.compile()) 035 System.exit(1); 036 context.setProperty(SOURCE_INFO, newSourceInfo); 037 return context; 038 } 039 040 @Override 041 protected Options getOptions() { 042 return options.getOptions(); 043 } 044 045 @Override 046 protected GeneratorConfiguration getGeneratorConfiguration() { 047 return config; 048 } 049 050}