esdl2java_srvdummy.xslt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ##############################################################################
  4. # HPCC SYSTEMS software Copyright (C) 2015 HPCC Systems.
  5. #
  6. # Licensed under the Apache License, Version 2.0 (the "License");
  7. # you may not use this file except in compliance with the License.
  8. # You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. ##############################################################################
  18. -->
  19. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  20. <xsl:output method="text" omit-xml-declaration="yes" indent="no"/>
  21. <xsl:template match="esxdl">
  22. package <xsl:value-of select="EsdlService/@name"/>;
  23. import <xsl:value-of select="EsdlService/@name"/>.*;
  24. <xsl:apply-templates select="EsdlService"/>
  25. </xsl:template>
  26. <xsl:template match="EsdlService">
  27. public class <xsl:value-of select="@name"/>ServiceDummy extends <xsl:value-of select="@name"/>ServiceBase
  28. {
  29. <xsl:for-each select="EsdlMethod">
  30. public <xsl:value-of select="@response_type"/><xsl:text> </xsl:text><xsl:value-of select="@name"/>(EsdlContext context, <xsl:value-of select="@request_type"/> request)
  31. {
  32. System.out.println("Method <xsl:value-of select="@name"/><xsl:text> </xsl:text>of Service <xsl:value-of select="../@name"/><xsl:text> </xsl:text>called!");
  33. <xsl:value-of select="@response_type"/><xsl:text> </xsl:text> response = new <xsl:value-of select="@response_type"/>();
  34. return response;
  35. }
  36. </xsl:for-each>
  37. }
  38. </xsl:template>
  39. </xsl:stylesheet>