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 ch...@apache.org on 2005/06/23 13:26:11 UTC

svn commit: r193135 - in /webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl: codegen/writer/MessageReceiverWriter.java template/java/MessageReceiverTemplate.xsl

Author: chathura
Date: Thu Jun 23 04:26:09 2005
New Revision: 193135

URL: http://svn.apache.org/viewcvs?rev=193135&view=rev
Log:
Adde the Messagereceiver Writer and the xsl template

Added:
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/MessageReceiverWriter.java
    webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/MessageReceiverWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/MessageReceiverWriter.java?rev=193135&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/MessageReceiverWriter.java (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/MessageReceiverWriter.java Thu Jun 23 04:26:09 2005
@@ -0,0 +1,49 @@
+/*
+ * Copyright 2001-2004 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.axis.wsdl.codegen.writer;
+
+import java.io.File;
+
+import org.apache.axis.wsdl.codegen.XSLTConstants;
+
+/**
+ * @author chathura@opensource.lk
+ *  
+ */
+public class MessageReceiverWriter extends ClassWriter {
+
+	public MessageReceiverWriter(String outputFileLocation) {
+		this.outputFileLocation = new File(outputFileLocation);
+	}
+
+	public MessageReceiverWriter(File outputFileLocation, int language) {
+		this.outputFileLocation = outputFileLocation;
+		this.language = language;
+	}
+
+	public void loadTemplate() {
+		Class clazz = this.getClass();
+        switch (language){
+            case XSLTConstants.LanguageTypes.JAVA:
+                this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTMessageReceiverTemplates.JAVA_TEMPLATE);
+                break;
+            default:
+                throw new UnsupportedOperationException();
+        }
+	}
+
+}
\ No newline at end of file

Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl?rev=193135&view=auto
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl (added)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/MessageReceiverTemplate.xsl Thu Jun 23 04:26:09 2005
@@ -0,0 +1,49 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    <xsl:output method="text"/>
+    <xsl:template match="/interface">
+
+	<xsl:variable name="skeletonname"><xsl:value-of select="@skeletonname"/></xsl:variable>
+    package <xsl:value-of select="@package"/>;
+
+    /**
+     *  Auto generated message receiver
+     */
+
+    public class <xsl:value-of select="@name"></xsl:value-of> extends <xsl:value-of select="@basereceiver"/>{
+    
+		public void invokeBusinessLogic(org.apache.axis.context.MessageContext msgContext, org.apache.axis.context.MessageContext newMsgContext) {
+    
+     try {
+
+            // get the implementation class for the Web Service
+            Object obj = getTheImplementationObject(msgContext);
+
+            // find the WebService method
+            <xsl:value-of select="$skeletonname"></xsl:value-of> skel = (<xsl:value-of select="$skeletonname"></xsl:value-of>)obj;
+            skel.init();
+            org.apache.axis.description.OperationDescription op = msgContext.getOperationContext().getAxisOperation();
+            if (op == null) {
+                throw new org.apache.axis.engine.AxisFault("Operation is not located, if this is doclit style the SOAP-ACTION should specified via the SOAP Action to use the RawXMLProvider");
+            }
+            
+            String methodName;
+            if(op.getName() != null &amp; (methodName = op.getName().getLocalPart()) != null){
+            
+				<xsl:for-each select="method">
+				if(methodName.equals("<xsl:value-of select="@name"></xsl:value-of> ")){
+					skel.<xsl:value-of select="@name"></xsl:value-of>();
+				}
+			   </xsl:for-each>
+            }
+           
+            
+
+        } catch (Exception e) {
+            throw org.apache.axis.engine.AxisFault.makeFault(e);
+        }
+     <xsl:for-each select="method"></xsl:for-each>
+		 }
+	
+    }
+    </xsl:template>
+ </xsl:stylesheet>
\ No newline at end of file