PageRenderTime 53ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/jboss-as-7.1.1.Final/testsuite/integration/src/test/xslt/addRemoteOutboundConnection.xsl

#
Extensible Stylesheet Language Transformations | 90 lines | 82 code | 8 blank | 0 comment | 0 complexity | d45e3145ccc6cf4b246906372b688445 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <xsl:stylesheet version="1.0"
  2. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:d="urn:jboss:domain:1.2"
  4. xmlns:r="urn:jboss:domain:remoting:1.1">
  5. <xsl:output method="xml" indent="yes"/>
  6. <!--
  7. An XSLT style sheet which will enable EJB Remote calling to another server,
  8. by adding an outbound-socket-binding and remote-outbound-connection.
  9. -->
  10. <!-- remote outbound connection parameters -->
  11. <xsl:param name="connectionName" select="'remote-ejb-connection'"/>
  12. <xsl:param name="node" select="'localhost'"/>
  13. <xsl:param name="remotePort" select="'4447'"/>
  14. <xsl:param name="securityRealm" select="NOT_DEFINED"/>
  15. <xsl:param name="userName" select="NOT_DEFINED"/>
  16. <xsl:variable name="newRemoteOutboundConnection">
  17. <r:remote-outbound-connection>
  18. <xsl:attribute name="name"><xsl:value-of select="$connectionName"/></xsl:attribute>
  19. <xsl:attribute name="outbound-socket-binding-ref">binding-<xsl:value-of select="$connectionName"/></xsl:attribute>
  20. <xsl:if test="$securityRealm != 'NOT_DEFINED'">
  21. <xsl:attribute name="security-realm"><xsl:value-of select="$securityRealm"/></xsl:attribute>
  22. </xsl:if>
  23. <xsl:if test="$userName != 'NOT_DEFINED'">
  24. <xsl:attribute name="username"><xsl:value-of select="$userName"/></xsl:attribute>
  25. </xsl:if>
  26. <r:properties>
  27. <r:property name="SASL_POLICY_NOANONYMOUS" value="false"/>
  28. <r:property name="SSL_ENABLED" value="false"/>
  29. </r:properties>
  30. </r:remote-outbound-connection>
  31. </xsl:variable>
  32. <!-- traverse the whole tree, so that all elements and attributes are eventually current node -->
  33. <xsl:template match="node()|@*">
  34. <xsl:copy>
  35. <xsl:apply-templates select="node()|@*"/>
  36. </xsl:copy>
  37. </xsl:template>
  38. <xsl:template match="//r:subsystem">
  39. <xsl:choose>
  40. <xsl:when test="not(//r:subsystem/r:outbound-connections)">
  41. <xsl:copy>
  42. <xsl:apply-templates select="node()|@*"/>
  43. <r:outbound-connections>
  44. <xsl:copy-of select="$newRemoteOutboundConnection"/>
  45. </r:outbound-connections>
  46. </xsl:copy>
  47. </xsl:when>
  48. <xsl:otherwise>
  49. <xsl:copy>
  50. <xsl:apply-templates select="node()|@*"/>
  51. </xsl:copy>
  52. </xsl:otherwise>
  53. </xsl:choose>
  54. </xsl:template>
  55. <xsl:template match="//r:subsystem/r:outbound-connections">
  56. <xsl:copy>
  57. <xsl:apply-templates select="node()|@*"/>
  58. <xsl:copy-of select="$newRemoteOutboundConnection"/>
  59. </xsl:copy>
  60. </xsl:template>
  61. <xsl:template match="//d:socket-binding-group[@name='standard-sockets']">
  62. <xsl:copy>
  63. <xsl:attribute name="name">
  64. <xsl:value-of select="'standard-sockets'"/>
  65. </xsl:attribute>
  66. <xsl:attribute name="default-interface">
  67. <xsl:value-of select="@default-interface"/>
  68. </xsl:attribute>
  69. <xsl:attribute name="port-offset">
  70. <xsl:value-of select="@port-offset"/>
  71. </xsl:attribute>
  72. <xsl:apply-templates select="node()"/>
  73. <d:outbound-socket-binding>
  74. <xsl:attribute name="name">binding-<xsl:value-of select="$connectionName"/></xsl:attribute>
  75. <d:remote-destination>
  76. <xsl:attribute name="host"><xsl:value-of select="$node"/></xsl:attribute>
  77. <xsl:attribute name="port"><xsl:value-of select="$remotePort"/></xsl:attribute>
  78. </d:remote-destination>
  79. </d:outbound-socket-binding>
  80. </xsl:copy>
  81. </xsl:template>
  82. </xsl:stylesheet>