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 su...@apache.org on 2004/03/22 11:56:53 UTC

cvs commit: ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/rpc RPCWebServiceGenarator.java

susantha    2004/03/22 02:56:53

  Modified:    c/src/wsdl/org/apache/axis/wsdl/wsdl2ws
                        SourceWriterFactory.java WrapperConstants.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/doclit
                        DocLitWebServiceGenarator.java
               c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/rpc
                        RPCWebServiceGenarator.java
  Added:       c/src/wsdl/org/apache/axis/wsdl/wsdl2ws
                        DeploymentWriter.java UndeploymentWriter.java
                        WsddWriter.java
  Log:
  adding functionality to generate WSDD files
  
  Revision  Changes    Path
  1.5       +7 -0      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/SourceWriterFactory.java
  
  Index: SourceWriterFactory.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/SourceWriterFactory.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SourceWriterFactory.java	12 Jan 2004 10:51:32 -0000	1.4
  +++ SourceWriterFactory.java	22 Mar 2004 10:56:53 -0000	1.5
  @@ -63,6 +63,13 @@
    */
   public class SourceWriterFactory {
   	public static SourceWriter createSourceWriter(int genaratorType,WebServiceContext wscontext)throws WrapperFault{
  +		//write deployment or undeployment wsdd files 
  +		if (genaratorType == WrapperConstants.GENERATOR_DEPLOYMENT){
  +			return new DeploymentWriter(wscontext);
  +		}
  +		else if (genaratorType == WrapperConstants.GENERATOR_UNDEPLOYMENT){
  +			return new UndeploymentWriter(wscontext);			
  +		}
   		if("rpc".equals(wscontext.getWrapInfo().getWrapperStyle())){
   			//C++
   			if(genaratorType == WrapperConstants.GENERATOR_PARAM_CPP_ALL)
  
  
  
  1.5       +3 -0      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WrapperConstants.java
  
  Index: WrapperConstants.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WrapperConstants.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- WrapperConstants.java	12 Jan 2004 10:51:32 -0000	1.4
  +++ WrapperConstants.java	22 Mar 2004 10:56:53 -0000	1.5
  @@ -114,6 +114,9 @@
   	public static final int GENERATOR_CLIENT_STUB_H = 27;
   	public static final int GENERATOR_PARAM_C_ALL = 28;
   
  +	//common constants
  +	public static final int GENERATOR_DEPLOYMENT = 40;
  +	public static final int GENERATOR_UNDEPLOYMENT = 41;
   
   	//implementation type
   	public static final String IMPL_STYLE_STRUCT = "struct";
  
  
  
  1.1                  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/DeploymentWriter.java
  
  Index: DeploymentWriter.java
  ===================================================================
  /*
   * Created on Mar 19, 2004
   *
   */
  package org.apache.axis.wsdl.wsdl2ws;
  
  import java.io.BufferedWriter;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.util.Iterator;
  
  import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  
  /**
   * @author Susantha Kumara
   *
   */
  public class DeploymentWriter extends WsddWriter {
  	public DeploymentWriter(WebServiceContext wscontext) throws WrapperFault {
  		super(wscontext);
  	}
  	public void writeSource() throws WrapperFault {
  		try {
  			BufferedWriter writer = new BufferedWriter(new FileWriter(getFilePath(this.wscontext, "deploy"), false));
  			writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  			writer.write("<deployment xmlns=\"http://xml.apache.org/axis/wsdd/\""+
				" xmlns:"+this.providerLang+"=\"http://xml.apache.org/axis/wsdd/providers/"+this.providerLang+">\n");
  			writer.write("\t<service name=\""+this.servicename+"\" provider=\""+this.providerLang+":"+this.providerStyle+"\" description=\""+this.description+"\">\n");
  			writer.write("\t\t<parameter name=\"className\" value=\"/user/local/apache/axis/"+this.servicename+".so\"/>\n");
  			writer.write("\t\t<parameter name=\"allowedMethods\" value=\"");
  			Iterator it = this.allowedmethods.iterator();
  			while (it.hasNext()){
  				writer.write((String)it.next()+" ");
  			}
  			writer.write("\"/>\n");
  			writer.write("\t</service>\n");
  			writer.write("</deployment>\n");
  			writer.flush();
  			writer.close();
  		}catch(IOException e){
  			throw new WrapperFault(e);
  		}
  	}
  }
  
  
  
  1.1                  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/UndeploymentWriter.java
  
  Index: UndeploymentWriter.java
  ===================================================================
  /*
   * Created on Mar 19, 2004
   *
   */
  package org.apache.axis.wsdl.wsdl2ws;
  
  import java.io.BufferedWriter;
  import java.io.FileWriter;
  import java.io.IOException;
  
  import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  
  /**
   * @author Susantha Kumara
   *
   */
  public class UndeploymentWriter extends WsddWriter {
  	public UndeploymentWriter(WebServiceContext wscontext) throws WrapperFault {
  		super(wscontext);
  	}
  	public void writeSource() throws WrapperFault {
  		try {
  			BufferedWriter writer = new BufferedWriter(new FileWriter(getFilePath(this.wscontext, "undeploy"), false));
  			writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  			writer.write("<undeployment xmlns=\"http://xml.apache.org/axis/wsdd/\""+
  				" xmlns:"+this.providerLang+"=\"http://xml.apache.org/axis/wsdd/providers/"+this.providerLang+">\n");
  			writer.write("\t<service name=\""+this.servicename+"\"/>\n");
  			writer.write("</undeployment>\n");
  			writer.flush();
  			writer.close();
  		}catch(IOException e){
  			throw new WrapperFault(e);
  		}
  	}
  }
  
  
  
  1.1                  ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WsddWriter.java
  
  Index: WsddWriter.java
  ===================================================================
  /*
   * Created on Mar 19, 2004
   *
   */
  package org.apache.axis.wsdl.wsdl2ws;
  
  import java.io.File;
  import java.util.ArrayList;
  import java.util.Vector;
  
  import org.apache.axis.wsdl.wsdl2ws.info.MethodInfo;
  import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
  
  /**
   * @author Susantha Kumara
   *
   */
  public class WsddWriter implements SourceWriter {
  	protected String servicename = null;
  	protected String providerLang = null;
  	protected String providerStyle = null;
  	protected String description = null;
  	protected Vector allowedmethods = new Vector();
  	WebServiceContext wscontext = null;
  	public WsddWriter(WebServiceContext wscontext) throws WrapperFault {
  		this.wscontext = wscontext;
  		servicename = wscontext.getSerInfo().getServicename();
  		String language = wscontext.getWrapInfo().getWrapperLanguage();
  		providerStyle = ("rpc".equals(wscontext.getWrapInfo().getWrapperStyle()))? "RPC" : "DOCUMENT";
  		providerLang = ("c".equalsIgnoreCase(language)) ? "C" : "CPP";
  		description = "Axis C++ web service";
  		ArrayList methods = wscontext.getSerInfo().getMethods();
  		MethodInfo minfo;
  		for (int i = 0; i < methods.size(); i++) {
  			minfo = (MethodInfo)methods.get(i);
  			allowedmethods.add(minfo.getMethodname());
  		}
  
  	}
  	public void writeSource()throws WrapperFault{
  		
  	}
  	protected File getFilePath(WebServiceContext wscontext, String filename) throws WrapperFault {
  		String targetOutputLocation = wscontext.getWrapInfo().getTargetOutputLocation();
  		if(targetOutputLocation.endsWith("/"))
  			targetOutputLocation = targetOutputLocation.substring(0, targetOutputLocation.length() - 1);
  		new File(targetOutputLocation).mkdirs();
  		String fileName = targetOutputLocation + "/" + filename + ".wsdd";
  		return new File(fileName);
  	}
  }
  
  
  
  1.3       +4 -0      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/doclit/DocLitWebServiceGenarator.java
  
  Index: DocLitWebServiceGenarator.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/doclit/DocLitWebServiceGenarator.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DocLitWebServiceGenarator.java	12 Jan 2004 10:51:35 -0000	1.2
  +++ DocLitWebServiceGenarator.java	22 Mar 2004 10:56:53 -0000	1.3
  @@ -92,6 +92,8 @@
   				(new Genarator(WrapperConstants.GENERATOR_SERVICE_HPP, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_PARAM_CPP_ALL, wscontext)).genarate();	
   				(new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_CPP, wscontext)).genarate();				 				 	
  +				(new Genarator(WrapperConstants.GENERATOR_DEPLOYMENT, wscontext)).genarate();
  +				(new Genarator(WrapperConstants.GENERATOR_UNDEPLOYMENT, wscontext)).genarate();
   			}else{
   				(new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_CPP, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_HPP, wscontext)).genarate();
  @@ -104,6 +106,8 @@
   				(new Genarator(WrapperConstants.GENERATOR_SERVICE_C, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_PARAM_C_ALL, wscontext)).genarate();	
   				(new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_C, wscontext)).genarate();				 				 	
  +				(new Genarator(WrapperConstants.GENERATOR_DEPLOYMENT, wscontext)).genarate();
  +				(new Genarator(WrapperConstants.GENERATOR_UNDEPLOYMENT, wscontext)).genarate();
   			}else{
   				 (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_C, wscontext)).genarate();
   				 (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_H, wscontext)).genarate();
  
  
  
  1.5       +6 -1      ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/rpc/RPCWebServiceGenarator.java
  
  Index: RPCWebServiceGenarator.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/rpc/RPCWebServiceGenarator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- RPCWebServiceGenarator.java	12 Jan 2004 10:51:36 -0000	1.4
  +++ RPCWebServiceGenarator.java	22 Mar 2004 10:56:53 -0000	1.5
  @@ -79,6 +79,7 @@
   	 */
   	public void genarate()throws WrapperFault {
   		String language = wscontext.getWrapInfo().getWrapperLanguage();
  +		
   		if(WrapperConstants.LANGUAGE_JAVA.equalsIgnoreCase(language)){
   		//if(WrapperConstants.SERVER.equals(wscontext.getWrapInfo().getTargetEngine()))
   			(new Genarator(WrapperConstants.GENERATOR_WRAPPER_JAVA, wscontext)).genarate();
  @@ -93,7 +94,9 @@
   				(new Genarator(WrapperConstants.GENERATOR_SERVICE_CPP, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_SERVICE_HPP, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_PARAM_CPP_ALL, wscontext)).genarate();	
  -				(new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_CPP, wscontext)).genarate();				 				 	
  +				(new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_CPP, wscontext)).genarate();
  +				(new Genarator(WrapperConstants.GENERATOR_DEPLOYMENT, wscontext)).genarate();
  +				(new Genarator(WrapperConstants.GENERATOR_UNDEPLOYMENT, wscontext)).genarate();
   			}else{
   				(new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_CPP, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_HPP, wscontext)).genarate();
  @@ -106,6 +109,8 @@
   				(new Genarator(WrapperConstants.GENERATOR_SERVICE_C, wscontext)).genarate();
   				(new Genarator(WrapperConstants.GENERATOR_PARAM_C_ALL, wscontext)).genarate();	
   				(new Genarator(WrapperConstants.GENERATOR_CLASSLOADER_C, wscontext)).genarate();				 				 	
  +				(new Genarator(WrapperConstants.GENERATOR_DEPLOYMENT, wscontext)).genarate();
  +				(new Genarator(WrapperConstants.GENERATOR_UNDEPLOYMENT, wscontext)).genarate();
   			}else{
   				 (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_C, wscontext)).genarate();
   				 (new Genarator(WrapperConstants.GENERATOR_CLIENT_STUB_H, wscontext)).genarate();