dfuserver.xsl 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ################################################################################
  4. # HPCC SYSTEMS software Copyright (C) 2012 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" xml:space="default">
  20. <xsl:output method="xml" indent="yes" omit-xml-declaration="no" encoding="UTF-8"/>
  21. <xsl:template match="text()"/>
  22. <xsl:param name="process" select="'sasha'"/>
  23. <xsl:param name="isLinuxInstance" select="0"/>
  24. <xsl:variable name="oldPathChars">
  25. <xsl:choose>
  26. <xsl:when test="$isLinuxInstance = 1">'\\'</xsl:when>
  27. <xsl:otherwise>'/$'</xsl:otherwise>
  28. </xsl:choose>
  29. </xsl:variable>
  30. <xsl:variable name="newPathChars">
  31. <xsl:choose>
  32. <xsl:when test="$isLinuxInstance = 1">'/'</xsl:when>
  33. <xsl:otherwise>'\:'</xsl:otherwise>
  34. </xsl:choose>
  35. </xsl:variable>
  36. <xsl:template match="/">
  37. <xsl:apply-templates select="/Environment/Software/DfuServerProcess[@name=$process]"/>
  38. </xsl:template>
  39. <xsl:template match="DfuServerProcess">
  40. <DFUSERVER>
  41. <xsl:attribute name="name">
  42. <xsl:value-of select="@name"/>
  43. </xsl:attribute>
  44. <xsl:attribute name="daliServers"> <xsl:call-template name="getDaliServers">
  45. <xsl:with-param name="daliServer" select="@daliServers"/>
  46. </xsl:call-template>
  47. </xsl:attribute>
  48. <xsl:attribute name="enableSNMP">
  49. <xsl:call-template name="outputBool">
  50. <xsl:with-param name="val" select="@enableSNMP"/>
  51. </xsl:call-template>
  52. </xsl:attribute>
  53. <xsl:attribute name="enableSysLog">
  54. <xsl:call-template name="outputBool">
  55. <xsl:with-param name="val" select="@enableSysLog"/>
  56. </xsl:call-template>
  57. </xsl:attribute>
  58. <xsl:attribute name="queue">
  59. <xsl:value-of select="@queue"/>
  60. </xsl:attribute>
  61. <xsl:attribute name="monitorQueue">
  62. <xsl:value-of select="@monitorqueue"/>
  63. </xsl:attribute>
  64. <xsl:attribute name="monitorInterval">
  65. <xsl:value-of select="@monitorinterval"/>
  66. </xsl:attribute>
  67. <xsl:attribute name="transferBufferSize">
  68. <xsl:value-of select="@transferBufferSize"/>
  69. </xsl:attribute>
  70. <xsl:copy-of select="/Environment/Software/Directories"/>
  71. <SSH>
  72. <xsl:for-each select="SSH/@*">
  73. <xsl:if test="string(.) != ''">
  74. <xsl:copy-of select="."/>
  75. </xsl:if>
  76. </xsl:for-each>
  77. </SSH>
  78. </DFUSERVER>
  79. </xsl:template>
  80. <xsl:template name="outputBool">
  81. <xsl:param name="val"/>
  82. <xsl:param name="default" select="0"/>
  83. <xsl:choose>
  84. <xsl:when test="$val='true'">1</xsl:when>
  85. <xsl:when test="$val='false'">0</xsl:when>
  86. <xsl:otherwise><xsl:value-of select='$default'/></xsl:otherwise>
  87. </xsl:choose>
  88. </xsl:template>
  89. <xsl:template name="getDaliServers">
  90. <xsl:param name="daliServer"/>
  91. <xsl:for-each select="/Environment/Software/DaliServerProcess[@name=$daliServer]/Instance">
  92. <xsl:call-template name="getNetAddress">
  93. <xsl:with-param name="computer" select="@computer"/>
  94. </xsl:call-template>
  95. <xsl:if test="string(@port) != ''">:<xsl:value-of select="@port"/>
  96. </xsl:if>
  97. <xsl:if test="position() != last()">, </xsl:if>
  98. </xsl:for-each>
  99. </xsl:template>
  100. <xsl:template name="getNetAddress">
  101. <xsl:param name="computer"/>
  102. <xsl:value-of select="/Environment/Hardware/Computer[@name=$computer]/@netAddress"/>
  103. </xsl:template>
  104. </xsl:stylesheet>