Author: sergeyb Date: Thu Mar 28 09:22:16 2013 New Revision: 1462004 URL: http://svn.apache.org/r1462004 Log: Merged revisions 1461993 via svnmerge from https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes
................ r1461993 | sergeyb | 2013-03-28 11:48:58 +0300 (Thu, 28 Mar 2013) | 9 lines Merged revisions 1461980 via svnmerge from https://svn.apache.org/repos/asf/cxf/trunk ........ r1461980 | sergeyb | 2013-03-28 11:39:05 +0300 (Thu, 28 Mar 2013) | 1 line [CXF-4932] Updating SourceGenerator to check for more illegal Java parameter names, patch on behalf of Emmanuel Texier applies; plus minor update to the way a verbose flag is checked and adding 'encoding' option ........ ................ Modified: cxf/branches/2.6.x-fixes/ (props changed) cxf/branches/2.6.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/jaxrs-toolspec.xml cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Thu Mar 28 09:22:16 2013 @@ -0,0 +1,2 @@ +/cxf/branches/2.7.x-fixes:1461993 +/cxf/trunk:1461980 Propchange: cxf/branches/2.6.x-fixes/ ------------------------------------------------------------------------------ Binary property 'svnmerge-integrated' - no diff available. Modified: cxf/branches/2.6.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java?rev=1462004&r1=1462003&r2=1462004&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java (original) +++ cxf/branches/2.6.x-fixes/tools/common/src/main/java/org/apache/cxf/tools/common/ToolContext.java Thu Mar 28 09:22:16 2013 @@ -160,10 +160,11 @@ public class ToolContext { } public boolean isVerbose() { - if (get(ToolConstants.CFG_VERBOSE) == null) { + Object verboseProperty = get(ToolConstants.CFG_VERBOSE); + if (verboseProperty == null) { return false; } else { - return get(ToolConstants.CFG_VERBOSE) == ToolConstants.CFG_VERBOSE; + return ToolConstants.CFG_VERBOSE.equals(verboseProperty); } } Modified: cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java?rev=1462004&r1=1462003&r2=1462004&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java (original) +++ cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/WadlToolConstants.java Thu Mar 28 09:22:16 2013 @@ -27,6 +27,8 @@ public final class WadlToolConstants { public static final String CFG_COMPILE = ToolConstants.CFG_COMPILE; public static final String CFG_CLASSDIR = ToolConstants.CFG_CLASSDIR; public static final String CFG_XJC_ARGS = ToolConstants.CFG_XJC_ARGS; + public static final String CFG_VERBOSE = ToolConstants.CFG_VERBOSE; + public static final String CFG_ENCODING = ToolConstants.CFG_ENCODING; /** * Default Modified: cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java?rev=1462004&r1=1462003&r2=1462004&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java (original) +++ cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/SourceGenerator.java Thu Mar 28 09:22:16 2013 @@ -88,6 +88,7 @@ import org.apache.cxf.common.xmlschema.S import org.apache.cxf.common.xmlschema.XmlSchemaConstants; import org.apache.cxf.helpers.CastUtils; import org.apache.cxf.helpers.DOMUtils; +import org.apache.cxf.helpers.JavaUtils; import org.apache.cxf.jaxrs.model.wadl.WadlGenerator; import org.apache.cxf.jaxrs.utils.JAXRSUtils; import org.apache.cxf.jaxrs.utils.ResourceUtils; @@ -944,7 +945,12 @@ public class SourceGenerator { addImport(imports, List.class.getName()); type = "List<" + type + ">"; } - String paramName = name.replaceAll("[\\.\\-]", "_"); + String paramName; + if (JavaUtils.isJavaKeyword(name)) { + paramName = name.concat("_arg"); + } else { + paramName = name.replaceAll("[:\\.\\-]", "_"); + } sbCode.append(type).append(" ").append(paramName); if (i + 1 < inParamEls.size()) { sbCode.append(", "); Modified: cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/jaxrs-toolspec.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/jaxrs-toolspec.xml?rev=1462004&r1=1462003&r2=1462004&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/jaxrs-toolspec.xml (original) +++ cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/main/java/org/apache/cxf/tools/wadlto/jaxrs/jaxrs-toolspec.xml Thu Mar 28 09:22:16 2013 @@ -210,90 +210,35 @@ Examples: <switch>supportMultipleXmlReps</switch> </option> -<!-- -TODO: consider implementing most of the following options - - <option id="reserveClass" maxOccurs="unbounded"> + <option id="xjc" maxOccurs="unbounded"> <annotation> - Reserve a class name to keep the code generator from generating - a class of the given name. In name cases, a binding file or - use of -autoNameResolution flag may be necessary for the - code generator to completely generate usable code. + Specifies a comma separated list of arguments that are passed directly to XJC when the + JAXB data binding is used. This option causes XJC to load additional plugins that + augment code generation. For example to load the toString(ts) plugin that will add a toString() + method to all generated types the following <xjc arguments> would + be used: + -xjc-Xts + A list of available XJC plugins can be obtained by using -xjc-X. </annotation> - <switch>reserveClass</switch> - <associatedArgument placement="afterSpace"> - <annotation>class-name</annotation> + <associatedArgument placement="immediate"> + <annotation>xjc-arguments</annotation> </associatedArgument> - </option> - <option id="autoNameResolution" maxOccurs="1"> - <annotation> - Specifies that the tool will attempt to resolve class naming conflicts - without requiring the use of binding customizations. - </annotation> - <switch>autoNameResolution</switch> + <switch>xjc</switch> </option> - - <option id="server" maxOccurs="1"> - <annotation> - Specifies that server code is generated. - </annotation> - <switch>server</switch> - </option> - - <option id="client" maxOccurs="1"> - <annotation> - Specifies that client code is generated. - </annotation> - <switch>client</switch> - </option> - - <option id="all" maxOccurs="1"> - <annotation> - Specifies that interfaces, types , service, server , dummy impl, client - and ant script are generated. - </annotation> - <switch>all</switch> - </option> - - <option id="nexclude" maxOccurs="unbounded"> - <annotation> - Specifies a WSDL namespace to exclude when generating code. This - option can be specified multiple times. Optionally - specify the Java package name to use for the WSDL namespace. - </annotation> - <switch>nexclude</switch> - <associatedArgument placement="afterSpace"> - <annotation>schema-namespace [= java-package-name]</annotation> - </associatedArgument> - </option> - - <option id="notypes" maxOccurs="1"> - <annotation>Turns off generating types</annotation> - <switch>noTypes</switch> - </option> - <option id="defaultns" maxOccurs="1"> + <option id="encoding" maxOccurs="1"> <annotation> - Enables loading the default namespace package name mapping. The default is true. + Specifies the charset encoding to use when generating java sources </annotation> - <switch>dns</switch> + <switch>encoding</switch> <associatedArgument placement="afterSpace"> - <annotation>Default value is true</annotation> - <valueenum>true|false</valueenum> + <annotation>encoding</annotation> </associatedArgument> </option> + + <!-- - <option id="defaultex" maxOccurs="1"> - <annotation> - Enable loading the default excludes namespace mapping. The default is true.</annotation> - <switch>dex</switch> - <associatedArgument placement="afterSpace"> - <annotation>(true, false)</annotation> - <valueenum>true|false</valueenum> - </associatedArgument> - </option> - <option id="validate" maxOccurs="1"> <annotation> Specifies that the WADL is validated before generating the code. Using @@ -302,29 +247,8 @@ TODO: consider implementing most of the <switch>validate</switch> </option> - <option id="newonly" maxOccurs="1"> - <annotation> - Specifies that existing code will not be over written. NOTE: You will have to solve any resulting compilation problems by yourself - </annotation> - <switch>keep</switch> - </option> ---> - <option id="xjc" maxOccurs="unbounded"> - <annotation> - Specifies a comma separated list of arguments that are passed directly to XJC when the - JAXB data binding is used. This option causes XJC to load additional plugins that - augment code generation. For example to load the toString(ts) plugin that will add a toString() - method to all generated types the following <xjc arguments> would - be used: - -xjc-Xts - A list of available XJC plugins can be obtained by using -xjc-X. - </annotation> - <associatedArgument placement="immediate"> - <annotation>xjc-arguments</annotation> - </associatedArgument> - <switch>xjc</switch> - </option> - + --> + </optionGroup> <optionGroup id="common_options"> <option id="help" maxOccurs="1"> @@ -364,4 +288,4 @@ TODO: consider implementing most of the </annotation> </argument> </usage> -</toolspec> \ No newline at end of file +</toolspec> Modified: cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml URL: http://svn.apache.org/viewvc/cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml?rev=1462004&r1=1462003&r2=1462004&view=diff ============================================================================== --- cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml (original) +++ cxf/branches/2.6.x-fixes/tools/wadlto/jaxrs/src/test/resources/wadl/bookstore.xml Thu Mar 28 09:22:16 2013 @@ -126,7 +126,7 @@ required="true"> </param> <param name="provider.bar" style="query" required="true" type="xs:int"/> <param name="a" style="query" repeating="true" type="xs:string"/> - <param name="b" style="query" repeating="true" type="xs:long"/> + <param name="b:c" style="query" repeating="true" type="xs:long"/> <representation mediaType="application/xml" element="prefix1:theBook2"> <doc>InputBook</doc> </representation>
