1 16 17 package org.apache.axis2.wsdl.codegen.extension; 18 19 import org.apache.axis2.wsdl.codegen.CodeGenConfiguration; 20 import org.apache.axis2.wsdl.codegen.CommandLineOption; 21 import org.apache.axis2.wsdl.codegen.CommandLineOptionConstants; 22 import org.apache.axis2.wsdl.util.URLProcessor; 23 import org.apache.wsdl.WSDLBinding; 24 25 import java.util.Map ; 26 27 31 public class PackageFinder extends AbstractCodeGenerationExtension implements 32 CodeGenExtension { 33 34 public void init(CodeGenConfiguration configuration) { 35 this.configuration = configuration; 36 37 } 38 39 public void engage() { 40 Map allOptions = this.configuration.getParser().getAllOptions(); 41 CommandLineOption packageOption = (CommandLineOption)(allOptions.get(CommandLineOptionConstants.PACKAGE_OPTION)); 42 String packageName = packageOption==null?null:packageOption.getOptionValue(); 43 44 if (packageName == null) { 45 WSDLBinding binding = configuration.getWom().getBinding(AxisBindingBuilder.AXIS_BINDING_QNAME); 46 String temp = binding.getBoundInterface().getName().getNamespaceURI(); 47 packageName = URLProcessor.getNameSpaceFromURL(temp); 48 } 49 50 if(null == packageName || "".equals(packageName)) 51 packageName = URLProcessor.DEFAULT_PACKAGE; 52 53 this.configuration.setPackageName(packageName.toLowerCase()); 54 55 } 56 57 58 59 } | Popular Tags |