You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by aj...@apache.org on 2005/05/17 13:04:33 UTC
svn commit: r170564 - in /webservices/axis/trunk/java/modules:
core/src/org/apache/axis/clientapi/ wsdl/src/org/apache/axis/wsdl/
wsdl/src/org/apache/axis/wsdl/codegen/
wsdl/src/org/apache/axis/wsdl/codegen/emitter/
wsdl/src/org/apache/axis/wsdl/template/general/
wsdl/src/org/apache/axis/wsdl/template/java/
wsdl/src/org/apache/axis/wsdl/util/
Author: ajith
Date: Tue May 17 04:04:31 2005
New Revision: 170564
URL: http://svn.apache.org/viewcvs?rev=170564&view=rev
Log:
Refining the code generator
Modified:
webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl
webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/URLProcessor.java
Modified: webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java (original)
+++ webservices/axis/trunk/java/modules/core/src/org/apache/axis/clientapi/Stub.java Tue May 17 04:04:31 2005
@@ -22,23 +22,14 @@
import org.apache.axis.deployment.DeploymentException;
import org.apache.axis.engine.AxisFault;
-
-
-
-
-
-
-
/**
* @author chathura@opensource.lk
*
*/
public abstract class Stub {
- protected org.apache.axis.context.ConfigurationContext _confiurationContext;
-
+ protected org.apache.axis.context.ConfigurationContext _configurationContext;
protected org.apache.axis.description.ServiceDescription _service;
-
protected static org.apache.axis.description.OperationDescription[] _operations;
/**
@@ -47,12 +38,11 @@
* ServiceContext across operations.
*/
protected boolean _maintainSession = false;
-
protected String _currentSessionId = null;
protected Stub(QName serviceName, String axis2Home)throws DeploymentException, AxisFault{
- _confiurationContext = new EngineContextFactory().buildClientEngineContext(axis2Home);
+ _configurationContext = new EngineContextFactory().buildClientEngineContext(axis2Home);
_service = new org.apache.axis.description.ServiceDescription();
_service.setName(serviceName);
@@ -60,7 +50,7 @@
_service.addOperation(_operations[i]);
}
- _confiurationContext.getEngineConfig().addService(_service);
+ _configurationContext.getEngineConfig().addService(_service);
}
public abstract void _setSessionInfo(Object key, Object value) throws Exception;
@@ -70,7 +60,6 @@
public void _startSession(){
_maintainSession = true;
-
_currentSessionId = getID() ;
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2WS.java Tue May 17 04:04:31 2005
@@ -4,7 +4,7 @@
import org.apache.axis.wsdl.codegen.CommandLineOptionConstants;
import org.apache.axis.wsdl.codegen.CommandLineOptionParser;
- /**
+ /**
* Copyright 2004,2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenerationEngine.java Tue May 17 04:04:31 2005
@@ -18,7 +18,6 @@
import org.apache.axis.wsdl.builder.WOMBuilderFactory;
import org.apache.axis.wsdl.codegen.emitter.CSharpEmitter;
-import org.apache.axis.wsdl.codegen.emitter.ClientJavaEmitter;
import org.apache.axis.wsdl.codegen.emitter.Emitter;
import org.apache.axis.wsdl.codegen.emitter.JavaEmitter;
import org.apache.axis.wsdl.codegen.extension.AxisBindingBuilder;
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/emitter/MultiLanguageClientEmitter.java Tue May 17 04:04:31 2005
@@ -309,6 +309,7 @@
Element rootElement = doc.createElement("interface");
addAttribute(doc,"package",configuration.getPackageName(),rootElement);
addAttribute(doc,"name",boundInterface.getName().getLocalPart(),rootElement);
+ addAttribute(doc,"callbackname",boundInterface.getName().getLocalPart() + CALL_BACK_HANDLER_SUFFIX,rootElement);
fillSyncAttributes(doc, rootElement);
loadOperations(boundInterface, doc, rootElement);
doc.appendChild(rootElement);
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl Tue May 17 04:04:31 2005
@@ -5,7 +5,7 @@
<service name="">
<parameter name="ServiceClass" locked="xsd:false"><xsl:value-of select="@package"/>.<xsl:value-of select="@name"/></parameter>
<xsl:for-each select="method">
- <xsl:comment>Mounting the method</xsl:comment>
+ <xsl:comment>Mounting the method <xsl:value-of select="@name"/> </xsl:comment>
<operation><xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute></operation>
</xsl:for-each>
</service>
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceImplementationTemplate.xsl Tue May 17 04:04:31 2005
@@ -12,34 +12,62 @@
* Auto generated java implementation by the Axis code generator
*/
- public class <xsl:value-of select="@name"></xsl:value-of> extends org.apache.axis.clientapi.Stub implements <xsl:value-of select="$interfaceName"/>{
- private static org.apache.axis.description.AxisGlobal _axisGlobal = null;
- private static org.apache.axis.engine.AxisSystemImpl _axisSystem = null;
- private static org.apache.axis.context.SystemContext _systemContext = null;
- private static org.apache.axis.description.AxisService _service = null;
- private static org.apache.axis.description.AxisOperation[] _operations = new org.apache.axis.description.AxisOperation[<xsl:value-of select="count(method)"/>];
-
-
- static{
- _axisGlobal = new org.apache.axis.description.AxisGlobal();
- _axisSystem = new org.apache.axis.engine.AxisSystemImpl(_axisGlobal);
- _systemContext = new org.apache.axis.context.SystemContext(_axisSystem);
- _service = new org.apache.axis.description.AxisService();
- _service.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@servicename"/>"));
- org.apache.axis.description.AxisOperation __operation;
-
+ public class <xsl:value-of select="@name"/> extends org.apache.axis.clientapi.Stub implements <xsl:value-of select="$interfaceName"/>{
+ public static final String AXIS2_HOME = ".";
+ static{
+ org.apache.axis.description.OperationDescription __operation;
<xsl:for-each select="method">
- __operation = new org.apache.axis.description.AxisOperation();
+ __operation = new org.apache.axis.description.OperationDescription();
__operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
- // more things are supposed to come here
_operations[<xsl:value-of select="position()-1"/>]=__operation;
</xsl:for-each>
}
+
+ /**
+ * Constructor
+ */
+ public <xsl:value-of select="@name"/>(String axis2Home) throws java.lang.Exception {
+ super(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>","<xsl:value-of select="@servicename"/>"),axis2Home);
+ }
+
+ /**
+ * Default Constructor
+ */
+ public <xsl:value-of select="@name"/>() throws java.lang.Exception {
+ this(AXIS2_HOME);
+ }
+
+
+ public void _setSessionInfo(Object key, Object value)throws java.lang.Exception{
+ if(!_maintainSession){
+ //TODO Comeup with a Exception
+ throw new java.lang.Exception("Client is running the session OFF mode: Start session before saving to a session ");
+ }
+ _configurationContext.getServiceContext(_currentSessionId).setProperty(key, value);
+ }
+
+
+ public Object _getSessionInfo(Object key) throws java.lang.Exception{
+ if(!_maintainSession){
+ //TODO Comeup with a Exception
+ throw new java.lang.Exception("Client is running the session OFF mode: Start session before saving to a session ");
+ }
+ return _configurationContext.getServiceContext(_currentSessionId).getProperty(key);
+ }
+
+ /**
+ * get the message context
+ */
+ private org.apache.axis.context.MessageContext _getMessageContext(){
+ return null;
+ }
<xsl:for-each select="method">
<xsl:variable name="outputtype"><xsl:value-of select="output/param/@type"></xsl:value-of></xsl:variable>
<xsl:variable name="inputtype"><xsl:value-of select="input/param/@type"></xsl:value-of></xsl:variable> <!-- this needs to change-->
<xsl:variable name="inputparam"><xsl:value-of select="input/param/@name"></xsl:value-of></xsl:variable> <!-- this needs to change-->
+ <!-- When genrating code, the MEP should be taken into account -->
+
<xsl:if test="$isSync='1'">
/**
* Auto generated method signature
@@ -48,8 +76,8 @@
*/
public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException{
- org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
- org.apache.axis.context.MessageContext _messageContext = getMessageContext();
+ org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_configurationContext.getServiceContext(_getServiceContextID()));<!-- this needs to change -->
+ org.apache.axis.context.MessageContext _messageContext = _getMessageContext();
<xsl:if test="$outputtype=''">
_call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
return;
@@ -67,16 +95,16 @@
* @see <xsl:value-of select="$package"/>.<xsl:value-of select="$interfaceName"/>#start<xsl:value-of select="@name"/>
*<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
*/
- public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException{
+ public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of>,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException{
// we know its call because we have the mep at the time of the stub generation.
- org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_systemContext.getServiceContext("<xsl:value-of select="generate-id()"/>"));<!-- this needs to change -->
- org.apache.axis.context.MessageContext _messageContext = getMessageContext();
- _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext, new org.apache.axis.clientapi.CallBack(){
+ org.apache.axis.clientapi.Call _call = new org.apache.axis.clientapi.Call(_configurationContext.getServiceContext(_getServiceContextID()));<!-- this needs to change -->
+ org.apache.axis.context.MessageContext _messageContext = _getMessageContext();
+ _call.invokeNonBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext, new org.apache.axis.clientapi.Callback(){
public void onComplete(org.apache.axis.clientapi.AsyncResult result){
- new <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>().receiveResult<xsl:value-of select="@name"/>(result);
+ callback.receiveResult<xsl:value-of select="@name"/>(result);
}
public void reportError(java.lang.Exception e){
- new <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/>().receiveError<xsl:value-of select="@name"/>(e);
+ callback.receiveError<xsl:value-of select="@name"/>(e);
}
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/InterfaceTemplate.xsl Tue May 17 04:04:31 2005
@@ -3,8 +3,10 @@
<xsl:template match="/interface">
<xsl:variable name="isSync"><xsl:value-of select="@isSync"/></xsl:variable>
<xsl:variable name="isAsync"><xsl:value-of select="@isAsync"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <xsl:variable name="package"><xsl:value-of select="@package"/></xsl:variable>
- package <xsl:value-of select="@package"/>;
+ package <xsl:value-of select="$package"/>;
/*
* Auto generated java interface by the Axis code generator
@@ -24,11 +26,11 @@
public <xsl:if test="$outputtype=''">void</xsl:if><xsl:if test="$outputtype!=''"><xsl:value-of select="$outputtype"/></xsl:if><xsl:text> </xsl:text><xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException;
</xsl:if>
<xsl:if test="$isAsync='1'">
- /**
+ /**
* Auto generated method signature
*<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
*/
- public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>) throws java.rmi.RemoteException;
+ public void start<xsl:value-of select="@name"/>(<xsl:if test="$inputtype!=''"><xsl:value-of select="$inputtype"/><xsl:text> </xsl:text><xsl:value-of select="$inputparam"></xsl:value-of>,</xsl:if>final <xsl:value-of select="$package"/>.<xsl:value-of select="$callbackname"/> callback) throws java.rmi.RemoteException;
</xsl:if>
</xsl:for-each>
}
Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/URLProcessor.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/URLProcessor.java?rev=170564&r1=170563&r2=170564&view=diff
==============================================================================
--- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/URLProcessor.java (original)
+++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/URLProcessor.java Tue May 17 04:04:31 2005
@@ -22,6 +22,14 @@
*/
public class URLProcessor {
public static final String DEFAULT_PACKAGE = "axis2";
+
+ /**
+ * Breaks a given url to a package
+ * e.g. http://www.google.com/test will become
+ * com.google.www
+ * @param url
+ * @return
+ */
public static String getNameSpaceFromURL(String url){
String returnPackageName = "";
String regularExpression = "//[\\w\\.]*";