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 Sanjiva Weerawarana <sa...@opensource.lk> on 2005/05/16 17:21:57 UTC
Re: svn commit: r170382 - in
/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl: ./
codegen/ codegen/emitter/ codegen/writer/ template/general/ template/java/
util/
If feasible, can we make the main driver be WSDL2WS with a -language
argument to select the output language? I'm happy with defaulting that
to Java.
Sanjiva.
On Mon, 2005-05-16 at 13:02 +0000, ajith@apache.org wrote:
> Author: ajith
> Date: Mon May 16 06:02:23 2005
> New Revision: 170382
>
> URL: http://svn.apache.org/viewcvs?rev=170382&view=rev
> Log:
> Added templates and modified the code generator to generate the skeletons and the service.xml
>
> Added:
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ServiceXMLWriter.java
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/SkeletonWriter.java
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/
> 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/SkeletonTemplate.xsl
> Modified:
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.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/CommandLineOption.java
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.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/java/InterfaceImplementationTemplate.xsl
> webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java
>
> Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java?rev=170382&r1=170381&r2=170382&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java (original)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/WSDL2Java.java Mon May 16 06:02:23 2005
> @@ -19,14 +19,15 @@
> }
>
> private static void printUsage(){
> - System.out.println("Usage WSDL2Java -URI <Location of WSDL> :WSDL file location ");
> + System.out.println("Usage WSDL2Java -uri <Location of WSDL> :WSDL file location ");
> System.out.println("-o <output Location> : output file location ");
> System.out.println("-x : Switch to advanced mode. Default is off");
> System.out.println("-a : Generate async style code only. Default if off");
> System.out.println("-s : Generate sync style code only. Default if off. takes precedence over -a");
> System.out.println("-p <package name> : set custom package name");
> System.out.println("-l <language> : valid languages are java and csharp. Default is java");
> - System.out.println("-clientpackage <client package");
> + System.out.println("-ss : Generate server side code (i.e. skeletons).Default is off");
> + System.out.println("-sd : Generate service descriptor (i.e. server.xml).Default is off.Valid with -ss ");
> System.exit(0);
> }
>
>
> Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java?rev=170382&r1=170381&r2=170382&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java (original)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CodeGenConfiguration.java Mon May 16 06:02:23 2005
> @@ -35,6 +35,8 @@
>
> private boolean asyncOn=true;
> private boolean syncOn=true;
> + private boolean serverSide=false;
> + private boolean generateDeployementDescriptor=true;
> private String packageName=XSLTConstants.DEFAULT_PACKAGE_NAME;
>
>
> @@ -54,7 +56,9 @@
> String outputLocation = ((CommandLineOption)optionMap.get(OUTPUT_LOCATION_OPTION)).getOptionValue();
> this.outputLocation = new File(outputLocation);
>
> - advancedCodeGenEnabled = (optionMap.get(ADVANCED_CODEGEN_OPTION)!=null);
> + serverSide = (optionMap.get(SERVER_SIDE_CODE_OPTION)!=null);
> + generateDeployementDescriptor = (optionMap.get(GENERATE_SERVICE_DESCRIPTION_OPTION)!=null);
> +
> boolean asyncFlagPresent = (optionMap.get(CODEGEN_ASYNC_ONLY_OPTION)!=null);
> boolean syncFlagPresent = (optionMap.get(CODEGEN_SYNC_ONLY_OPTION)!=null);
> if (asyncFlagPresent) {this.asyncOn=true;this.syncOn=false;}
> @@ -68,6 +72,8 @@
> loadLanguge(langOption.getOptionValue());
> }
>
> +
> +
> }
>
>
> @@ -140,5 +146,11 @@
> return syncOn;
> }
>
> -
> + public boolean isServerSide() {
> + return serverSide;
> + }
> +
> + public boolean isGenerateDeployementDescriptor() {
> + return generateDeployementDescriptor;
> + }
> }
>
> 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=170382&r1=170381&r2=170382&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 Mon May 16 06:02:23 2005
> @@ -1,18 +1,18 @@
> /*
> - * 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.
> - */
> +* 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;
>
> @@ -70,7 +70,7 @@
> axisBindingBuilder.engage();
> PackageFinder packageFinder = new PackageFinder();
> packageFinder.init(this.configuration);
> - this.moduleEndpoints.add(packageFinder);
> + this.moduleEndpoints.add(packageFinder);
>
> }
>
> @@ -84,13 +84,8 @@
>
> switch (configuration.getOutputLanguage()){
> case XSLTConstants.LanguageTypes.JAVA:
> - if (configuration.isAdvancedCodeGenEnabled()){
> - clientEmitter = new JavaEmitter(this.configuration);
> - } else{
> - clientEmitter = new ClientJavaEmitter(this.configuration);
> - }
> + clientEmitter = new JavaEmitter(this.configuration);
> break;
> -
> case XSLTConstants.LanguageTypes.C_SHARP:
> clientEmitter = new CSharpEmitter(this.configuration);
> break;
> @@ -101,8 +96,10 @@
> throw new UnsupportedOperationException();
>
> }
> -
> - clientEmitter.emitStub();
> + if (this.configuration.isServerSide())
> + clientEmitter.emitSkeleton();
> + else
> + clientEmitter.emitStub();
>
>
> }
>
> Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java?rev=170382&r1=170381&r2=170382&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java (original)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOption.java Mon May 16 06:02:23 2005
> @@ -95,11 +95,11 @@
> private void validate(String optionType){
> invalid = !((WSDL_LOCATION_URI_OPTION).equalsIgnoreCase(optionType) ||
> (OUTPUT_LOCATION_OPTION).equalsIgnoreCase(optionType) ||
> - (ADVANCED_CODEGEN_OPTION).equalsIgnoreCase(optionType) ||
> + (SERVER_SIDE_CODE_OPTION).equalsIgnoreCase(optionType) ||
> (CODEGEN_ASYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
> (CODEGEN_SYNC_ONLY_OPTION).equalsIgnoreCase(optionType) ||
> (PACKAGE_OPTION).equalsIgnoreCase(optionType)||
> - //(CLIENT_PACKAGE).equalsIgnoreCase(optionType) ||
> + (GENERATE_SERVICE_DESCRIPTION_OPTION).equalsIgnoreCase(optionType)||
> (STUB_LANGUAGE_OPTION).equalsIgnoreCase(optionType));
> }
> }
>
> Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java?rev=170382&r1=170381&r2=170382&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java (original)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/CommandLineOptionConstants.java Mon May 16 06:02:23 2005
> @@ -26,10 +26,8 @@
>
> public static final String WSDL_LOCATION_URI_OPTION = "uri";
> public static final String OUTPUT_LOCATION_OPTION = "o";
> - public static final String ADVANCED_CODEGEN_OPTION = "x";
> -
> - public static final String CLIENT_PACKAGE = "clientpackage";
> -
> + public static final String SERVER_SIDE_CODE_OPTION = "ss";
> + public static final String GENERATE_SERVICE_DESCRIPTION_OPTION = "sd";
> public static final String CODEGEN_ASYNC_ONLY_OPTION = "a";
> public static final String CODEGEN_SYNC_ONLY_OPTION = "s";
> public static final String PACKAGE_OPTION = "p";
>
> Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java?rev=170382&r1=170381&r2=170382&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java (original)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/XSLTConstants.java Mon May 16 06:02:23 2005
> @@ -63,4 +63,17 @@
> public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/CallbackHandlerTemplate.xsl";
> public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/CallbackHandlerTemplate.xsl";
> }
> +
> + /**
> + *
> + * Interface skeletons
> + */
> + public interface XSLTSkeletonTemplates{
> + public static final String JAVA_TEMPLATE = "/org/apache/axis/wsdl/template/java/SkeletonTemplate.xsl";
> + public static final String CSHARP_TEMPLATE = "/org/apache/axis/wsdl/template/csharp/SkeletonTemplate.xsl";
> + }
> +
> + public interface XSLTServiceXMLTemplates{
> + public static final String GENERAL_SERVICE_TEMPLATE = "/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl";
> + }
> }
>
> 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=170382&r1=170381&r2=170382&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 Mon May 16 06:02:23 2005
> @@ -127,7 +127,38 @@
> writeClass(interfaceModel,interfaceWriter);
> }
>
> + /**
> + * Writes the skeleton
> + * @param axisBinding
> + * @throws Exception
> + */
> + protected void writeSkeleton(WSDLBinding axisBinding) throws Exception {
> +
> + //Note - One can generate the skeleton using the interface XML
> + XmlDocument skeletonModel = createDOMDocuementForInterface(axisBinding);
> + ClassWriter skeletonWriter = new SkeletonWriter(this.configuration.getOutputLocation(),
> + this.configuration.getOutputLanguage()
> + );
> + writeClass(skeletonModel,skeletonWriter);
> +
> +
> + }
>
> + /**
> + * Writes the skeleton
> + * @param axisBinding
> + * @throws Exception
> + */
> + protected void writeServiceXml(WSDLBinding axisBinding) throws Exception {
> + if (this.configuration.isGenerateDeployementDescriptor()){
> + //Note - One can generate the service xml using the interface XML
> + XmlDocument skeletonModel = createDOMDocuementForInterface(axisBinding);
> + ClassWriter serviceXmlWriter = new ServiceXMLWriter(this.configuration.getOutputLocation(),
> + this.configuration.getOutputLanguage()
> + );
> + writeClass(skeletonModel,serviceXmlWriter);
> + }
> + }
>
>
> /**
> @@ -184,28 +215,38 @@
> * @see org.apache.axis.wsdl.codegen.emitter.Emitter#emitSkeleton()
> */
> public void emitSkeleton() throws CodeGenerationException {
> - throw new UnsupportedOperationException("Not supported yet");
> + try {
> + //get the binding
> + WSDLBinding axisBinding = this.configuration.getWom().getBinding(AxisBindingBuilder.AXIS_BINDING_QNAME);
> + //write interfaces
> + writeSkeleton(axisBinding);
> + //write interface implementations
> + writeServiceXml(axisBinding);
> + } catch (Exception e) {
> + e.printStackTrace();
> + throw new CodeGenerationException(e);
> + }
> }
>
> - /**
> + /**
> * Generating the callbacks
> * @param binding
> * @return
> */
> - protected XmlDocument createDOMDocumentForCallbackHandler(WSDLBinding binding){
> - WSDLInterface boundInterface = binding.getBoundInterface();
> - XmlDocument doc = new XmlDocument();
> - Element rootElement = doc.createElement("callback");
> - addAttribute(doc,"package",configuration.getPackageName(),rootElement);
> - addAttribute(doc,"name",boundInterface.getName().getLocalPart()+CALL_BACK_HANDLER_SUFFIX,rootElement);
> - addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
> + protected XmlDocument createDOMDocumentForCallbackHandler(WSDLBinding binding){
> + WSDLInterface boundInterface = binding.getBoundInterface();
> + XmlDocument doc = new XmlDocument();
> + Element rootElement = doc.createElement("callback");
> + addAttribute(doc,"package",configuration.getPackageName(),rootElement);
> + addAttribute(doc,"name",boundInterface.getName().getLocalPart()+CALL_BACK_HANDLER_SUFFIX,rootElement);
> + addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
>
> //TODO JAXRPC mapping support should be considered
> this.loadOperations(boundInterface, doc, rootElement);
> //this.loadOperations(boundInterface, doc, rootElement, "on", "Complete");
>
> - doc.appendChild(rootElement);
> - return doc;
> + doc.appendChild(rootElement);
> + return doc;
> }
>
> /**
> @@ -256,80 +297,80 @@
> return null;
> }
>
> - /**
> + /**
> * Creates the DOM tree for the interface creation
> * @param binding
> * @return
> */
> protected XmlDocument createDOMDocuementForInterface(WSDLBinding binding){
> - WSDLInterface boundInterface = binding.getBoundInterface();
> + WSDLInterface boundInterface = binding.getBoundInterface();
>
> - XmlDocument doc = new XmlDocument();
> - Element rootElement = doc.createElement("interface");
> - addAttribute(doc,"package",configuration.getPackageName(),rootElement);
> - addAttribute(doc,"name",boundInterface.getName().getLocalPart(),rootElement);
> - fillSyncAttributes(doc, rootElement);
> - loadOperations(boundInterface, doc, rootElement);
> - doc.appendChild(rootElement);
> -
> - return doc;
> -
> - }
> -
> - private void fillSyncAttributes(XmlDocument doc, Element rootElement) {
> - addAttribute(doc,"isAsync",this.configuration.isAsyncOn()?"1":"0",rootElement);
> - addAttribute(doc,"isSync",this.configuration.isSyncOn()?"1":"0",rootElement);
> - }
> + XmlDocument doc = new XmlDocument();
> + Element rootElement = doc.createElement("interface");
> + addAttribute(doc,"package",configuration.getPackageName(),rootElement);
> + addAttribute(doc,"name",boundInterface.getName().getLocalPart(),rootElement);
> + fillSyncAttributes(doc, rootElement);
> + loadOperations(boundInterface, doc, rootElement);
> + doc.appendChild(rootElement);
> +
> + return doc;
> +
> + }
> +
> + private void fillSyncAttributes(XmlDocument doc, Element rootElement) {
> + addAttribute(doc,"isAsync",this.configuration.isAsyncOn()?"1":"0",rootElement);
> + addAttribute(doc,"isSync",this.configuration.isSyncOn()?"1":"0",rootElement);
> + }
> +
> + private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement){
> + loadOperations(boundInterface, doc, rootElement, null, null);
> + }
> +
> + private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement, String operationPrefix, String operationPostfix) {
> + Collection col = boundInterface.getOperations().values();
> + Element methodElement = null;
> + WSDLOperation operation = null;
>
> - private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement){
> - loadOperations(boundInterface, doc, rootElement, null, null);
> - }
> -
> - private void loadOperations(WSDLInterface boundInterface, XmlDocument doc, Element rootElement, String operationPrefix, String operationPostfix) {
> - Collection col = boundInterface.getOperations().values();
> - Element methodElement = null;
> - WSDLOperation operation = null;
> -
> - for (Iterator iterator = col.iterator(); iterator.hasNext();) {
> - operation = (WSDLOperation) iterator.next();
> - methodElement = doc.createElement("method");
> - addAttribute(doc,"name",operation.getName().getLocalPart(),methodElement);
> - addAttribute(doc,"namepace",operation.getName().getNamespaceURI(),methodElement);
> - methodElement.appendChild(getInputElement(doc,operation));
> - methodElement.appendChild(getOutputElement(doc,operation));
> - rootElement.appendChild(methodElement);
> - }
> - }
> + for (Iterator iterator = col.iterator(); iterator.hasNext();) {
> + operation = (WSDLOperation) iterator.next();
> + methodElement = doc.createElement("method");
> + addAttribute(doc,"name",operation.getName().getLocalPart(),methodElement);
> + addAttribute(doc,"namepace",operation.getName().getNamespaceURI(),methodElement);
> + methodElement.appendChild(getInputElement(doc,operation));
> + methodElement.appendChild(getOutputElement(doc,operation));
> + rootElement.appendChild(methodElement);
> + }
> + }
>
> - /**
> + /**
> * Creates the DOM tree for implementations
> * @param binding
> * @return
> */
> - protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
> - WSDLInterface boundInterface = binding.getBoundInterface();
> + protected XmlDocument createDOMDocuementForInterfaceImplementation(WSDLBinding binding) {
> + WSDLInterface boundInterface = binding.getBoundInterface();
>
> - XmlDocument doc = new XmlDocument();
> - Element rootElement = doc.createElement("class");
> - addAttribute(doc,"package",configuration.getPackageName(),rootElement);
> - addAttribute(doc,"name",boundInterface.getName().getLocalPart()+STUB_SUFFIX,rootElement);
> - addAttribute(doc,"servicename",boundInterface.getName().getLocalPart(),rootElement);
> - addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
> - addAttribute(doc,"interfaceName",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);
> + XmlDocument doc = new XmlDocument();
> + Element rootElement = doc.createElement("class");
> + addAttribute(doc,"package",configuration.getPackageName(),rootElement);
> + addAttribute(doc,"name",boundInterface.getName().getLocalPart()+STUB_SUFFIX,rootElement);
> + addAttribute(doc,"servicename",boundInterface.getName().getLocalPart(),rootElement);
> + addAttribute(doc,"namespace",boundInterface.getName().getNamespaceURI(),rootElement);
> + addAttribute(doc,"interfaceName",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);
>
> - return doc;
> + return doc;
>
> - }
> + }
>
> protected void addAttribute(XmlDocument document,String AttribName, String attribValue, Element element){
> Attr attribute = document.createAttribute(AttribName);
> attribute.setValue(attribValue);
> element.setAttributeNode(attribute);
> -
> }
> +
> }
>
>
> Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ServiceXMLWriter.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ServiceXMLWriter.java?rev=170382&view=auto
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ServiceXMLWriter.java (added)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/ServiceXMLWriter.java Mon May 16 06:02:23 2005
> @@ -0,0 +1,51 @@
> +package org.apache.axis.wsdl.codegen.writer;
> +
> +import org.apache.axis.wsdl.codegen.XSLTConstants;
> +import org.apache.axis.wsdl.util.FileWriter;
> +
> +import java.io.File;
> +import java.io.FileOutputStream;
> +
> +/*
> +* Copyright 2004,2005 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.
> +*
> +*
> +*/
> +public class ServiceXMLWriter extends ClassWriter{
> +
> +
> + public ServiceXMLWriter(String outputFileLocation) {
> + this.outputFileLocation = new File(outputFileLocation);
> + }
> +
> + public ServiceXMLWriter(File outputFileLocation,int language) {
> + this.outputFileLocation = outputFileLocation;
> + this.language = language;
> + }
> +
> + /**
> + * @see org.apache.axis.wsdl.codegen.writer.ClassWriter#loadTemplate()
> + */
> + public void loadTemplate(){
> + Class clazz = this.getClass();
> + this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTServiceXMLTemplates.GENERAL_SERVICE_TEMPLATE);
> + }
> +
> + public void createOutFile(String packageName, String fileName) throws Exception {
> + File outputFile = FileWriter.createClassFile(outputFileLocation,packageName,"service",".xml");
> + this.stream = new FileOutputStream(outputFile);
> + }
> +}
> +
>
> Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/SkeletonWriter.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/SkeletonWriter.java?rev=170382&view=auto
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/SkeletonWriter.java (added)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/codegen/writer/SkeletonWriter.java Mon May 16 06:02:23 2005
> @@ -0,0 +1,56 @@
> +package org.apache.axis.wsdl.codegen.writer;
> +
> +import org.apache.axis.wsdl.codegen.XSLTConstants;
> +
> +import java.io.File;
> +
> +/*
> + * Copyright 2004,2005 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.
> + *
> + *
> + */
> +public class SkeletonWriter extends ClassWriter{
> +
> +
> + public SkeletonWriter(String outputFileLocation) {
> + this.outputFileLocation = new File(outputFileLocation);
> + }
> +
> + public SkeletonWriter(File outputFileLocation,int language) {
> + this.outputFileLocation = outputFileLocation;
> + this.language = language;
> + }
> +
> + /**
> + * @see org.apache.axis.wsdl.codegen.writer.ClassWriter#loadTemplate()
> + */
> + public void loadTemplate(){
> + Class clazz = this.getClass();
> + switch (language){
> + case XSLTConstants.LanguageTypes.JAVA:
> + this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTSkeletonTemplates.JAVA_TEMPLATE);
> + break;
> + case XSLTConstants.LanguageTypes.C_SHARP:
> + this.xsltStream = clazz.getResourceAsStream(XSLTConstants.XSLTSkeletonTemplates.CSHARP_TEMPLATE);
> + break;
> + case XSLTConstants.LanguageTypes.C_PLUS_PLUS:
> + case XSLTConstants.LanguageTypes.VB_DOT_NET:
> + default:
> + throw new UnsupportedOperationException();
> + }
> +
> + }
> +
> +}
>
> Added: 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=170382&view=auto
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl (added)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/general/ServiceXMLTemplate.xsl Mon May 16 06:02:23 2005
> @@ -0,0 +1,13 @@
> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> + <xsl:output method="xml" indent="yes"/>
> + <xsl:template match="/interface">
> + <xsl:comment>Auto generated Axis Service XML</xsl:comment>
> + <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>
> + <operation><xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute></operation>
> + </xsl:for-each>
> + </service>
> + </xsl:template>
> + </xsl:stylesheet>
> \ No newline at end of file
>
> 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=170382&r1=170381&r2=170382&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 Mon May 16 06:02:23 2005
> @@ -52,7 +52,7 @@
> org.apache.axis.context.MessageContext _messageContext = getMessageContext();
> <xsl:if test="$outputtype=''">
> _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
> - return null;
> + return;
> </xsl:if>
> <xsl:if test="$outputtype!=''">
> Object obj = _call.invokeBlocking(_operations[<xsl:value-of select="position()-1"/>], _messageContext);
>
> Added: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/SkeletonTemplate.xsl
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/SkeletonTemplate.xsl?rev=170382&view=auto
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/SkeletonTemplate.xsl (added)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/template/java/SkeletonTemplate.xsl Mon May 16 06:02:23 2005
> @@ -0,0 +1,31 @@
> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> + <xsl:output method="text"/>
> + <xsl:template match="/interface">
> +
> + package <xsl:value-of select="@package"/>;
> +
> + /**
> + * Auto generated java skeleton for the service by the Axis code generator
> + */
> +
> + public class <xsl:value-of select="@name"></xsl:value-of> {
> + <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-->
> +
> + /**
> + * Auto generated method signature
> + *<xsl:if test="$inputtype!=''">@param <xsl:value-of select="$inputparam"></xsl:value-of></xsl:if>
> + */
> + 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>){
> + //Todo fill this with the necessary business logic
> + <xsl:if test="$outputtype!=''">return null;</xsl:if>
> + }
> +
> +
> + </xsl:for-each>
> + }
> + </xsl:template>
> + </xsl:stylesheet>
> \ No newline at end of file
>
> Modified: webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java
> URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java?rev=170382&r1=170381&r2=170382&view=diff
> ==============================================================================
> --- webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java (original)
> +++ webservices/axis/trunk/java/modules/wsdl/src/org/apache/axis/wsdl/util/FileWriter.java Mon May 16 06:02:23 2005
> @@ -29,13 +29,12 @@
> * @param rootLocation - Location to be written
> * @param packageName - package, can be '.' seperated
> * @param fileName name of the file
> - * @param fileType type of the file, java, csharp, cpp etc
> + * @param extension type of the file, java, csharp, cpp etc
> * @return the File that was created
> * @throws IOException
> * @throws Exception
> */
> - public static File createClassFile(File rootLocation,String packageName,String fileName,int fileType) throws IOException,Exception{
> -
> + public static File createClassFile(File rootLocation,String packageName,String fileName,String extension) throws IOException,Exception{
> File returnFile = null;
> File root = rootLocation;
>
> @@ -49,13 +48,9 @@
> if (!tempFile.exists()){
> tempFile.mkdir();
> }
> -
> }
> }
>
> -
> - String extension = getExtension(fileType);
> -
> if (!fileName.endsWith(extension)){
> fileName = fileName + extension;
> }
> @@ -65,10 +60,23 @@
> if (!returnFile.exists()){
> returnFile.createNewFile();
> }
> + return returnFile;
> + }
>
> + /**
> + * Creates/ returns a file object
> + * @param rootLocation - Location to be written
> + * @param packageName - package, can be '.' seperated
> + * @param fileName name of the file
> + * @param fileType type of the file, java, csharp, cpp etc. Guesses the extension with the
> + * file type
> + * @return the File that was created
> + * @throws IOException
> + * @throws Exception
> + */
> + public static File createClassFile(File rootLocation,String packageName,String fileName,int fileType) throws IOException,Exception{
> + return createClassFile(rootLocation,packageName,fileName,getExtension(fileType));
>
> -
> - return returnFile;
> }
>
> /**
> @@ -83,6 +91,7 @@
> case XSLTConstants.LanguageTypes.C_SHARP: extension=".cs";break;
> case XSLTConstants.LanguageTypes.C_PLUS_PLUS: extension=".cpp";break;
> case XSLTConstants.LanguageTypes.VB_DOT_NET: extension=".vb";break;
> + default: extension=".xml";
> }
> return extension;
> }
>
>
>
>