<!-- A sample configuration for the binding service which defines different
port configurations (ports-default, ports-01, ports-02, ports-03) for 
running multiple JBoss instances in parallel on the same machine.                              

The actual port configuration can be selected within the jboss-         
service.xml file via ServiceBindingManager attribute ServerName. 

The following sample e.g. selects the jboss-default port configuration                                                           

<mbean code="org.jboss.services.binding.ServiceBindingManager"            
   name="jboss.system:service=ServiceBindingManager">                       
   <attribute name="ServerName">ports-default</attribute>                   
   <attribute name="StoreURL">file:../server/port-bindings.xml</attribute>  
   <attribute name="StoreFactoryClassName">                                 
     org.jboss.services.binding.XMLServicesStoreFactory                     
   </attribute>                                                             
</mbean>                                                                  
                                                                           
For running a second server instance you have to change the port        
bindings of that instance by specifing an alternative port binding      
configuration in the jboss-service.xml of the second server, e.g.       

<attribute name="ServerName">ports-01</attribute>                        

REMARK: Additional documentation for running multiple JBoss instances     
on the same machine can be found in the offical JBoss3.x book     
in chapter "MBean Service Miscellany - Services Binding Management" !                                                                         
 -->

<service-bindings>

   <!-- ********************************************************** -->
   <!-- *                        ports-default                   * -->
   <!-- ********************************************************** -->
   <server name="ports-default">

      <!-- ********************* jboss-service.xml ****************** -->

      <service-config name="jboss:service=Naming"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port" hostName="BindAddress">
            <attribute name="RmiPort">1098</attribute>
         </delegate-config>
         <binding port="1099" host="${jboss.bind.address}"/>
      </service-config>


      <service-config name="jboss:service=WebService"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="8083"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=jrmp"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4444"/>
      </service-config>

      <service-config name="jboss:service=invoker,type=pooled"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="4445"/>
      </service-config>


      <!-- ********************* cluster-service.xml **************** -->

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RmiPort"/>
         <binding port="1098"/>
      </service-config>

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1100"/>
      </service-config>

      <service-config name="jboss:service=invoker,type=jrmpha"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4444"/>
      </service-config>


      <!-- ********************* iiop-service.xml ****************** -->

      <service-config name="jboss:service=CorbaORB"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="3528"/>
      </service-config>      


      <!-- ********************* jmx-rmi-adaptor.sar **************** -->

      <service-config name="jboss.jmx:type=Connector,name=RMI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="19001"/>
      </service-config>


      <!-- ********************* snmp-adaptor.sar ****************** -->

      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1162"/>
      </service-config>

      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1161"/>
      </service-config>


      <!-- ********************* jbossmq-service.xml **************** -->

      <!-- JMS related services -->
      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="8093"/>
      </service-config>


      <!-- ********************* hsqldb-ds.xml ********************** -->

      <!-- Hypersonic related services when using the tcp/ip access
      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
      >
         <delegate-config>
         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
<xsl:stylesheet
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

  <xsl:output method="xml" />
  <xsl:param name="host"/>
  <xsl:param name="port"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="config-property[@name='ConnectionURL']">
    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
  </xsl:template>

  <xsl:template match="*|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
]]>
         </xslt-config>
         </delegate-config>
         <binding host="localhost" port="1701" />
      </service-config>

      <service-config name="jboss:service=Hypersonic"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
      >
         <delegate-config portName="Port" />
         <binding port="1701" />
      </service-config>
      -->


      <!-- ********************* tomcat ********************** -->

      <service-config name="jboss.web:service=WebServer"
         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
         >
         <delegate-config>
            <xslt-config configName="ConfigFile"><![CDATA[
   <xsl:stylesheet
         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

     <xsl:output method="xml" />
     <xsl:param name="port"/>

     <xsl:variable name="portAJP" select="$port - 71"/>
     <xsl:variable name="portHttps" select="$port + 363"/>

     <xsl:template match="/">
       <xsl:apply-templates/>
     </xsl:template>

      <xsl:template match = "Connector">
         <Connector>
            <xsl:for-each select="@*">
            <xsl:choose>
               <xsl:when test="(name() = 'port' and . = '8080')">
                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8009')">
                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'redirectPort')">
                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8443')">
                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
               </xsl:otherwise>
            </xsl:choose>
            </xsl:for-each>
            <xsl:apply-templates/>
         </Connector>
      </xsl:template>

     <xsl:template match="*|@*">
       <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
     </xsl:template>
   </xsl:stylesheet>
   ]]>
            </xslt-config>
         </delegate-config>
         <binding port="8080"/>
      </service-config>

   </server>


   <!-- ********************************************************** -->
   <!-- *                          ports-01                      * -->
   <!-- ********************************************************** -->
   <server name="ports-01">

      <!-- ********************* jboss-service.xml ****************** -->

      <service-config name="jboss:service=Naming"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port" hostName="BindAddress">
            <attribute name="RmiPort">1198</attribute>
         </delegate-config>
         <binding port="1199" host="${jboss.bind.address}"/>
      </service-config>


      <service-config name="jboss:service=WebService"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="8183"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=jrmp"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4544"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=pooled"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="4545"/>
      </service-config>


      <!-- ********************* cluster-service.xml **************** -->

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RmiPort"/>
         <binding port="1198"/>
      </service-config>

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1200"/>
      </service-config>

      <service-config name="jboss:service=invoker,type=jrmpha"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4544"/>
      </service-config>


      <!-- ********************* iiop-service.xml ****************** -->

      <service-config name="jboss:service=CorbaORB"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="3628"/>
      </service-config>      


      <!-- ********************* jmx-rmi-adaptor.sar **************** -->

      <service-config name="jboss.jmx:type=Connector,name=RMI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="19101"/>
      </service-config>


      <!-- ********************* snmp-adaptor.sar ****************** -->

      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1262"/>
      </service-config>

      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1261"/>
      </service-config>


      <!-- ********************* jbossmq-service.xml **************** -->

      <!-- JMS related services -->
      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="8193"/>
      </service-config>


      <!-- ********************* hsqldb-ds.xml ********************** -->

      <!-- Hypersonic related services 
      
            Only if using TCP setup (local file setup by default)
      
      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
      >
         <delegate-config>
         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
<xsl:stylesheet
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

  <xsl:output method="xml" />
  <xsl:param name="host"/>
  <xsl:param name="port"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="config-property[@name='ConnectionURL']">
    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
  </xsl:template>

  <xsl:template match="*|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
]]>
         </xslt-config>
         </delegate-config>
         <binding host="localhost" port="1801" />
      </service-config>

      <service-config name="jboss:service=Hypersonic"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
      >
         <delegate-config portName="Port" />
         <binding port="1801" />
      </service-config>

      -->


      <!-- ********************* tomcat ********************** -->

      <service-config name="jboss.web:service=WebServer"
         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
         >
         <delegate-config>
            <xslt-config configName="ConfigFile"><![CDATA[
   <xsl:stylesheet
         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

     <xsl:output method="xml" />
     <xsl:param name="port"/>

     <xsl:variable name="portAJP" select="$port - 71"/>
     <xsl:variable name="portHttps" select="$port + 363"/>

     <xsl:template match="/">
       <xsl:apply-templates/>
     </xsl:template>

      <xsl:template match = "Connector">
         <Connector>
            <xsl:for-each select="@*">
            <xsl:choose>
               <xsl:when test="(name() = 'port' and . = '8080')">
                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8009')">
                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'redirectPort')">
                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8443')">
                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
               </xsl:otherwise>
            </xsl:choose>
            </xsl:for-each>
            <xsl:apply-templates/>
         </Connector>
      </xsl:template>

     <xsl:template match="*|@*">
       <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
     </xsl:template>
   </xsl:stylesheet>
   ]]>
            </xslt-config>
         </delegate-config>
         <binding port="8180"/>
      </service-config>

   </server>


   <!-- ********************************************************** -->
   <!-- *                          ports-02                      * -->
   <!-- ********************************************************** -->
   <server name="ports-02">

      <!-- ********************* jboss-service.xml ****************** -->

      <service-config name="jboss:service=Naming"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port" hostName="BindAddress">
            <attribute name="RmiPort">1298</attribute>
         </delegate-config>
         <binding port="1299" host="${jboss.bind.address}"/>
      </service-config>


      <service-config name="jboss:service=WebService"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="8283"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=jrmp"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4644"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=pooled"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="4645"/>
      </service-config>


      <!-- ********************* cluster-service.xml **************** -->

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RmiPort"/>
         <binding port="1298"/>
      </service-config>

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1300"/>
      </service-config>

      <service-config name="jboss:service=invoker,type=jrmpha"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4644"/>
      </service-config>


      <!-- ********************* iiop-service.xml ****************** -->

      <service-config name="jboss:service=CorbaORB"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="3728"/>
      </service-config>      
   

      <!-- ********************* jmx-rmi-adaptor.sar **************** -->

      <service-config name="jboss.jmx:type=Connector,name=RMI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="19201"/>
      </service-config>


      <!-- ********************* snmp-adaptor.sar ****************** -->

      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1362"/>
      </service-config>

      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1361"/>
      </service-config>


      <!-- ********************* jbossmq-service.xml **************** -->

      <!-- JMS related services -->
      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="8293"/>
      </service-config>


      <!-- ********************* hsqldb-ds.xml ********************** -->

      <!-- Hypersonic related services
      
            Only if using TCP setup (local file setup by default)

      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
      >
         <delegate-config>
         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
<xsl:stylesheet
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

  <xsl:output method="xml" />
  <xsl:param name="host"/>
  <xsl:param name="port"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="config-property[@name='ConnectionURL']">
    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
  </xsl:template>

  <xsl:template match="*|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
]]>
         </xslt-config>
         </delegate-config>
         <binding host="localhost" port="1901" />
      </service-config>

      <service-config name="jboss:service=Hypersonic"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
      >
         <delegate-config portName="Port" />
         <binding port="1901" />
      </service-config>

       -->


      <!-- ********************* tomcat ***************** -->
      
      <service-config name="jboss.web:service=WebServer"
         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
         >
         <delegate-config>
            <xslt-config configName="ConfigFile"><![CDATA[
   <xsl:stylesheet
         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

     <xsl:output method="xml" />
     <xsl:param name="port"/>

     <xsl:variable name="portAJP" select="$port - 71"/>
     <xsl:variable name="portHttps" select="$port + 363"/>

     <xsl:template match="/">
       <xsl:apply-templates/>
     </xsl:template>

      <xsl:template match = "Connector">
         <Connector>
            <xsl:for-each select="@*">
            <xsl:choose>
               <xsl:when test="(name() = 'port' and . = '8080')">
                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8009')">
                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'redirectPort')">
                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8443')">
                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
               </xsl:otherwise>
            </xsl:choose>
            </xsl:for-each>
            <xsl:apply-templates/>
         </Connector>
      </xsl:template>

     <xsl:template match="*|@*">
       <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
     </xsl:template>
   </xsl:stylesheet>
   ]]>
            </xslt-config>
         </delegate-config>
         <binding port="8280"/>
      </service-config>

   </server>

   <!-- ********************************************************** -->
   <!-- *                          ports-03                      * -->
   <!-- ********************************************************** -->
   <server name="ports-03">

      <!-- ********************* jboss-service.xml ****************** -->

      <service-config name="jboss:service=Naming"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port" hostName="BindAddress">
            <attribute name="RmiPort">1398</attribute>
         </delegate-config>
         <binding port="1399" host="${jboss.bind.address}"/>
      </service-config>


      <service-config name="jboss:service=WebService"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="8383"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=jrmp"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4744"/>
      </service-config>


      <service-config name="jboss:service=invoker,type=pooled"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="4745"/>
      </service-config>


      <!-- ********************* cluster-service.xml **************** -->

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RmiPort"/>
         <binding port="1398"/>
      </service-config>

      <service-config name="jboss:service=HAJNDI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1400"/>
      </service-config>

      <service-config name="jboss:service=invoker,type=jrmpha"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="4744"/>
      </service-config>


      <!-- ********************* iiop-service.xml ****************** -->

      <service-config name="jboss:service=CorbaORB"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="3828"/>
      </service-config>      
   

      <!-- ********************* jmx-rmi-adaptor.sar **************** -->

      <service-config name="jboss.jmx:type=Connector,name=RMI"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="RMIObjectPort"/>
         <binding port="19301"/>
      </service-config>


      <!-- ********************* snmp-adaptor.sar ****************** -->

      <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1462"/>
      </service-config>

      <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="Port"/>
         <binding port="1461"/>
      </service-config>


      <!-- ********************* jbossmq-service.xml **************** -->

      <!-- JMS related services -->
      <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
         >
         <delegate-config portName="ServerBindPort"/>
         <binding port="8393"/>
      </service-config>


      <!-- ********************* hsqldb-ds.xml ********************** -->

      <!-- Hypersonic related services
      
            Only if using TCP setup (local file setup by default)

      <service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS"
         delegateClass="org.jboss.services.binding.XSLTConfigDelegate"
      >
         <delegate-config>
         <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[
<xsl:stylesheet
      xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

  <xsl:output method="xml" />
  <xsl:param name="host"/>
  <xsl:param name="port"/>

  <xsl:template match="/">
    <xsl:apply-templates/>
  </xsl:template>

  <xsl:template match="config-property[@name='ConnectionURL']">
    <config-property type="java.lang.String" name="ConnectionURL">jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/></config-property>
  </xsl:template>

  <xsl:template match="*|@*">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>
]]>
         </xslt-config>
         </delegate-config>
         <binding host="localhost" port="1901" />
      </service-config>

      <service-config name="jboss:service=Hypersonic"
         delegateClass="org.jboss.services.binding.AttributeMappingDelegate"
      >
         <delegate-config portName="Port" />
         <binding port="1901" />
      </service-config>

       -->


      <!-- ********************* tomcat ********************** -->

      <service-config name="jboss.web:service=WebServer"
         delegateClass="org.jboss.services.binding.XSLTFileDelegate"
         >
         <delegate-config>
            <xslt-config configName="ConfigFile"><![CDATA[
   <xsl:stylesheet
         xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>

     <xsl:output method="xml" />
     <xsl:param name="port"/>

     <xsl:variable name="portAJP" select="$port - 71"/>
     <xsl:variable name="portHttps" select="$port + 363"/>

     <xsl:template match="/">
       <xsl:apply-templates/>
     </xsl:template>

      <xsl:template match = "Connector">
         <Connector>
            <xsl:for-each select="@*">
            <xsl:choose>
               <xsl:when test="(name() = 'port' and . = '8080')">
                  <xsl:attribute name="port"><xsl:value-of select="$port" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8009')">
                  <xsl:attribute name="port"><xsl:value-of select="$portAJP" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'redirectPort')">
                  <xsl:attribute name="redirectPort"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:when test="(name() = 'port' and . = '8443')">
                  <xsl:attribute name="port"><xsl:value-of select="$portHttps" /></xsl:attribute>
               </xsl:when>
               <xsl:otherwise>
                  <xsl:attribute name="{name()}"><xsl:value-of select="." /></xsl:attribute>
               </xsl:otherwise>
            </xsl:choose>
            </xsl:for-each>
            <xsl:apply-templates/>
         </Connector>
      </xsl:template>

     <xsl:template match="*|@*">
       <xsl:copy>
         <xsl:apply-templates select="@*|node()"/>
       </xsl:copy>
     </xsl:template>
   </xsl:stylesheet>
   ]]>
            </xslt-config>
         </delegate-config>
         <binding port="8380"/>
      </service-config>

   </server>

</service-bindings>
