001package net.gdface.codegen.webclient; 002 003import java.io.File; 004import java.util.HashSet; 005import java.util.Set; 006 007import net.gdface.codegen.generator.GeneratorConfiguration; 008 009import org.apache.commons.cli.CommandLine; 010import org.apache.commons.cli.Options; 011import org.apache.commons.cli.ParseException; 012 013public class KSoapStubConfiguration extends GeneratorConfiguration implements WebClientConstants { 014 private File wsdlLocatoin; 015 private final Set<String> independentSchemas=new HashSet<String>(); 016 private Class<?> serviceClass; 017 private String serviceName; 018 public KSoapStubConfiguration() { 019 defaultValue.setProperty(INDEPENDENT_SEHEMA_OPTION_LONG, ""); 020 defaultValue.setProperty(SERVICE_NAME_OPTION_LONG, ""); 021 } 022 023 @Override 024 public void loadConfig(Options options, CommandLine cmd) throws ParseException { 025 super.loadConfig(options, cmd); 026 serviceClass = getProperty(WebClientConstants.CLASSNAME_OPTION_LONG); 027 serviceName = getProperty(SERVICE_NAME_OPTION_LONG); 028 if(serviceName.isEmpty())//如果没有指定,则使用serviceClass类名做服务名 029 serviceName=serviceClass.getSimpleName(); 030 wsdlLocatoin = getProperty(WSDL_LOCATION_URI_OPTION); 031 for (String schema : ((String)getProperty(INDEPENDENT_SEHEMA_OPTION_LONG)).split("[,;=]")) 032 if (!(schema=schema.trim().toUpperCase()).isEmpty()) 033 independentSchemas.add(schema); 034 035 } 036 /** 037 * @return wsdlLocatoin 038 */ 039 public File getWsdlLocatoin() { 040 return wsdlLocatoin; 041 } 042 043 /** 044 * @return independentSchemas 045 */ 046 public Set<String> getIndependentSchemas() { 047 return independentSchemas; 048 } 049 050 /** 051 * @return serviceClass 052 */ 053 public Class<?> getServiceClass() { 054 return serviceClass; 055 } 056 057 /** 058 * @return serviceName 059 */ 060 public String getServiceName() { 061 return serviceName; 062 } 063}