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 sa...@apache.org on 2012/05/02 14:41:56 UTC

svn commit: r1333017 - in /axis/axis2/java/core/trunk/modules: codegen/src/org/apache/axis2/wsdl/ codegen/src/org/apache/axis2/wsdl/i18n/ codegen/src/org/apache/axis2/wsdl/util/ kernel/src/org/apache/axis2/util/

Author: sagara
Date: Wed May  2 12:41:56 2012
New Revision: 1333017

URL: http://svn.apache.org/viewvc?rev=1333017&view=rev
Log:
Fixed AXIS2-5311 - Now WSDL2JAVA support for Java system properties through -D option. 

Modified:
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
    axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
    axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java?rev=1333017&r1=1333016&r2=1333017&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/WSDL2Code.java Wed May  2 12:41:56 2012
@@ -40,6 +40,7 @@ public class WSDL2Code {
         CommandLineOptionParser commandLineOptionParser = new CommandLineOptionParser(
                 args);
        checkAuthentication(commandLineOptionParser);  
+       setSystemProperties(commandLineOptionParser);
       //If it is a JAX-WS code generation request call WSimportTool.
       if (isJwsOptionEnabled(commandLineOptionParser)){
          new JAXWSCodeGenerationEngine(commandLineOptionParser, args).generate();
@@ -56,7 +57,7 @@ public class WSDL2Code {
 
         System.out.println(CodegenMessages.getMessage("wsdl2code.arg"));
         System.out.println(CodegenMessages.getMessage("wsdl2code.arg1"));
-        for (int i = 2; i <= 52; i++) {
+        for (int i = 2; i <= 53; i++) {
             System.out.println("  " + CodegenMessages.getMessage("wsdl2code.arg" + i));
         }
     }
@@ -140,5 +141,25 @@ public class WSDL2Code {
             });
         }
     }
+    
+    private static void setSystemProperties(CommandLineOptionParser commandLineOptionParser) {
+        Map<String, CommandLineOption> allOptions = commandLineOptionParser.getAllOptions();
+        // System properties follow "-Dproperty=value" format, only key is required.
+        if (allOptions != null) {
+            for (String key : allOptions.keySet()) {
+                if (key != null
+                        && key.length() > 0
+                        && key.startsWith(CommandLineOptionConstants.WSDL2JavaConstants.SYSTEM_PROPERTY_PREFIX)
+                        && key.contains("=")) {
+                    int splitIndex = key.indexOf("=");
+                    String pKey = key.substring(1, splitIndex);
+                    String pValue = key.substring(splitIndex + 1);
+                    if (pKey != null && pValue != null) {
+                        System.setProperty(pKey, pValue);
+                    }
+                }
+            }
+        }
+    }
    
 }

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?rev=1333017&r1=1333016&r2=1333017&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties Wed May  2 12:41:56 2012
@@ -86,7 +86,8 @@ wsdl2code.arg48=  -sin <interface-name> 
 wsdl2code.arg49=  -scn <class-name>        Skeleton class name - used to specify a name for skeleton class other than the default one
 wsdl2code.arg50=  -oaa <override-absolute-address>  -change the absolute http addresses to local file addresses generated by wsdl2java tool
 wsdl2code.arg51=  -ebc <exception-base-class>  -generated Exceptions are inherited from this exception rather than the java.lang.Exception class
-wsdl2code.arg52=  -uon <use-operation-name>  -by default the first letter of the generated method name changeed to lowercase. This option stops that and make it same as operation name 
+wsdl2code.arg52=  -uon <use-operation-name>  -by default the first letter of the generated method name changeed to lowercase. This option stops that and make it same as operation name
+wsdl2code.arg53=  -D<Key>=<Value>          -Java system properties
 
 ################## prop file loader #################################
 propfileload.frameworkMismatch=Number of frameworks and extension names do not match!

Modified: axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java?rev=1333017&r1=1333016&r2=1333017&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java (original)
+++ axis/axis2/java/core/trunk/modules/codegen/src/org/apache/axis2/wsdl/util/WSDL2JavaOptionsValidator.java Wed May  2 12:41:56 2012
@@ -31,7 +31,8 @@ public class WSDL2JavaOptionsValidator i
         boolean invalid;
         String optionType = option.getOptionType();
 
-        if (optionType.startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)) {
+        if (optionType.startsWith(WSDL2JavaConstants.EXTRA_OPTIONTYPE_PREFIX)
+                || optionType.startsWith(WSDL2JavaConstants.SYSTEM_PROPERTY_PREFIX)) {
             invalid = false;
         } else {
             invalid = !(WSDL2JavaConstants.All_PORTS_OPTION.equalsIgnoreCase(optionType) ||

Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java?rev=1333017&r1=1333016&r2=1333017&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/util/CommandLineOptionConstants.java Wed May  2 12:41:56 2012
@@ -97,6 +97,7 @@ public interface CommandLineOptionConsta
 
         String INVALID_OPTION = "INVALID_OPTION";
         String EXTRA_OPTIONTYPE_PREFIX = "E";
+        String SYSTEM_PROPERTY_PREFIX = "D";
 
         String WSDL_VERSION_2 = "2.0";
         String WSDL_VERSION_2_OPTIONAL = "2";