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 na...@apache.org on 2010/01/07 09:59:54 UTC
svn commit: r896805 - in
/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl:
codegen/codegen-config.properties codegen/emitter/CEmitter.java
codegen/writer/CVCProjectWriter.java template/c/VCProjectTemplate.xsl
Author: nandika
Date: Thu Jan 7 08:58:58 2010
New Revision: 896805
URL: http://svn.apache.org/viewvc?rev=896805&view=rev
Log:
Visual Studio Project file generation support added to the code generator
Added:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/CVCProjectWriter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/VCProjectTemplate.xsl
Modified:
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/CEmitter.java
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=896805&r1=896804&r2=896805&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 Thu Jan 7 08:58:58 2010
@@ -133,6 +133,7 @@
c.svc_skeleton.template=org.apache.axis2.wsdl.codegen.writer.CSvcSkeletonWriter,/org/apache/axis2/wsdl/template/c/ServiceSkeleton.xsl
c.service.template=org.apache.axis2.wsdl.codegen.writer.CServiceXMLWriter,/org/apache/axis2/wsdl/template/c/ServiceXMLTemplate.xsl
c.build.template=org.apache.axis2.wsdl.codegen.writer.CBuildScriptWriter,/org/apache/axis2/wsdl/template/c/BuildScriptTemplate.xsl
+c.vcproject.template=org.apache.axis2.wsdl.codegen.writer.CVCProjectWriter,/org/apache/axis2/wsdl/template/c/VCProjectTemplate.xsl
# file extension for generated source files from this language
c.filename.extension=c
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=896805&r1=896804&r2=896805&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 Thu Jan 7 08:58:58 2010
@@ -41,6 +41,7 @@
import org.apache.axis2.wsdl.codegen.writer.CStubHeaderWriter;
import org.apache.axis2.wsdl.codegen.writer.CStubSourceWriter;
import org.apache.axis2.wsdl.codegen.writer.CSvcSkeletonWriter;
+import org.apache.axis2.wsdl.codegen.writer.CVCProjectWriter;
import org.apache.axis2.wsdl.codegen.writer.FileWriter;
import org.apache.axis2.wsdl.databinding.CUtils;
import org.apache.axis2.wsdl.databinding.TypeMapper;
@@ -106,6 +107,8 @@
// write interface implementations
writeCStub();
+ writeVCProjectFile();
+
} catch (Exception e) {
//log the error here
e.printStackTrace();
@@ -130,6 +133,8 @@
emitBuildScript();
writeServiceXml();
+
+ writeVCProjectFile();
}
catch (Exception e) {
@@ -200,6 +205,8 @@
this.codeGenConfiguration.getOutputLanguage());
writeFile(skeletonModel, skeletonWriterStub);
+
+
}
/** @throws Exception */
@@ -213,6 +220,43 @@
writeFile(skeletonModel, writer);
+ //writeVCProjectFile();
+
+ }
+
+ /**
+ * Write VC Projects
+ */
+
+ protected void writeVCProjectFile() throws Exception {
+ Document doc = createDOMDocumentForInterfaceImplementation();
+ CodeGenConfiguration codegen = this.codeGenConfiguration;
+ Element rootElement = doc.getDocumentElement();
+ String outputLocation = codegen.getOutputLocation().getPath();
+ String targetSourceLocation = codegen.getSourceLocation();
+ addAttribute(doc, "targetSourceLocation",targetSourceLocation, rootElement);
+ if(codegen.isSetoutputSourceLocation() && !outputLocation.equals(".") && !outputLocation.equals("")){
+ if(!codegen.isFlattenFiles()){
+ addAttribute(doc,"option","1",rootElement);
+ } else{
+ addAttribute(doc,"option","0",rootElement);
+ }
+ addAttribute(doc,"outputlocation",outputLocation,rootElement);
+ }
+ else
+ {
+ addAttribute(doc,"option","0",rootElement);
+ }
+ addAttribute(doc,"isServer",codeGenConfiguration.isServerSide() ? "1": "0", rootElement);
+ CVCProjectWriter writer = new CVCProjectWriter(
+ getOutputDirectory(
+ this.codeGenConfiguration.getOutputLocation(),
+ this.codeGenConfiguration.getSourceLocation()),
+ this.codeGenConfiguration.getOutputLanguage(),
+ axisService.getName(),
+ this.codeGenConfiguration.isServerSide()
+ );
+ writeFile(doc, writer);
}
/**
Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/CVCProjectWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/CVCProjectWriter.java?rev=896805&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/CVCProjectWriter.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/writer/CVCProjectWriter.java Thu Jan 7 08:58:58 2010
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.axis2.wsdl.codegen.writer;
+
+import java.io.File;
+import java.io.FileOutputStream;
+
+public class CVCProjectWriter extends FileWriter {
+
+ private String serviceName;
+ private boolean isServerSide = false;
+
+ public CVCProjectWriter(File outputFileLocation,String language,String sName, boolean isServerSide) {
+ this.outputFileLocation = outputFileLocation;
+ this.language = language;
+ this.serviceName = sName;
+ this.isServerSide = isServerSide;
+ }
+
+ public void createOutFile(String packageName, String fileName) throws Exception {
+ String outfilename = serviceName + (isServerSide ?"Service":"Client");
+ outputFile = org.apache.axis2.util.FileWriter.createClassFile(outputFileLocation,
+ "",
+ outfilename,
+ ".vcproj");
+ //set the existing flag
+ fileExists = outputFile.exists();
+ if (!fileExists) {
+ this.stream = new FileOutputStream(outputFile);
+ }
+ }
+}
Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/VCProjectTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/VCProjectTemplate.xsl?rev=896805&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/VCProjectTemplate.xsl (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/c/VCProjectTemplate.xsl Thu Jan 7 08:58:58 2010
@@ -0,0 +1,345 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:template match="/class">
+ <xsl:variable name="interfaceName"><xsl:value-of select="@interfaceName"/></xsl:variable>
+ <xsl:variable name="callbackname"><xsl:value-of select="@callbackname"/></xsl:variable>
+ <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="soapVersion"><xsl:value-of select="@soap-version"/></xsl:variable>
+ <xsl:variable name="method-prefix"><xsl:value-of select="@prefix"/></xsl:variable>
+ <xsl:variable name="qname"><xsl:value-of select="@qname"/></xsl:variable>
+ <xsl:variable name="servicename"><xsl:value-of select="@servicename"/></xsl:variable>
+ <xsl:variable name="caps_name"><xsl:value-of select="@caps-name"/></xsl:variable>
+ <xsl:variable name="isServer"><xsl:value-of select="@isServer"/></xsl:variable>
+ <xsl:variable name="outputlocation"><xsl:value-of select="@outputlocation"/></xsl:variable>
+ <xsl:variable name="targetsourcelocation"><xsl:value-of select="@targetsourcelocation"/></xsl:variable>
+ <xsl:variable name="option"><xsl:value-of select="@option"/></xsl:variable>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+<xsl:if test="$isServer='0'">
+ <xsl:attribute name="Name"><xsl:value-of select="$servicename"/></xsl:attribute>
+ <xsl:attribute name="RootNamespace">client</xsl:attribute>
+</xsl:if>
+<xsl:if test="$isServer='1'">
+ <xsl:attribute name="Name"><xsl:value-of select="$servicename"/></xsl:attribute>
+ <xsl:attribute name="RootNamespace">service</xsl:attribute>
+</xsl:if>
+<Platforms>
+ <Platform Name="Win32"/>
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ CharacterSet="1"
+ >
+ <xsl:if test="$isServer='0'">
+ <xsl:attribute name="ConfigurationType">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$isServer='1'">
+ <xsl:attribute name="ConfigurationType">2</xsl:attribute>
+ </xsl:if>
+ <Tool Name="VCPreBuildEventTool"/>
+ <Tool Name="VCCustomBuildTool"/>
+ <Tool Name="VCXMLDataGeneratorTool"/>
+ <Tool Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool Name="VCMIDLTool"/>
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;SERVICE_EXPORTS;AXIS2_DECLARE_EXPORT"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ >
+ <xsl:choose>
+ <xsl:when test="$option=1">
+ <xsl:attribute name="AdditionalIncludeDirectories">.;.\<xsl:value-of select="$targetsourcelocation"/>;$(AXIS2C_HOME)\include;$(AXIS2C_HOME)\include\platforms;</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="AdditionalIncludeDirectories">.;$(AXIS2C_HOME)\include;$(AXIS2C_HOME)\include\platforms;</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </Tool>
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="axiom.lib axutil.lib axis2_engine.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories="$(AXIS2C_HOME)\lib"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+ IntermediateDirectory="$(ConfigurationName)"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <xsl:if test="$isServer='0'">
+ <xsl:attribute name="ConfigurationType">1</xsl:attribute>
+ </xsl:if>
+ <xsl:if test="$isServer='1'">
+ <xsl:attribute name="ConfigurationType">2</xsl:attribute>
+ </xsl:if>
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;SERVICE_EXPORTS"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ >
+ <xsl:choose>
+ <xsl:when test="$option=1">
+ <xsl:attribute name="AdditionalIncludeDirectories">.;.\<xsl:value-of select="$targetsourcelocation"/>;$(AXIS2C_HOME)\include;$(AXIS2C_HOME)\include\platforms;</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="AdditionalIncludeDirectories">.;$(AXIS2C_HOME)\include;$(AXIS2C_HOME)\include\platforms;</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </Tool>
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="axiom.lib axutil.lib axis2_engine.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="$(AXIS2C_HOME)\lib"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ >
+ <File>
+ <xsl:attribute name="RelativePath">.\axis2_extension_mapper.c</xsl:attribute>
+ </File>
+ <xsl:if test="$isServer='0'">
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="@name"/>.c</xsl:attribute>
+ </File>
+ </xsl:if>
+ <xsl:if test="$isServer='1'">
+ <File>
+ <xsl:attribute name="RelativePath">.\axis2_svc_skel_<xsl:value-of select="@servicename"/>.c</xsl:attribute>
+ </File>
+ <File>
+ <xsl:attribute name="RelativePath">.\axis2_skel_<xsl:value-of select="@servicename"/>.c</xsl:attribute>
+ </File>
+ </xsl:if>
+ <xsl:for-each select="method">
+ <xsl:choose>
+ <xsl:when test="$option=1">
+ <xsl:for-each select="input/param[@type!='' and @ours ]">
+ <xsl:variable name="inputtype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$targetsourcelocation"/>\<xsl:value-of select='$inputtype'/>.c</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="output/param[@type!='' and @ours]">
+ <xsl:variable name="outputtype1" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$targetsourcelocation"/>\<xsl:value-of select="$outputtype1"/>.c</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="fault/param[@type!='' and contains(@type, 'adb_')]">
+ <xsl:variable name="faulttype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$targetsourcelocation"/>\<xsl:value-of select="$faulttype"/>.c</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="input/param[@type!='' and @ours ]">
+ <xsl:variable name="inputtype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select='$inputtype'/>.c</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="output/param[@type!='' and @ours]">
+ <xsl:variable name="outputtype1" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$outputtype1"/>.c</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="fault/param[@type!='' and contains(@type, 'adb_')]">
+ <xsl:variable name="faulttype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$faulttype"/>.c</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ >
+ <File>
+ <xsl:attribute name="RelativePath">.\axis2_extension_mapper.h</xsl:attribute>
+ </File>
+ <xsl:if test="$isServer='0'">
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="@name"/>.h</xsl:attribute>
+ </File>
+ </xsl:if>
+ <xsl:if test="$isServer='1'">
+ <File>
+ <xsl:attribute name="RelativePath">.\axis2_skel_<xsl:value-of select="@servicename"/>.h</xsl:attribute>
+ </File>
+ </xsl:if>
+ <xsl:for-each select="method">
+ <xsl:choose>
+ <xsl:when test="$option=1">
+ <xsl:for-each select="input/param[@type!='' and @ours ]">
+ <xsl:variable name="inputtype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$targetsourcelocation"/>\<xsl:value-of select='$inputtype'/>.h</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="output/param[@type!='' and @ours]">
+ <xsl:variable name="outputtype1" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$targetsourcelocation"/>\<xsl:value-of select="$outputtype1"/>.h</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="fault/param[@type!='' and contains(@type, 'adb_')]">
+ <xsl:variable name="faulttype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$targetsourcelocation"/>\<xsl:value-of select="$faulttype"/>.h</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:for-each select="input/param[@type!='' and @ours ]">
+ <xsl:variable name="inputtype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select='$inputtype'/>.h</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="output/param[@type!='' and @ours]">
+ <xsl:variable name="outputtype1" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$outputtype1"/>.h</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ <xsl:for-each select="fault/param[@type!='' and contains(@type, 'adb_')]">
+ <xsl:variable name="faulttype" select="substring-before(@type, '_t*')"/>
+ <File>
+ <xsl:attribute name="RelativePath">.\<xsl:value-of select="$faulttype"/>.h</xsl:attribute>
+ </File>
+ </xsl:for-each>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav">
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file