You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by aj...@apache.org on 2006/07/10 15:07:15 UTC
svn commit: r420519 - in /webservices/axis2/trunk/java/modules:
adb-codegen/src/org/apache/axis2/schema/template/
codegen/src/org/apache/axis2/wsdl/codegen/
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl/codegen/ex...
Author: ajith
Date: Mon Jul 10 06:07:15 2006
New Revision: 420519
URL: http://svn.apache.org/viewvc?rev=420519&view=rev
Log:
1. Updated the templates and the emitter to handle unwrapping in server side. Now the generated code for the message receivers can handle multiple inputs.
I. Added several new methods to the ADBDatabindingTemplate.xsl
2.Added a new property to the codegen-config.properties to store the names of the databinding frameworks that support unwrapping.
Now unwrapping is supported for server side as well but only for inputs. Needs a test case to verify the functionality.
Modified:
webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java
Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBDatabindingTemplate.xsl Mon Jul 10 06:07:15 2006
@@ -3,28 +3,24 @@
<!-- ################################################################################# -->
<!-- ############################ ADB template ############################## -->
<xsl:template match="databinders[@dbtype='adb']">
+ <xsl:variable name="serverside"><xsl:value-of select="@isserverside"/></xsl:variable>
- <xsl:variable name="base64"><xsl:value-of select="base64Elements/name"/></xsl:variable>
- <xsl:if test="$base64">
- private static javax.xml.namespace.QName[] qNameArray = {
- <xsl:for-each select="base64Elements/name">
- <xsl:if test="position()>1">,</xsl:if>new javax.xml.namespace.QName("<xsl:value-of select="@ns-url"/>","<xsl:value-of select="@localName"/>")
- </xsl:for-each>
- };
- </xsl:if>
<!-- generate toOM for only non parts and non primitives!!! -->
<xsl:for-each select="param[@type!='' and not(@primitive) and not(@partname)]">
private org.apache.axiom.om.OMElement toOM(<xsl:value-of select="@type"/> param, boolean optimizeContent){
- return param.getOMElement(param.MY_QNAME,
+ return param.getOMElement(<xsl:value-of select="@type"/>.MY_QNAME,
org.apache.axiom.om.OMAbstractFactory.getOMFactory());
}
</xsl:for-each>
<xsl:for-each select="opnames/name">
+
<xsl:variable name="opname"><xsl:value-of select="."/></xsl:variable>
<xsl:variable name="opnsuri"><xsl:value-of select="@opnsuri"/></xsl:variable>
+ <xsl:variable name="paramcount"><xsl:value-of select="count(../../param[@type!='' and @direction='in' and @opname=$opname])"/></xsl:variable>
+ <xsl:if test="not($serverside)">
<xsl:choose>
- <xsl:when test="count(../../param[@type!='' and @direction='in' and @opname=$opname])=1">
+ <xsl:when test="$paramcount=1">
<!-- Assumption - The ADBBean here is always an element based bean -->
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='in' and @opname=$opname]/@type"/> param, boolean optimizeContent){
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
@@ -32,7 +28,7 @@
return emptyEnvelope;
}
</xsl:when>
- <xsl:when test="count(../../param[@type!='' and @direction='in' and @opname=$opname]) > 1">
+ <xsl:when test="$paramcount > 1">
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
<xsl:for-each select="../../param[@type!='' and @direction='in' and @opname=$opname]"><xsl:value-of select="@type"/> param<xsl:value-of select="position()"/>,</xsl:for-each>
boolean optimizeContent){
@@ -86,8 +82,11 @@
}
</xsl:otherwise>
</xsl:choose>
+ </xsl:if>
+ <!-- this piece of logic needs to be generated only for the server side-->
+ <xsl:if test="$serverside">
<xsl:choose>
- <xsl:when test="count(../../param[@type!='' and @direction='out' and @opname=$opname])=1">
+ <xsl:when test="count(../../param[@type!='' and @direction='out' and @opname=$opname])=1">
<!-- Assumption - The ADBBean here is always an element based bean -->
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, <xsl:value-of select="../../param[@type!='' and @direction='out' and @opname=$opname]/@type"/> param, boolean optimizeContent){
org.apache.axiom.soap.SOAPEnvelope emptyEnvelope = factory.getDefaultEnvelope();
@@ -95,8 +94,10 @@
return emptyEnvelope;
}
</xsl:when>
- </xsl:choose>
- </xsl:for-each>
+ </xsl:choose>
+ </xsl:if>
+ </xsl:for-each>
+
private java.lang.Object fromOM(
org.apache.axiom.om.OMElement param,
@@ -104,19 +105,27 @@
java.util.Map extraNamespaces){
try {
- <xsl:for-each select="param[not(@primitive)]">
- <xsl:if test="@type!=''">
+ <xsl:for-each select="param[not(@primitive) and @type!='']">
if (<xsl:value-of select="@type"/>.class.equals(type)){
return <xsl:value-of select="@type"/>.Factory.parse(param.getXMLStreamReaderWithoutCaching());
}
- </xsl:if>
- </xsl:for-each>
+ </xsl:for-each>
} catch (Exception e) {
throw new RuntimeException(e);
}
return null;
}
+
+ <!-- generate convert methods to convert from the primitive types -->
+ <xsl:for-each select="param[@primitive and @type!='']">
+ private <xsl:value-of select="@type"/> convertTo<xsl:value-of select="@shorttype"/>(
+ org.apache.axiom.om.OMElement param
+ ){
+ return org.apache.axis2.databinding.utils.ConverterUtil.
+ convertTo<xsl:value-of select="@shorttype"/>(param.getText());
+ }
+ </xsl:for-each>
</xsl:template>
</xsl:stylesheet>
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties Mon Jul 10 06:07:15 2006
@@ -24,13 +24,15 @@
# Note - these will be loaded from the org.apache.axis2.wsdl.codegen.schema package.
# so whatever the third party schema's that are listed here should be present there
codegen.thirdparty.schema=xmime.xsd,soap-enc.xsd
-#
#####################################################################################################################
#####################################################################################################################
# Codegen data binding frameworks and their related information
# The names of the codegeneration frameworks in lexical order
# these are the names that should be passed onto the tool as arguments as well
codegen.databinding.frameworks=adb,xmlbeans,jaxme,jibx,jaxbri,none
+# this property keeps the names of the databinding frameworks which support
+# unwrapping
+codegen.databinding.unwrap.supported=adb
# the related extensions for the specified data binding frameworks above
# Note - these are in the lexical order of the framework names. There is an implicit assumption
# that a given databinding framework will be processed only by one extension
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Mon Jul 10 06:07:15 2006
@@ -404,7 +404,7 @@
// add the databind supporters. Now the databind supporters are completly contained inside
// the stubs implementation and not visible outside
- rootElement.appendChild(createDOMElementforDatabinders(doc));
+ rootElement.appendChild(createDOMElementforDatabinders(doc,false));
doc.appendChild(rootElement);
return doc;
@@ -484,7 +484,7 @@
// add the databind supporters. Now the databind supporters are completly contained inside
// the stubs implementation and not visible outside
- rootElement.appendChild(createDOMElementforDatabinders(doc));
+ rootElement.appendChild(createDOMElementforDatabinders(doc,false));
Object moduleCodegenPolicyExtensionElement;
@@ -952,7 +952,8 @@
boolean isOpsFound = loadOperations(doc, rootElement, mep);
//put the result in the property map
infoHolder.put(mep, isOpsFound ? Boolean.TRUE : Boolean.FALSE);
- rootElement.appendChild(createDOMElementforDatabinders(doc));
+ //create the databinder element with serverside as true
+ rootElement.appendChild(createDOMElementforDatabinders(doc,true));
//attach a list of faults
rootElement.appendChild(getUniqueListofFaults(doc));
@@ -967,11 +968,11 @@
}
/**
- * create a dom element for databinders
+ * create a dom element for databinders. This is called by other
*
* @param doc
*/
- protected Element createDOMElementforDatabinders(Document doc) {
+ protected Element createDOMElementforDatabinders(Document doc,boolean isServerside) {
// First Iterate through the operations and find the relevant fromOM and toOM methods to be generated
Map parameterMap = new HashMap();
@@ -989,6 +990,7 @@
//add an attribute to the parameter saying that this is an
//input
addAttribute(doc,"direction","in",inputParamElement[i]);
+ //add the short type name
parameterMap.put(inputParamElement[i].getAttribute("type"),
inputParamElement[i]);
@@ -1039,9 +1041,15 @@
}
Element rootElement = doc.createElement("databinders");
-
+ //add the db type attribute - the name of the databinding type
+ //this will be used to select the correct template
addAttribute(doc, "dbtype", codeGenConfiguration.getDatabindingType(), rootElement);
+ //add the server side attribute. this helps the databinding template
+ //to determine the methods to generate
+ if (isServerside){
+ addAttribute(doc,"isserverside","yes",rootElement);
+ }
// add the names of the elements that have base 64 content
// if the base64 name list is missing then this whole step is skipped
rootElement.appendChild(getBase64Elements(doc));
@@ -1065,6 +1073,27 @@
}
/**
+ * Adds the short type name to the given parameter element
+ * if the type has no '.' characters in its name
+ * the type itself is taken as the shorttype
+ * @param paramElement
+ */
+ protected void addShortType(Element paramElement,String type) {
+ if (type!=null && type.indexOf('.')!=-1){
+ addAttribute(paramElement.getOwnerDocument(),
+ "shorttype",
+ type.substring(type.lastIndexOf('.')+1),
+ paramElement);
+ }else{
+ addAttribute(paramElement.getOwnerDocument(),
+ "shorttype",
+ type==null?"":type,
+ paramElement);
+ }
+
+ }
+
+ /**
* Gets an element representing the operation names
* @param doc
* @return Returns Element.
@@ -1730,6 +1759,9 @@
? ""
: typeMapping, paramElement);
+ //add the short name
+ addShortType(paramElement,typeMapping);
+
String attribValue = (String) instantiatableMessageClassNames.
get(msg.getElementQName());
addAttribute(doc, "instantiatableType",
@@ -1814,7 +1846,7 @@
new Element[paramElementList.size()]);
}
- /**
+ /**
* A convenient method for the generating the parameter
* element
* @param doc
@@ -1870,6 +1902,9 @@
? ""
: paramType, paramElement);
+ //adds the short type
+ addShortType(paramElement,paramType);
+
// add an extra attribute to say whether the type mapping is the default
if (mapper.getDefaultMappingName().equals(paramType)) {
addAttribute(doc, "default", "yes", paramElement);
@@ -1900,7 +1935,7 @@
* @return Returns Element.
*/
protected Element getOutputParamElement(Document doc, AxisOperation operation) {
- Element param = doc.createElement("param");
+ Element paramElement = doc.createElement("param");
AxisMessage outputMessage = operation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
String typeMappingStr;
String parameterName;
@@ -1916,19 +1951,23 @@
typeMappingStr = "";
}
- addAttribute(doc, "name", parameterName, param);
- addAttribute(doc, "type", typeMappingStr, param);
+ addAttribute(doc, "name", parameterName, paramElement);
+ addAttribute(doc, "type", typeMappingStr, paramElement);
+
+ //adds the short type
+ addShortType(paramElement,typeMappingStr);
+
// add an extra attribute to say whether the type mapping is the default
if (mapper.getDefaultMappingName().equals(typeMappingStr)) {
- addAttribute(doc, "default", "yes", param);
+ addAttribute(doc, "default", "yes", paramElement);
}
// add this as a body parameter
- addAttribute(doc, "location", "body", param);
- addAttribute(doc, "opname", operation.getName().getLocalPart(), param);
+ addAttribute(doc, "location", "body", paramElement);
+ addAttribute(doc, "opname", operation.getName().getLocalPart(), paramElement);
- return param;
+ return paramElement;
}
/**
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/CEmitter.java Mon Jul 10 06:07:15 2006
@@ -225,7 +225,7 @@
// add the databind supporters. Now the databind supporters are completly contained inside
// the stubs implementation and not visible outside
- rootElement.appendChild(createDOMElementforDatabinders(doc));
+ rootElement.appendChild(createDOMElementforDatabinders(doc,false));
Object stubMethods;
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SchemaUnwrapperExtension.java Mon Jul 10 06:07:15 2006
@@ -4,8 +4,10 @@
import org.apache.axis2.wsdl.codegen.CodeGenerationException;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.wsdl.WSDLUtil;
+import org.apache.axis2.wsdl.i18n.CodegenMessages;
import org.apache.axis2.wsdl.util.MessagePartInformationHolder;
import org.apache.axis2.wsdl.util.Constants;
+import org.apache.axis2.wsdl.util.ConfigPropertyFileLoader;
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisMessage;
@@ -54,14 +56,15 @@
public void engage(CodeGenConfiguration configuration) throws CodeGenerationException {
if (!configuration.isParametersWrapped()){
- ///////////////////////////////////////////////////////////////
- // A temp check to avoid nasty surprises - Since unwrapping is
- // supported only for ADB yet
- if (!"adb".equals(configuration.getDatabindingType())){
- throw new CodeGenerationException("Unsupported databinding framework for unwrapping!");
+ // A check to avoid nasty surprises - Since unwrapping is not
+ // supported by all frameworks, we check the framework name to be
+ // compatible
+ if (!ConfigPropertyFileLoader.getUnwrapSupportedFrameworkNames().
+ contains(configuration.getDatabindingType())){
+ throw new CodeGenerationException(
+ CodegenMessages.getMessage("extension.unsupportedforunwrapping"));
}
- ///////////////////////////////////////////////////////////////
-
+
//walk the schema and find the top level elements
AxisService axisService = configuration.getAxisService();
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/i18n/resource.properties Mon Jul 10 06:07:15 2006
@@ -68,6 +68,7 @@
extension.encodedNotSupported=The use 'encoded' is not supported!
extension.databindingMismatch=The specified databinding frameworks do not match!
extension.unhandledSchemaConstruct=Unhandled schema construct!
+extension.unsupportedforunwrapping=Unsupported framework for unwrapping!
emitter.unknownStyle=Unknown code generation style {0}
emitter.cannotFindBinding=Cannot find a binding!!
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl Mon Jul 10 06:07:15 2006
@@ -7,7 +7,7 @@
Note - these names would be handled by a special
URI resolver during the xslt transformations
-->
- <xsl:include href="externalTemplate"/>
+ <xsl:include href="externalTemplate"/>
<!--Template for in out message receiver -->
@@ -17,16 +17,16 @@
<xsl:variable name="dbsupportpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
/**
- * <xsl:value-of select="@name"/>.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis2 version: #axisVersion# #today#
- */
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
package <xsl:value-of select="@package"/>;
/**
- * <xsl:value-of select="@name"/> message receiver
- */
+ * <xsl:value-of select="@name"/> message receiver
+ */
public class <xsl:value-of select="@name"/> extends <xsl:value-of select="@basereceiver"/>{
@@ -78,30 +78,81 @@
<!-- We really don't need to make a difference between these-->
<xsl:when test="$style='document' or $style='rpc'">
//doc style
- <xsl:if test="$returntype!=''"><xsl:value-of select="$returnvariable"/> =</xsl:if>
- <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@location='body'])"/></xsl:variable>
+ <xsl:variable name="paramCount"><xsl:value-of select="count(input/param[@location='body' and @type!=''])"/></xsl:variable>
<xsl:choose>
- <xsl:when test="$paramCount > 0">skel.<xsl:value-of select="@name"/>(
- <xsl:for-each select="input/param[@location='body' and @type!='']">
- (<xsl:value-of select="@type"/>)fromOM(
- msgContext.getEnvelope().getBody().getFirstElement(),
- <xsl:value-of select="@type"/>.class,
- getEnvelopeNamespaces(msgContext.getEnvelope()))<xsl:if test="position() > 1">,</xsl:if>
-
+ <!-- more than 1 argument - assume to be unwrapped -->
+ <xsl:when test="$paramCount > 1">
+ java.util.List eltList = explode(
+ msgContext.getEnvelope().getBody().getFirstElement());
+ <xsl:if test="$returntype!=''"><xsl:value-of select="$returnvariable"/> =</xsl:if>
+ skel.<xsl:value-of select="@name"/>(
+ <xsl:for-each select="input/param[@location='body' and @type!='']">
+ <xsl:if test="position() > 1">,</xsl:if>
+ <xsl:choose>
+ <xsl:when test="@primitive">
+ convertTo<xsl:value-of select="@shorttype"/>((org.apache.axiom.om.OMElement)eltList.get(<xsl:value-of select="position()-1"/>))
+ </xsl:when>
+ <xsl:otherwise>
+ (<xsl:value-of select="@type"/>)fromOM(
+ (org.apache.axiom.om.OMElement)eltList.get(<xsl:value-of select="position()-1"/>),
+ <xsl:value-of select="@type"/>.class,
+ getEnvelopeNamespaces(msgContext.getEnvelope()))
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:for-each>);
</xsl:when>
+ <!-- for a single parmeter we have to take care in taking the OMelement.
+ The logic will be to check the partname attribute to determine
+ whether it is wrapped or unwrapped
+ -->
+ <xsl:when test="$paramCount=1">
+ <xsl:if test="input/param[@location='body' and @type!='']/@partname">
+ java.util.List eltList = explode(
+ msgContext.getEnvelope().getBody().getFirstElement());
+ </xsl:if>
+ <xsl:if test="$returntype!=''"><xsl:value-of select="$returnvariable"/> =</xsl:if>
+ skel.<xsl:value-of select="@name"/>(
+ <xsl:choose>
+ <xsl:when test="input/param[@location='body' and @type!='' and @partname]/@primitive">
+ <!--convert from the elt list -->
+ convertTo<xsl:value-of select="@shorttype"/>((org.apache.axiom.om.OMElement)eltList.get(0))
+ </xsl:when>
+ <xsl:when test="input/param[@location='body' and @type!='' and not(@partname)]/@primitive">
+ <!-- convert from the root child-->
+ convertTo<xsl:value-of select="@shorttype"/>(msgContext.getEnvelope().getBody().getFirstElement())
+ </xsl:when>
+ <xsl:when test="(input/param[@location='body' and @type!='' and @partname and not(@primitive)])">
+ <!--convert from the elt list -->
+ (<xsl:value-of select="input/param[@location='body' and @type!='']/@type"/>)fromOM(
+ (org.apache.axiom.om.OMElement)eltList.get(0),
+ <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/>.class,
+ getEnvelopeNamespaces(msgContext.getEnvelope()))
+
+ </xsl:when>
+ <xsl:otherwise>
+ (<xsl:value-of select="input/param[@location='body' and @type!='']/@type"/>)fromOM(
+ msgContext.getEnvelope().getBody().getFirstElement(),
+ <xsl:value-of select="input/param[@location='body' and @type!='']/@type"/>.class,
+ getEnvelopeNamespaces(msgContext.getEnvelope()))
+ </xsl:otherwise>
+ </xsl:choose>
+ );
+ </xsl:when>
<!--No input parameters-->
- <xsl:otherwise>skel.<xsl:value-of select="@name"/>();</xsl:otherwise>
+
+ <xsl:otherwise>
+ <xsl:if test="$returntype!=''"><xsl:value-of select="$returnvariable"/> =</xsl:if>
+ skel.<xsl:value-of select="@name"/>();</xsl:otherwise>
</xsl:choose>
<xsl:choose>
- <xsl:when test="$returntype!=''">
- envelope = toEnvelope(getSOAPFactory(msgContext), <xsl:value-of select="$returnvariable"/>, false);
- </xsl:when>
- <xsl:otherwise>
- envelope = getSOAPFactory(msgContext).getDefaultEnvelope();
- </xsl:otherwise>
+ <xsl:when test="$returntype!=''">
+ envelope = toEnvelope(getSOAPFactory(msgContext), <xsl:value-of select="$returnvariable"/>, false);
+ </xsl:when>
+ <xsl:otherwise>
+ envelope = getSOAPFactory(msgContext).getDefaultEnvelope();
+ </xsl:otherwise>
</xsl:choose>
</xsl:when>
@@ -117,56 +168,73 @@
newMsgContext.setEnvelope(envelope);
}
<xsl:for-each select="fault-list/fault">
- <xsl:if test="position()=1">}</xsl:if>catch (<xsl:value-of select="@name"/> e) {
- org.apache.axis2.AxisFault f =
- new org.apache.axis2.AxisFault("<xsl:value-of select="@shortName"/>");
- f.setDetail(toOM(e.getFaultMessage(),false));
- throw f;
+ <xsl:if test="position()=1">}</xsl:if>catch (<xsl:value-of select="@name"/> e) {
+ org.apache.axis2.AxisFault f =
+ new org.apache.axis2.AxisFault("<xsl:value-of select="@shortName"/>");
+ f.setDetail(toOM(e.getFaultMessage(),false));
+ throw f;
}
</xsl:for-each>
<!-- put the extra bracket-->
<xsl:if test="count(fault-list/fault)=0">}</xsl:if>
- catch (Exception e) {
- throw org.apache.axis2.AxisFault.makeFault(e);
- }
+ catch (Exception e) {
+ throw org.apache.axis2.AxisFault.makeFault(e);
+ }
}
- <!-- Call templates recursively-->
+ <!-- Call templates recursively-->
//<xsl:apply-templates/>
- /**
- * A utility method that copies the namepaces from the SOAPEnvelope
- */
- private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
- java.util.Map returnMap = new java.util.HashMap();
- java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
- while (namespaceIterator.hasNext()) {
- org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
- returnMap.put(ns.getPrefix(),ns.getName());
+ /**
+ * A utility method that copies the namepaces from the SOAPEnvelope
+ */
+ private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
+ java.util.Map returnMap = new java.util.HashMap();
+ java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+ while (namespaceIterator.hasNext()) {
+ org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
+ returnMap.put(ns.getPrefix(),ns.getName());
+ }
+ return returnMap;
+ }
+
+
+ /**
+ * Generate a method that can explode the OMElement and provide a list of inner
+ * elements. the inner elements need to be ordered! This however need not be
+ * specific to a databinding impl
+ */
+ private java.util.List explode(org.apache.axiom.om.OMElement element){
+ java.util.List listToReturn = new java.util.LinkedList();
+ for (java.util.Iterator children = element.getChildElements();
+ children.hasNext();){
+ listToReturn.add(children.next());
}
- return returnMap;
- }
+
+ return listToReturn;
+ }
+
}//end of class
</xsl:template>
- <!-- end of template for in-out message receiver -->
+ <!-- end of template for in-out message receiver -->
- <!-- start of in-only -->
+ <!-- start of in-only -->
<xsl:template match="interface[@basereceiver='org.apache.axis2.receivers.AbstractInMessageReceiver']">
- <xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
+ <xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
<xsl:variable name="dbsupportpackage"><xsl:value-of select="@dbsupportpackage"/></xsl:variable>
/**
- * <xsl:value-of select="@name"/>.java
- *
- * This file was auto-generated from WSDL
- * by the Apache Axis2 version: #axisVersion# #today#
- */
+ * <xsl:value-of select="@name"/>.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis2 version: #axisVersion# #today#
+ */
package <xsl:value-of select="@package"/>;
/**
- * <xsl:value-of select="@name"/> message receiver
- */
+ * <xsl:value-of select="@name"/> message receiver
+ */
public class <xsl:value-of select="@name"/> extends <xsl:value-of select="@basereceiver"/>{
@@ -240,23 +308,38 @@
}
- <!-- Call templates recursively-->
+ <!-- Call templates recursively-->
//<xsl:apply-templates/>
/**
- * A utility method that copies the namepaces from the SOAPEnvelope
- */
- private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
- java.util.Map returnMap = new java.util.HashMap();
- java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
- while (namespaceIterator.hasNext()) {
- org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
- returnMap.put(ns.getPrefix(),ns.getName());
+ * A utility method that copies the namepaces from the SOAPEnvelope
+ */
+ private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
+ java.util.Map returnMap = new java.util.HashMap();
+ java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
+ while (namespaceIterator.hasNext()) {
+ org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
+ returnMap.put(ns.getPrefix(),ns.getName());
+ }
+ return returnMap;
+ }
+
+ /**
+ * Generate a method that can explode the OMElement and provide a list of inner
+ * elements. the inner elements need to be ordered! This however need not be
+ * specific to a databinding impl
+ */
+ private java.util.List explode(org.apache.axiom.om.OMElement element){
+ java.util.List listToReturn = new java.util.LinkedList();
+ for (java.util.Iterator children = element.getChildElements();
+ children.hasNext();){
+ listToReturn.add(children.next());
}
- return returnMap;
- }
+
+ return listToReturn;
+ }
}//end of class
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java?rev=420519&r1=420518&r2=420519&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/util/ConfigPropertyFileLoader.java Mon Jul 10 06:07:15 2006
@@ -28,6 +28,8 @@
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
+import java.util.List;
+import java.util.Arrays;
/**
* Loads the properties from the config properties.
@@ -43,6 +45,8 @@
private static String[] thirdPartySchemaNames;
private static String[] languageTypes;
private static String[] databindingFrameworkNames;
+ private static String[] unwrapSuppoerteddatabindingFrameworkNames;
+
private static Map languageEmitterMap;
private static Map languageSpecificPropertiesMap;
private static Map databindingFrameworkNameToExtensionMap;
@@ -58,6 +62,7 @@
private static final String DEFAULT_LANGUAGE_TYPE_KEY = "codegen.languages.default";
private static final String EMITTER_CLASS_KEY = "codegen.emitters";
private static final String DATA_BINDING_FRAMEWORK_NAME_KEY = "codegen.databinding.frameworks";
+ private static final String DATA_BINDING_UNWRAP_SUPPORTED_FRAMEWORK_NAME_KEY = "codegen.databinding.unwrap.supported";
private static final String DATA_BINDING_FRAMEWORK_DEFAULT_NAME_KEY = "codegen.databinding.frameworks.default";
private static final String DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY = "codegen.databinding.extensions";
private static final String DATA_BINDING_TEMPLATE_NAME_KEY_PREFIX = "codegen.databinding.";
@@ -154,6 +159,12 @@
databindingFrameworkNames = tempString.split(SEPARATOR_CHAR);
}
+ //load the unwrap supported data binding framework names
+ tempString = props.getProperty(DATA_BINDING_UNWRAP_SUPPORTED_FRAMEWORK_NAME_KEY);
+ if (tempString != null) {
+ unwrapSuppoerteddatabindingFrameworkNames = tempString.split(SEPARATOR_CHAR);
+ }
+
//populate the data binding framework name to extension name map
tempString = props.getProperty(DATA_BINDING_FRAMEWORK_EXTENSION_NAME_KEY);
if (tempString != null) {
@@ -315,6 +326,13 @@
return languageEmitterMap;
}
+ /**
+ * Get the list of unwrap supported data binding frameworks
+ * @return
+ */
+ public static List getUnwrapSupportedFrameworkNames(){
+ return Arrays.asList(unwrapSuppoerteddatabindingFrameworkNames);
+ }
/**
* Gets the default language name.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org