You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by am...@apache.org on 2011/05/10 10:56:09 UTC

svn commit: r1101368 - in /axis/axis2/java/core/trunk/modules: java2wsdl/src/org/apache/ws/java2wsdl/ java2wsdl/src/org/apache/ws/java2wsdl/utils/ kernel/src/org/apache/axis2/deployment/util/ kernel/src/org/apache/axis2/description/ kernel/src/org/apac...

Author: amilas
Date: Tue May 10 08:56:09 2011
New Revision: 1101368

URL: http://svn.apache.org/viewvc?rev=1101368&view=rev
Log:
adding options to change the portName, soap11binding name, soap12binding name and rest binding name in a genearted wsdl of from the java2wsdl tool

Modified:
    axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java
    axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
    axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
    axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java

Modified: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java (original)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDL.java Tue May 10 08:56:09 2011
@@ -66,6 +66,10 @@ public class Java2WSDL {
         System.out.println("  -disableSOAP12                          disable binding generation for SOAP12");
         System.out.println("  -disableREST                            disable binding generation for REST");
         System.out.println("  -mpn <messagePartName>                  change the part name of the generated wsdl messages");
+        System.out.println("  -ptn <portTypeName>                     port Type name of the WSDL");
+        System.out.println("  -soap11BindingName                      soap11 binding name of the WSDL");
+        System.out.println("  -soap12BindingName                      soap 12 binding name of the WSDL");
+        System.out.println("  -restBindingName                        rest binding name of the WSDL");
         System.exit(0);
     }
 

Modified: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java (original)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLBuilder.java Tue May 10 08:56:09 2011
@@ -89,6 +89,12 @@ public class Java2WSDLBuilder implements
 
     private String messagePartName;
 
+    private String portTypeName;
+
+    private String soap11BindingName;
+    private String soap12BindingName;
+    private String restBindingName;
+
     public Java2WSDLBuilder() {
 		try {
 			ConfigurationContext configCtx = ConfigurationContextFactory
@@ -261,6 +267,26 @@ public class Java2WSDLBuilder implements
             service.addParameter(Java2WSDLConstants.MESSAGE_PART_NAME_OPTION_LONG, messagePartName);
         }
 
+        if (portTypeName != null){
+            service.addParameter(Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG, portTypeName);
+        }
+
+        if (soap11BindingName != null){
+            service.addParameter(Java2WSDLConstants.SOAP11_BINDING_NAME_OPTION_LONG, soap11BindingName);
+        }
+
+        if (soap12BindingName != null){
+            service.addParameter(Java2WSDLConstants.SOAP12_BINDING_NAME_OPTION_LONG, soap12BindingName);
+        }
+
+        if (restBindingName != null){
+            service.addParameter(Java2WSDLConstants.REST_BINDING_NAME_OPTION_LONG, restBindingName);
+        }
+
+        if (messagePartName != null){
+            service.addParameter(Java2WSDLConstants.MESSAGE_PART_NAME_OPTION_LONG, messagePartName);
+        }
+
 		schemaGenerator.setAxisService(service);
 		AxisService axisService = AxisService.createService(className,
 				serviceName == null ? Java2WSDLUtils
@@ -504,4 +530,36 @@ public class Java2WSDLBuilder implements
     public void setMessagePartName(String messagePartName) {
         this.messagePartName = messagePartName;
     }
+
+    public String getPortTypeName() {
+        return portTypeName;
+    }
+
+    public void setPortTypeName(String portTypeName) {
+        this.portTypeName = portTypeName;
+    }
+
+    public String getSoap11BindingName() {
+        return soap11BindingName;
+    }
+
+    public void setSoap11BindingName(String soap11BindingName) {
+        this.soap11BindingName = soap11BindingName;
+    }
+
+    public String getSoap12BindingName() {
+        return soap12BindingName;
+    }
+
+    public void setSoap12BindingName(String soap12BindingName) {
+        this.soap12BindingName = soap12BindingName;
+    }
+
+    public String getRestBindingName() {
+        return restBindingName;
+    }
+
+    public void setRestBindingName(String restBindingName) {
+        this.restBindingName = restBindingName;
+    }
 }

Modified: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java (original)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/Java2WSDLCodegenEngine.java Tue May 10 08:56:09 2011
@@ -264,6 +264,28 @@ public class Java2WSDLCodegenEngine impl
         if (option != null) {
             java2WsdlBuilder.setMessagePartName(option.getOptionValue());
         }
+
+        option = loadOption(Java2WSDLConstants.PORT_TYPE_NAME_OPTION,
+                           Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG,
+                           optionsMap);
+        if (option != null) {
+            java2WsdlBuilder.setPortTypeName(option.getOptionValue());
+        }
+
+        option = loadOption(null,Java2WSDLConstants.SOAP11_BINDING_NAME_OPTION_LONG, optionsMap);
+        if (option != null) {
+            java2WsdlBuilder.setSoap11BindingName(option.getOptionValue());
+        }
+
+        option = loadOption(null,Java2WSDLConstants.SOAP12_BINDING_NAME_OPTION_LONG, optionsMap);
+        if (option != null) {
+            java2WsdlBuilder.setSoap12BindingName(option.getOptionValue());
+        }
+
+        option = loadOption(null,Java2WSDLConstants.REST_BINDING_NAME_OPTION_LONG, optionsMap);
+        if (option != null) {
+            java2WsdlBuilder.setRestBindingName(option.getOptionValue());
+        }
     }
     
     private Java2WSDLCommandLineOption loadOption(String shortOption, String longOption,

Modified: axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java (original)
+++ axis/axis2/java/core/trunk/modules/java2wsdl/src/org/apache/ws/java2wsdl/utils/Java2WSDLOptionsValidator.java Tue May 10 08:56:09 2011
@@ -75,6 +75,11 @@ public class Java2WSDLOptionsValidator i
                 Java2WSDLConstants.DISABLE_BINDING_REST.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.MESSAGE_PART_NAME_OPTION.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.MESSAGE_PART_NAME_OPTION_LONG.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.PORT_TYPE_NAME_OPTION.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.SOAP11_BINDING_NAME_OPTION_LONG.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.SOAP12_BINDING_NAME_OPTION_LONG.equalsIgnoreCase(optionType)||
+                Java2WSDLConstants.REST_BINDING_NAME_OPTION_LONG.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.SCHEMA_MAPPING_FILE_LOCATION_LONG.equalsIgnoreCase(optionType)||
                 Java2WSDLConstants.WSDL_VERSION_OPTION_LONG.equalsIgnoreCase(optionType)

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/Utils.java Tue May 10 08:56:09 2011
@@ -1332,6 +1332,12 @@ public class Utils {
         String serviceName = axisService.getName();
         String name = serviceName + "Soap11Binding";
 
+        Parameter parameter =
+                axisService.getParameter(Java2WSDLConstants.SOAP11_BINDING_NAME_OPTION_LONG);
+        if (parameter != null) {
+            name = (String) parameter.getValue();
+        }
+
         QName bindingName = new QName(name);
 
         AxisBinding axisBinding = (bindingCache != null) ? (AxisBinding)bindingCache
@@ -1379,6 +1385,12 @@ public class Utils {
         String serviceName = axisService.getName();
         String name = serviceName + "Soap12Binding";
 
+        Parameter parameter =
+                axisService.getParameter(Java2WSDLConstants.SOAP12_BINDING_NAME_OPTION_LONG);
+        if (parameter != null) {
+            name = (String) parameter.getValue();
+        }
+
         QName bindingName = new QName(name);
 
         AxisBinding axisBinding = (bindingCache != null) ? (AxisBinding)bindingCache
@@ -1427,6 +1439,12 @@ public class Utils {
         String serviceName = axisService.getName();
         String name = serviceName + "HttpBinding";
 
+        Parameter param =
+                axisService.getParameter(Java2WSDLConstants.REST_BINDING_NAME_OPTION_LONG);
+        if (param != null) {
+            name = (String) param.getValue();
+        }
+
         QName bindingName = new QName(name);
 
         AxisBinding axisBinding = (bindingCache != null) ? (AxisBinding)bindingCache

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Tue May 10 08:56:09 2011
@@ -388,8 +388,14 @@ public class AxisService2WSDL11 implemen
 		OMElement portType = fac.createOMElement(PORT_TYPE_LOCAL_NAME, wsdl);
 		defintions.addChild(portType);
 
-		portType.addAttribute(ATTRIBUTE_NAME, serviceName + PORT_TYPE_SUFFIX,
-				null);
+        String portTypeName = serviceName + PORT_TYPE_SUFFIX;
+
+        Parameter param = this.axisService.getParameter(Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG);
+        if (param != null){
+            portTypeName = (String) param.getValue();
+        }
+
+		portType.addAttribute(ATTRIBUTE_NAME, portTypeName, null);
 
 		addPolicyAsExtAttribute(axisService, portType, fac);
 
@@ -791,8 +797,15 @@ public class AxisService2WSDL11 implemen
 
 		QName qname = axisBinding.getName();
 		binding.addAttribute(ATTRIBUTE_NAME, qname.getLocalPart(), null);
-		binding.addAttribute("type", tns.getPrefix() + ":" + serviceName
-				+ PORT_TYPE_SUFFIX, null);
+
+        String portTypeName = serviceName + PORT_TYPE_SUFFIX;
+
+        Parameter param = this.axisService.getParameter(Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG);
+        if (param != null){
+            portTypeName = (String) param.getValue();
+        }
+
+		binding.addAttribute("type", tns.getPrefix() + ":" + portTypeName, null);
 
 		// Adding ext elements
 		addPolicyAsExtElement(axisBinding, binding);
@@ -932,8 +945,15 @@ public class AxisService2WSDL11 implemen
 
 		QName qname = axisBinding.getName();
 		binding.addAttribute(ATTRIBUTE_NAME, qname.getLocalPart(), null);
-		binding.addAttribute("type", tns.getPrefix() + ":" + serviceName
-				+ PORT_TYPE_SUFFIX, null);
+
+        String portTypeName = serviceName + PORT_TYPE_SUFFIX;
+
+        Parameter param = this.axisService.getParameter(Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG);
+        if (param != null){
+            portTypeName = (String) param.getValue();
+        }
+
+		binding.addAttribute("type", tns.getPrefix() + ":" + portTypeName, null);
 
 		// Adding ext elements
 		addPolicyAsExtElement(axisBinding, binding);
@@ -1072,8 +1092,15 @@ public class AxisService2WSDL11 implemen
 
 		QName qname = axisBinding.getName();
 		binding.addAttribute(ATTRIBUTE_NAME, qname.getLocalPart(), null);
-		binding.addAttribute("type", tns.getPrefix() + ":" + serviceName
-				+ PORT_TYPE_SUFFIX, null);
+
+        String portTypeName = serviceName + PORT_TYPE_SUFFIX;
+
+        Parameter param = this.axisService.getParameter(Java2WSDLConstants.PORT_TYPE_NAME_OPTION_LONG);
+        if (param != null){
+            portTypeName = (String) param.getValue();
+        }
+
+		binding.addAttribute("type", tns.getPrefix() + ":" + portTypeName, null);
 
 		OMElement httpBinding = fac.createOMElement("binding", http);
 		binding.addChild(httpBinding);

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java?rev=1101368&r1=1101367&r2=1101368&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/java2wsdl/Java2WSDLConstants.java Tue May 10 08:56:09 2011
@@ -141,6 +141,12 @@ public interface Java2WSDLConstants {
     String DISABLE_BINDING_SOAP12 = "disableSOAP12";
     String DISABLE_BINDING_REST = "disableREST";
 
+    String PORT_TYPE_NAME_OPTION = "ptn";
+    String PORT_TYPE_NAME_OPTION_LONG = "portTypeName";
+    String SOAP11_BINDING_NAME_OPTION_LONG = "soap11BindingName";
+    String SOAP12_BINDING_NAME_OPTION_LONG = "soap12BindingName";
+    String REST_BINDING_NAME_OPTION_LONG = "restBindingName";
+
     String DISALLOW_NILLABLE_ELEMENTS_OPTION = "dne";
     String DISALLOW_NILLABLE_ELEMENTS_OPTION_LONG = "disallowNillableElements";