123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2011
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <!--======================================================================
- "monitor" command is used to perform the following actions:
- - start
- - stop
- - test
- - unregister
- ======================================================================-->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" requiredCapability="canUseAdministrationPortal">
- <xts:block id="doAction" processor="XSLT" type="exec">
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" version="1.0">
- <xsl:variable name="prefix" select="'checkbox_'"/>
- <xsl:template match="/root/command/form:monitor/form:env">
- <xsl:variable name="action">
- <xsl:value-of select="form:param[@name='ifrmcmd']"/>
- </xsl:variable>
- <xsl:variable name="imm">
- <xsl:value-of select="form:param[@name='m_smt_imm']"/>
- </xsl:variable>
- <xsl:choose>
- <!-- ==================================================
- = perform actions from tools monitor page. =
- ===================================================-->
- <xsl:when test="form:param[starts-with(@name,$prefix)] and not($action='activate')">
- <xsl:for-each select="form:param[starts-with(@name,$prefix)]">
- <xsl:call-template name="send-requests">
- <xsl:with-param name="path" select="xtsext:urldecode(string(.))"/>
- <xsl:with-param name="action" select="$action"/>
- <xsl:with-param name="imm" select="$imm"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:when>
- <!-- ==================================================
- = perform actions from actions page =
- ===================================================-->
- <xsl:otherwise>
- <xsl:call-template name="send-requests">
- <xsl:with-param name="path" select="form:param[@name = 'm_obj']"/>
- <xsl:with-param name="action" select="$action"/>
- <xsl:with-param name="imm" select="$imm"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!--===============================================================================================
- Send monitor actions.
- ===============================================================================================-->
- <xsl:template name="send-requests">
- <xsl:param name="path"/>
- <xsl:param name="action"/>
- <xsl:param name="imm"/>
- <xts:sequence>
- <xts:append>
- <monitorResponse>
- <path><xsl:value-of select="$path"/></path>
- <xsl:choose>
- <!-- ================ action: start =================== -->
- <xsl:when test="$action = 'start'">
- <!-- startService requst to dispatcher. TODO: need to be revised !!!-->
- <send:request provider="dispatcher" faultBlock="faultHandler">
- <bus2:startService xmlns:bus2="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <service xsi:type="xsd:string">
- <xsl:value-of select="$path"/>
- </service>
- </bus2:startService>
- </send:request>
- </xsl:when>
- <!-- ================ action: stop =================== -->
- <xsl:when test="$action = 'stop'">
- <!-- stopService requst to dispatcher. TODO: need to be revised !!!-->
- <send:request provider="dispatcher" faultBlock="faultHandler">
- <bus2:stopService xmlns:bus2="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <service xsi:type="xsd:string">
- <xsl:value-of select="$path"/>
- </service>
- <immediately xsi:type="xsd:boolean">
- <xsl:choose>
- <xsl:when test="$imm = 'true' ">true</xsl:when>
- <xsl:otherwise>false</xsl:otherwise>
- </xsl:choose>
- </immediately>
- </bus2:stopService>
- </send:request>
- </xsl:when>
- <!-- ================ action: test (ping) =================== -->
- <xsl:when test="$action = 'test'">
- <!-- send ping request to dispatcher/services. TODO: need to be revised !!!-->
- <send:request provider="dispatcher" faultBlock="faultHandler">
- <bus2:ping xmlns:bus2="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <dispatcher xsi:type="xsd:string">
- <xsl:value-of select="$path"/>
- </dispatcher>
- </bus2:ping>
- </send:request>
- </xsl:when>
- <!-- ================ action: unregister ( dispatcher) =================== -->
- <xsl:when test="$action = 'unregister'">
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm" faultBlock="faultHandler">
- <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
- <cm:delete xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <cm:search>
- <xsl:value-of select="$path"/>
- </cm:search>
- <cm:options recursive="true" force="true"/>
- </cm:delete>
- </xts:transform>
- </send:request>
- </xts:transform>
- </xsl:when>
- <!-- ================ action: set_default_active (cm) =================== -->
- <xsl:when test="$action = 'set_default_active'">
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm" faultBlock="faultHandler">
- <bus2:update xmlns:bus2="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <objects xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus2:baseClass[1]">
- <item xsi:type="bus2:contentManagerService">
- <searchPath xsi:type="bus2:stringProp">
- <value xsi:type="xsd:string">
- <xsl:value-of select="$path"/>
- </value>
- </searchPath>
- <startAsActive xsi:type="bus2:booleanProp">
- <value xsi:type="xsd:boolean">true</value>
- </startAsActive>
- </item>
- </objects>
- </bus2:update>
- </send:request>
- </xts:transform>
- </xsl:when>
- <!-- ================ action: activate (cm) =================== -->
- <xsl:when test="$action = 'activate'">
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm" faultBlock="faultHandler">
- <bus2:activate xmlns:bus2="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <contentManagerURI xsi:type="xsd:string">
- <xsl:value-of select="$path"/>
- </contentManagerURI>
- </bus2:activate>
- </send:request>
- </xts:transform>
- </xsl:when>
- </xsl:choose>
- </monitorResponse>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-Fault handler=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-->
- <xts:block id="faultHandler" type="fault" processor="XSLT">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:output method="xml"/>
- <xsl:template match="/root/fault">
- <copyFault>
- <xsl:copy-of select="."/>
- </copyFault>
- </xsl:template>
- <xsl:template match="text()"/>
- </xsl:stylesheet>
- </xts:block>
- <!-- Although using XSLTC can complile, it doesn't work properly -->
- <xts:block id="result" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="doAction">
- <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/">
- <xsl:template match="/">
- <response xmlns="http://developer.cognos.com/schemas/xts/admin/iServerManagement/1/">
- <xsl:apply-templates/>
- <xsl:if test="/root/command/form:monitor[@debug='true']">
- <debug>
- <xsl:copy-of select="/root"/>
- </debug>
- </xsl:if>
- </response>
- </xsl:template>
- <xsl:template match="monitorResponse[.//xts:exception]">
- <status success="false">
- <path><xsl:value-of select="path"/></path>
- <detail>
- <xsl:for-each select=".//xts:exception/*[local-name()='exceptionDetail']/*[local-name()='exception']">
- <error>
- <xsl:if test="@errorCode != ''">
- <xsl:value-of select="@errorCode"/>
- <xsl:text>-</xsl:text>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="@errorCodeString != ''">
- <xsl:value-of select="@errorCodeString"/>
- </xsl:when>
- <xsl:when test="./*[local-name()='message']/*[local-name()='messageString']">
- <xsl:value-of select="./*[local-name()='message']/*[local-name()='messageString']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="./*[local-name()='message']"/>
- </xsl:otherwise>
- </xsl:choose>
- </error>
- </xsl:for-each>
- </detail>
- </status>
- </xsl:template>
- <xsl:template match="monitorResponse[not (.//xts:exception) and not (//cm:deleteResponse/@count=0)]">
- <status success="true">
- <path><xsl:value-of select="path"/></path>
- <xsl:copy-of select="./*[local-name()='pingResponse']/*"/>
- </status>
- </xsl:template>
- <xsl:template match="monitorResponse[not (.//xts:exception) and (//cm:deleteResponse/@count=0)] ">
- <status success="false" count="0">
- <path><xsl:value-of select="path"/></path>
- </status>
- </xsl:template>
- <xsl:template match="text()"/>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|