[wsas-java-dev] svn commit r6111 - in trunk/wsas/java/modules:
core/conf distribution www/extensions/tools
www/extensions/tools/css www/extensions/tools/js
www/extensions/tools/xslt
svn at wso2.org
svn at wso2.org
Sun Aug 5 20:52:22 PDT 2007
Author: saminda
Date: Sun Aug 5 20:52:07 2007
New Revision: 6111
Added:
trunk/wsas/java/modules/core/conf/codegen_options.xml
trunk/wsas/java/modules/www/extensions/tools/xslt/wsdl2code2.xsl
Modified:
trunk/wsas/java/modules/core/conf/mime-mappings.xml
trunk/wsas/java/modules/distribution/pom.xml
trunk/wsas/java/modules/www/extensions/tools/css/wso2wsasTools.css
trunk/wsas/java/modules/www/extensions/tools/js/tools.js
trunk/wsas/java/modules/www/extensions/tools/menu.html
Log:
Tool for codegen
Added: trunk/wsas/java/modules/core/conf/codegen_options.xml
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/core/conf/codegen_options.xml Sun Aug 5 20:52:07 2007
@@ -0,0 +1,145 @@
+<codegen>
+ <!--<argument uiType="text | option | check | skip " default="true | false | custom value">
+ <name></name>
+ <description></description>
+ <values>
+ <value></value>
+ </values>
+ </argument>-->
+
+ <argument uiType="text">
+ <name>uri</name>
+ <description>A url or path to a WSDL</description>
+ </argument>
+ <argument uiType="skip">
+ <name>o</name>
+ <description>Specify a directory path for the generated code</description>
+ </argument>
+ <argument uiType="check">
+ <name>a</name>
+ <description>Generate async style code only (Default: off)</description>
+ </argument>
+ <argument uiType="check">
+ <name>s</name>
+ <description>Generate sync style code only (Default: off). Takes precedence over -a</description>
+ </argument>
+ <argument uiType="text" default="org.wso2.client">
+ <name>p</name>
+ <description>Specify a custom package name for the generated code</description>
+ </argument>
+ <argument uiType="option">
+ <name>l</name>
+ <description>Valid languages</description>
+ <values>
+ <value>java</value>
+ </values>
+ </argument>
+ <argument uiType="check">
+ <name>t</name>
+ <description>Generate a test case for the generated code</description>
+ </argument>
+ <argument uiType="check">
+ <name>ss</name>
+ <description>Generate server side code (i.e. skeletons)</description>
+ </argument>
+ <argument uiType="check">
+ <name>sd</name>
+ <description>Generate service descriptor (i.e. services.xml). Valid with -ss</description>
+ </argument>
+ <argument uiType="option">
+ <name>d</name>
+ <description>Valid databinding(s)</description>
+ <values>
+ <value>adb</value>
+ <value>xmlbeans</value>
+ <value>jibx</value>
+ <value>jaxme</value>
+ <value>jaxbri</value>
+ </values>
+ </argument>
+ <argument uiType="check">
+ <name>g</name>
+ <description>Generates all the classes. Valid only with -ss</description>
+ </argument>
+ <argument uiType="check">
+ <name>pn</name>
+ <description>Port name. Choose a specific port when there are multiple ports in the wsdl</description>
+ </argument>
+ <argument uiType="check">
+ <name>sn</name>
+ <description>Service name. Choose a specific service when there are multiple services in the wsdl</description>
+ </argument>
+ <argument uiType="check">
+ <name>u</name>
+ <description>Unpacks the databinding classes</description>
+ </argument>
+ <argument uiType="text">
+ <name>r</name>
+ <description>Specify a repository against which code is generated</description>
+ </argument>
+ <argument uiType="text">
+ <name>ns2p</name>
+ <description>ns1=pkg1,ns2=pkg2 .Specify a custom package name for each namespace specified in the wsdls schema</description>
+ </argument>
+ <argument uiType="check">
+ <name>ssi</name>
+ <description>Generate an interface for the service implementation</description>
+ </argument>
+ <argument uiType="option">
+ <name>wv</name>
+ <description>WSDL Version</description>
+ <values>
+ <value>1.1</value>
+ <value>2</value>
+ <value>2.0</value>
+ </values>
+ </argument>
+ <argument uiType="skip">
+ <name>S</name>
+ <description>Specify a directory path for generated source</description>
+ </argument>
+ <argument uiType="skip">
+ <name>R</name>
+ <description>Specify a directory path for generated resources</description>
+ </argument>
+ <argument uiType="skip">
+ <name>em</name>
+ <description>Specify an external mapping file</description>
+ </argument>
+ <argument uiType="skip">
+ <name>f</name>
+ <description>Flattens the generated files</description>
+ </argument>
+ <argument uiType="check">
+ <name>uw</name>
+ <description>Switch on un-wrapping</description>
+ </argument>
+ <argument uiType="text">
+ <name>xsdconfig</name>
+ <description>Use XMLBeans .xsdconfig file. Valid only with -d xmlbeans</description>
+ </argument>
+ <argument uiType="skip">
+ <name>ap</name>
+ <description>Generate code for all ports</description>
+ </argument>
+ <argument uiType="skip">
+ <name>or</name>
+ <description>Overwrite the existing classes</description>
+ </argument>
+ <argument uiType="skip">
+ <name>b</name>
+ <description>Generate Axis 1.x backword compatible code</description>
+ </argument>
+ <argument uiType="skip">
+ <name>sp</name>
+ <description>Suppress namespace prefixes (Optimzation that reduces size of soap request/response)</description>
+ </argument>
+ <argument uiType="text">
+ <name>Emp</name>
+ <description>Package name for ADB. Extension mapper package name</description>
+ </argument>
+ <argument uiType="check">
+ <name>Eosv</name>
+ <description>(for ADB) - off strict validation</description>
+ </argument>
+</codegen>
\ No newline at end of file
Modified: trunk/wsas/java/modules/core/conf/mime-mappings.xml
==============================================================================
--- trunk/wsas/java/modules/core/conf/mime-mappings.xml (original)
+++ trunk/wsas/java/modules/core/conf/mime-mappings.xml Sun Aug 5 20:52:07 2007
@@ -610,4 +610,8 @@
<Extension>zip</Extension>
<MimeType>application/zip</MimeType>
</Mapping>
+ <Mapping>
+ <Extension>aar</Extension>
+ <MimeType>application/zip</MimeType>
+ </Mapping>
</MimeMappings>
\ No newline at end of file
Modified: trunk/wsas/java/modules/distribution/pom.xml
==============================================================================
--- trunk/wsas/java/modules/distribution/pom.xml (original)
+++ trunk/wsas/java/modules/distribution/pom.xml Sun Aug 5 20:52:07 2007
@@ -470,6 +470,7 @@
<fileset file="../core/conf/server.xml"/>
<fileset file="../core/conf/axis2.xml"/>
<fileset file="../core/conf/wso2wsas.properties"/>
+ <fileset file="../core/conf/codegen_options.xml"/>
</copy>
<echo message="######################### END ################################"/>
Modified: trunk/wsas/java/modules/www/extensions/tools/css/wso2wsasTools.css
==============================================================================
--- trunk/wsas/java/modules/www/extensions/tools/css/wso2wsasTools.css (original)
+++ trunk/wsas/java/modules/www/extensions/tools/css/wso2wsasTools.css Sun Aug 5 20:52:07 2007
@@ -9,4 +9,8 @@
div#navigation ul.submenu a.menu_wsdl2code_class {
background: url( ../images/code.gif) transparent no-repeat 10px 5px;
+}
+
+div#navigation ul.submenu a.menu_wsdl2code_class:hover {
+ background-color: #A3B2CC;
}
\ No newline at end of file
Modified: trunk/wsas/java/modules/www/extensions/tools/js/tools.js
==============================================================================
--- trunk/wsas/java/modules/www/extensions/tools/js/tools.js (original)
+++ trunk/wsas/java/modules/www/extensions/tools/js/tools.js Sun Aug 5 20:52:07 2007
@@ -2,7 +2,7 @@
* This js has the tools related js functions
*/
-if (typeof wso2 == "undefined"){
+if (typeof wso2 == "undefined") {
var wso2 = {};
}
if (typeof wso2.wsas == "undefined") {
@@ -11,6 +11,48 @@
// static tools methods
wso2.wsas.Tools = {
+ wsdl2code2 : function(thisObj, index) {
+
+ if (thisObj && index) {
+ renderSelectedMenuItem(thisObj, index);
+ gatherHistoryObject(thisObj.id, index);
+ }
+
+ var body_xml = '<req:getCodegenOptions xmlns:req="http://org.wso2.wsf/tools">\n' +
+ '</req:getCodegenOptions>\n';
+
+ var callURL = serverURL + "/" + "WSDL2Code" ;
+ new wso2.wsf.WSRequest(callURL, "urn:getCodegenOptions", body_xml, wsdl2code2Callback);
+ },
+
+ startCodegen : function(options) {
+ var bodyXML = '<req:codegen xmlns:req="http://org.wso2.wsf/tools">\n';
+ for (var o in options) {
+ bodyXML += '<options>' + o + '</options>\n';
+ var oVal = options[o];
+ if (oVal != null && oVal.length != 0) {
+ bodyXML += '<options>' + oVal + '</options>\n';
+ }
+ }
+ bodyXML += '</req:codegen>';
+ var buttonObj = document.getElementById('genericCodegenButtonId');
+ if (buttonObj != null) {
+ buttonObj.disabled = true;
+ }
+ var callURL = serverURL + "/" + "WSDL2Code" ;
+ wso2.wsf.Util.cursorWait();
+ new wso2.wsf.WSRequest(callURL, "urn:codegen", bodyXML, startCodegenCallback, [buttonObj], this.onError);
+
+ },
+
+ onError : function() {
+ this.defaultError.call(this);
+ var buttonObj = this.params[0];
+ if (buttonObj != null) {
+ buttonObj.disabled = false;
+ }
+ },
+
wsdl2code : function(thisObj, index) {
if (thisObj && index) {
@@ -34,7 +76,7 @@
var divObject = document.getElementById("divWSDL2Code");
var xsltHelperObj = new wso2.wsf.XSLTHelper();
- xsltHelperObj.transform(divObject, tmpTransformationNode, "wsdl2code.xsl",false,"tools");
+ xsltHelperObj.transform(divObject, tmpTransformationNode, "wsdl2code.xsl", false, "tools");
wso2.wsf.Util.showOnlyOneMain(document.getElementById("divWSDL2Code"));
},
@@ -124,4 +166,23 @@
buttonObj.disabled = false;
}
window.location = URL + responseTextValue;
+}
+
+function wsdl2code2Callback() {
+ var divObject = document.getElementById("divWSDL2Code");
+ var xsltHelperObj = new wso2.wsf.XSLTHelper();
+ xsltHelperObj.transform(divObject, this.req.responseXML, "wsdl2code2.xsl", false, "tools");
+ wso2.wsf.Util.showOnlyOneMain(document.getElementById("divWSDL2Code"));
+
+}
+
+function startCodegenCallback() {
+ //response will be a link and it will call the download dialog
+ var data = this.req.responseXML;
+ var responseTextValue = data.getElementsByTagName("return")[0].firstChild.nodeValue;
+ var buttonObj = this.params[0];
+ if (buttonObj != null) {
+ buttonObj.disabled = false;
+ }
+ window.location = URL + responseTextValue;
}
\ No newline at end of file
Modified: trunk/wsas/java/modules/www/extensions/tools/menu.html
==============================================================================
--- trunk/wsas/java/modules/www/extensions/tools/menu.html (original)
+++ trunk/wsas/java/modules/www/extensions/tools/menu.html Sun Aug 5 20:52:07 2007
@@ -1,5 +1,6 @@
<li class="menu_tools_class"><span> Tools</span>
<ul class="submenu">
- <li><a href="#" id="menu_wsdl2code_class_id" onclick="javascript:wso2.wsas.Tools.wsdl2code(this,13); return false;" class="menu_wsdl2code_class" title="WSDL To Code"> WSDL2Code</a></li>
+ <!--<li><a href="#" id="menu_wsdl2code_class_id" onclick="javascript:wso2.wsas.Tools.wsdl2code(this,13); return false;" class="menu_wsdl2code_class" title="WSDL To Code"> WSDL2Code</a></li>-->
+ <li><a href="#" id="menu_wsdl2code_class_id" onclick="javascript:wso2.wsas.Tools.wsdl2code2(this,13); return false;" class="menu_wsdl2code_class" title="WSDL To Code"> WSDL2Code</a></li>
</ul>
</li>
\ No newline at end of file
Added: trunk/wsas/java/modules/www/extensions/tools/xslt/wsdl2code2.xsl
==============================================================================
--- (empty file)
+++ trunk/wsas/java/modules/www/extensions/tools/xslt/wsdl2code2.xsl Sun Aug 5 20:52:07 2007
@@ -0,0 +1,129 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:ns="http://org.wso2.wsf/tools">
+ <xsl:output method="html"/>
+
+ <xsl:param name="idSuffix">wsf_tools_id</xsl:param>
+ <xsl:param name="namePrefix">-</xsl:param>
+
+ <xsl:template match="ns:getCodegenOptionsResponse/return">
+ <!-- Link header to be populated by java script -->
+ <div>
+ <h2>WSDL2Code</h2>
+ </div>
+ <div id="formset">
+ <form>
+ <fieldset>
+ <legend>WSDL To Code Options</legend>
+ <table class="styledLeft">
+ <thead>
+ <tr>
+ <th>Option</th>
+ <th>Description</th>
+ <th>Select/Type Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <xsl:apply-templates select="codegen"/>
+ </tbody>
+ </table>
+ <xsl:call-template name="buttonRow">
+ <xsl:with-param name="parmCodegen" select="codegen"/>
+ </xsl:call-template>
+
+ </fieldset>
+ </form>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="codegen">
+ <xsl:apply-templates select="argument"/>
+ </xsl:template>
+
+ <xsl:template name="buttonRow">
+ <xsl:param name="parmCodegen"/>
+ <div class="buttonrow">
+ <input>
+ <xsl:attribute name="type">submit</xsl:attribute>
+ <xsl:attribute name="value">Generate</xsl:attribute>
+ <xsl:attribute name="id">genericCodegenButtonId</xsl:attribute>
+ <xsl:attribute name="onclick">
+ var options = new Object();
+ <xsl:for-each select="$parmCodegen/argument">
+ <xsl:variable name="uiType" select="./@uiType"/>
+ <xsl:variable name="name" select="normalize-space(name)"/>
+ <xsl:if test="not($uiType='skip')">
+ <xsl:choose>
+ <xsl:when test="$uiType='text'">
+ var obj_<xsl:value-of select="$name"/> = document.getElementById('<xsl:value-of select="$name"/>_<xsl:value-of select="$idSuffix"/>');
+ if (obj_<xsl:value-of select="$name"/>.value != '') {
+ options['<xsl:value-of select="$namePrefix"/><xsl:value-of select="$name"/>'] = obj_<xsl:value-of select="$name"/>.value;
+ }
+ </xsl:when>
+ <xsl:when test="$uiType='check'">
+ var obj_<xsl:value-of select="$name"/> = document.getElementById('<xsl:value-of select="$name"/>_<xsl:value-of select="$idSuffix"/>');
+ if (obj_<xsl:value-of select="$name"/>.checked){
+ options['<xsl:value-of select="$namePrefix"/><xsl:value-of select="$name"/>'] = "";
+ }
+ </xsl:when>
+ <xsl:when test="$uiType='option'">
+ var obj_<xsl:value-of select="$name"/> = document.getElementById('<xsl:value-of select="$name"/>_<xsl:value-of select="$idSuffix"/>');
+ options['<xsl:value-of select="$namePrefix"/><xsl:value-of select="$name"/>'] = obj_<xsl:value-of select="$name"/>[obj_<xsl:value-of select="$name"/>.selectedIndex].value;
+ </xsl:when>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+ <!-- TODO fill the logic here-->
+ wso2.wsas.Tools.startCodegen(options);
+ return false;
+ </xsl:attribute>
+ </input>
+ </div>
+ </xsl:template>
+
+ <!-- This will be a table rows-->
+ <xsl:template match="argument">
+ <xsl:variable name="uiType" select="./@uiType"/>
+ <xsl:if test="not($uiType='skip')">
+ <xsl:variable name="description" select="normalize-space(description)"/>
+ <xsl:variable name="name" select="normalize-space(name)"/>
+ <tr>
+ <td>
+ <xsl:value-of select="$namePrefix"/><xsl:value-of select="$name"/>
+ </td>
+ <td>
+ <xsl:value-of select="$description"/>
+ </td>
+ <td>
+ <xsl:choose>
+ <xsl:when test="$uiType='text'">
+ <input>
+ <xsl:attribute name="type">text</xsl:attribute>
+ <xsl:attribute name="size">40</xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="$name"/>_<xsl:value-of select="$idSuffix"/></xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:when test="$uiType='check'">
+ <input>
+ <xsl:attribute name="type">checkbox</xsl:attribute>
+ <xsl:attribute name="id"><xsl:value-of select="$name"/>_<xsl:value-of select="$idSuffix"/></xsl:attribute>
+ </input>
+ </xsl:when>
+ <xsl:when test="$uiType='option'">
+ <select>
+ <xsl:attribute name="id"><xsl:value-of select="$name"/>_<xsl:value-of select="$idSuffix"/></xsl:attribute>
+ <xsl:for-each select="values/value">
+ <option>
+ <xsl:variable name="opValue"><xsl:value-of select="."/></xsl:variable>
+ <xsl:attribute name="value"><xsl:value-of select="$opValue"/></xsl:attribute>
+ <xsl:value-of select="$opValue"/>
+ </option>
+ </xsl:for-each>
+ </select>
+ </xsl:when>
+ </xsl:choose>
+ </td>
+ </tr>
+ </xsl:if>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
More information about the Wsas-java-dev
mailing list