[104] | 1 | <?xml version="1.0" encoding="UTF-8"?> |
---|
| 2 | <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
| 3 | xmlns:rtg="http://www.QosCosGrid.org/resourceDescription" |
---|
| 4 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> |
---|
| 5 | |
---|
| 6 | <xsl:strip-space elements="*"/> |
---|
| 7 | |
---|
| 8 | <xsl:output method="xml" version="1.0" encoding="UTF-8" omit-xml-declaration="yes" indent="yes"/> |
---|
| 9 | |
---|
| 10 | <xsl:variable name="AD_IDENTIFIER">AD_ID</xsl:variable> |
---|
| 11 | <xsl:variable name="RESOURCE_IDENTIFIER">RES_ID</xsl:variable> |
---|
| 12 | <xsl:variable name="CONSUMER_AD_IDENTIFIER">CONSUMER_AD_ID</xsl:variable> |
---|
| 13 | <xsl:variable name="PGM_IDENTIFIER">PGM_ID</xsl:variable> |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | |
---|
| 17 | <!-- ===================================================== ====================================================== --> |
---|
| 18 | <xsl:template match="/"> |
---|
| 19 | <xsl:apply-templates select="/rtg:rtg"/> |
---|
| 20 | </xsl:template> |
---|
| 21 | <!-- ===================================================== ====================================================== --> |
---|
| 22 | <xsl:template match="rtg:rtg"> |
---|
| 23 | <xsl:element name="schedulingPlan"> |
---|
| 24 | <xsl:apply-templates select="rtg:taskMapping"/> |
---|
| 25 | </xsl:element> |
---|
| 26 | </xsl:template> |
---|
| 27 | <!-- ===================================================== ====================================================== --> |
---|
| 28 | <xsl:template match="rtg:taskMapping"> |
---|
| 29 | <xsl:apply-templates select="rtg:mappedTo[@isRequirement='false']"/> |
---|
| 30 | |
---|
| 31 | <xsl:apply-templates select="rtg:processesGroupMapping[@isRequirement='false']"> |
---|
| 32 | <xsl:with-param name="GROUPS" select="rtg:processesGroup"/> |
---|
| 33 | </xsl:apply-templates> |
---|
| 34 | </xsl:template> |
---|
| 35 | <!-- ===================================================== ====================================================== --> |
---|
| 36 | <xsl:template match="rtg:mappedTo"> |
---|
| 37 | |
---|
| 38 | <xsl:variable name="ADID" select="@providerAdIdRef"/> |
---|
| 39 | <xsl:variable name="RESID" select="@providerResourceIdRef"/> |
---|
| 40 | <xsl:variable name="RESOURCE" select="/rtg:rtg/rtg:intraADInfo[@adId=$ADID]/rtg:compResource[@id=$RESID]/rtg:resourceSpecificMetric[@xsi:type='hostName']"/> |
---|
| 41 | |
---|
| 42 | <xsl:if test="$RESOURCE"> |
---|
| 43 | <xsl:element name="taskAllocation"> |
---|
| 44 | <xsl:attribute name="jobID"> |
---|
| 45 | <xsl:value-of select="../@jobId"/> |
---|
| 46 | </xsl:attribute> |
---|
| 47 | <xsl:attribute name="taskID"> |
---|
| 48 | <xsl:value-of select="../@taskId"/> |
---|
| 49 | </xsl:attribute> |
---|
| 50 | |
---|
| 51 | <xsl:if test="@allocationStatus or ../@allocationStatus"> |
---|
| 52 | <xsl:attribute name="allocationStatus"> |
---|
| 53 | <xsl:call-template name="ALLOCATION_STATUS_MAPPING_TEMPLATE"> |
---|
| 54 | <xsl:with-param name="STATUS"> |
---|
| 55 | <xsl:choose> |
---|
| 56 | <xsl:when test="@allocationStaus"> |
---|
| 57 | <xsl:value-of select="@allocationStatus"/> |
---|
| 58 | </xsl:when> |
---|
| 59 | <xsl:when test="../@allocationStatus"> |
---|
| 60 | <xsl:value-of select="../@allocationStatus"/> |
---|
| 61 | </xsl:when> |
---|
| 62 | </xsl:choose> |
---|
| 63 | </xsl:with-param> |
---|
| 64 | </xsl:call-template> |
---|
| 65 | </xsl:attribute> |
---|
| 66 | </xsl:if> |
---|
| 67 | |
---|
| 68 | <xsl:apply-templates select="$RESOURCE"/> |
---|
| 69 | |
---|
| 70 | <xsl:call-template name="TIME_INTERVAL_TEMPLATE"/> |
---|
| 71 | |
---|
| 72 | <xsl:element name="additionalProperties"> |
---|
| 73 | <xsl:element name="property"> |
---|
| 74 | <xsl:attribute name="name"> |
---|
| 75 | <xsl:value-of select="$AD_IDENTIFIER"/> |
---|
| 76 | </xsl:attribute> |
---|
| 77 | <xsl:value-of select="$ADID"/> |
---|
| 78 | </xsl:element> |
---|
| 79 | <xsl:element name="property"> |
---|
| 80 | <xsl:attribute name="name"> |
---|
| 81 | <xsl:value-of select="$RESOURCE_IDENTIFIER"/> |
---|
| 82 | </xsl:attribute> |
---|
| 83 | <xsl:value-of select="$RESID"/> |
---|
| 84 | </xsl:element> |
---|
| 85 | <xsl:element name="property"> |
---|
| 86 | <xsl:attribute name="name"> |
---|
| 87 | <xsl:value-of select="$CONSUMER_AD_IDENTIFIER"/> |
---|
| 88 | </xsl:attribute> |
---|
| 89 | <xsl:value-of select="../@consumerAdId"/> |
---|
| 90 | </xsl:element> |
---|
| 91 | |
---|
| 92 | </xsl:element> |
---|
| 93 | </xsl:element> |
---|
| 94 | </xsl:if> |
---|
| 95 | </xsl:template> |
---|
| 96 | <!-- ===================================================== ====================================================== --> |
---|
| 97 | <xsl:template name="TIME_INTERVAL_TEMPLATE"> |
---|
| 98 | <xsl:choose> |
---|
| 99 | <xsl:when test="rtg:timeInterval"> |
---|
| 100 | <xsl:apply-templates select="rtg:timeInterval" mode="TIME_INTERVAL_MODE"/> |
---|
| 101 | </xsl:when> |
---|
| 102 | <xsl:when test="../rtg:timeInterval"> |
---|
| 103 | <xsl:apply-templates select="../rtg:timeInterval" mode="TIME_INTERVAL_MODE"/> |
---|
| 104 | </xsl:when> |
---|
| 105 | <xsl:otherwise> |
---|
| 106 | <xsl:apply-templates select="/rtg:rtg/rtg:context/rtg:defaultTimeInterval" mode="TIME_INTERVAL_MODE"/> |
---|
| 107 | </xsl:otherwise> |
---|
| 108 | </xsl:choose> |
---|
| 109 | </xsl:template> |
---|
| 110 | <!-- ===================================================== ====================================================== --> |
---|
| 111 | <xsl:template match="rtg:processesGroupMapping"> |
---|
| 112 | <xsl:param name="GROUPS" select="FALSE"/> |
---|
| 113 | |
---|
| 114 | <xsl:variable name="ADID" select="@providerAdIdRef"/> |
---|
| 115 | <xsl:variable name="RESID" select="@providerResourceIdRef"/> |
---|
| 116 | <xsl:variable name="RESOURCE" select="/rtg:rtg/rtg:intraADInfo[@adId=$ADID]/rtg:compResource[@id=$RESID]/rtg:resourceSpecificMetric[@xsi:type='hostName']"/> |
---|
| 117 | |
---|
| 118 | <xsl:if test="$RESOURCE"> |
---|
| 119 | <xsl:element name="taskAllocation"> |
---|
| 120 | <xsl:attribute name="jobID"> |
---|
| 121 | <xsl:value-of select="../@jobId"/> |
---|
| 122 | </xsl:attribute> |
---|
| 123 | <xsl:attribute name="taskID"> |
---|
| 124 | <xsl:value-of select="../@taskId"/> |
---|
| 125 | </xsl:attribute> |
---|
| 126 | <xsl:attribute name="processGroupID"> |
---|
| 127 | <xsl:value-of select="@processesGroupIdRef"/> |
---|
| 128 | </xsl:attribute> |
---|
| 129 | |
---|
| 130 | <xsl:if test="@allocationStatus or ../@allocationStatus"> |
---|
| 131 | <xsl:attribute name="allocationStatus"> |
---|
| 132 | <xsl:call-template name="ALLOCATION_STATUS_MAPPING_TEMPLATE"> |
---|
| 133 | <xsl:with-param name="STATUS"> |
---|
| 134 | <xsl:choose> |
---|
| 135 | <xsl:when test="@allocationStaus"> |
---|
| 136 | <xsl:value-of select="@allocationStatus"/> |
---|
| 137 | </xsl:when> |
---|
| 138 | <xsl:when test="../@allocationStatus"> |
---|
| 139 | <xsl:value-of select="../@allocationStatus"/> |
---|
| 140 | </xsl:when> |
---|
| 141 | </xsl:choose> |
---|
| 142 | </xsl:with-param> |
---|
| 143 | </xsl:call-template> |
---|
| 144 | </xsl:attribute> |
---|
| 145 | </xsl:if> |
---|
| 146 | |
---|
| 147 | <xsl:attribute name="processQuantity"> |
---|
| 148 | <xsl:choose> |
---|
| 149 | <xsl:when test="rtg:processesQty"> |
---|
| 150 | <xsl:apply-templates select="rtg:processesQty"/> |
---|
| 151 | </xsl:when> |
---|
| 152 | <xsl:otherwise> |
---|
| 153 | <xsl:variable name="PROCESSESID" select="@processesGroupIdRef"/> |
---|
| 154 | <xsl:apply-templates select="$GROUPS[@processesGroupId=$PROCESSESID]/rtg:processesQty"/> |
---|
| 155 | </xsl:otherwise> |
---|
| 156 | </xsl:choose> |
---|
| 157 | </xsl:attribute> |
---|
| 158 | |
---|
| 159 | <xsl:apply-templates select="$RESOURCE"/> |
---|
| 160 | |
---|
| 161 | <xsl:call-template name="TIME_INTERVAL_TEMPLATE"/> |
---|
| 162 | |
---|
| 163 | <xsl:element name="additionalProperties"> |
---|
| 164 | <xsl:element name="property"> |
---|
| 165 | <xsl:attribute name="name"> |
---|
| 166 | <xsl:value-of select="$AD_IDENTIFIER"/> |
---|
| 167 | </xsl:attribute> |
---|
| 168 | <xsl:value-of select="$ADID"/> |
---|
| 169 | </xsl:element> |
---|
| 170 | <xsl:element name="property"> |
---|
| 171 | <xsl:attribute name="name"> |
---|
| 172 | <xsl:value-of select="$RESOURCE_IDENTIFIER"/> |
---|
| 173 | </xsl:attribute> |
---|
| 174 | <xsl:value-of select="$RESID"/> |
---|
| 175 | </xsl:element> |
---|
| 176 | <xsl:element name="property"> |
---|
| 177 | <xsl:attribute name="name"> |
---|
| 178 | <xsl:value-of select="$CONSUMER_AD_IDENTIFIER"/> |
---|
| 179 | </xsl:attribute> |
---|
| 180 | <xsl:value-of select="../@consumerAdId"/> |
---|
| 181 | </xsl:element> |
---|
| 182 | <xsl:element name="property"> |
---|
| 183 | <xsl:attribute name="name"> |
---|
| 184 | <xsl:value-of select="$PGM_IDENTIFIER"/> |
---|
| 185 | </xsl:attribute> |
---|
| 186 | <xsl:value-of select="@id"/> |
---|
| 187 | </xsl:element> |
---|
| 188 | </xsl:element> |
---|
| 189 | </xsl:element> |
---|
| 190 | </xsl:if> |
---|
| 191 | </xsl:template> |
---|
| 192 | <!-- ===================================================== ====================================================== --> |
---|
| 193 | <xsl:template match="rtg:resourceSpecificMetric"> |
---|
| 194 | <xsl:element name="host"> |
---|
| 195 | <xsl:attribute name="hostname"> |
---|
| 196 | <xsl:value-of select="."/> |
---|
| 197 | </xsl:attribute> |
---|
| 198 | </xsl:element> |
---|
| 199 | </xsl:template> |
---|
| 200 | <!-- ===================================================== ====================================================== --> |
---|
| 201 | <xsl:template match="rtg:processesQty"> |
---|
| 202 | <xsl:value-of select="round(rtg:value)"/> |
---|
| 203 | </xsl:template> |
---|
| 204 | <!-- ===================================================== ====================================================== --> |
---|
| 205 | <xsl:template match="*" mode="TIME_INTERVAL_MODE"> |
---|
| 206 | <xsl:element name="timeSlot"> |
---|
| 207 | <xsl:element name="startTime"> |
---|
| 208 | <xsl:value-of select="rtg:lowerBoundedRange"/> |
---|
| 209 | </xsl:element> |
---|
| 210 | |
---|
| 211 | <xsl:if test="rtg:upperBoundedRange"> |
---|
| 212 | <xsl:element name="endTime"> |
---|
| 213 | <xsl:value-of select="rtg:upperBoundedRange"/> |
---|
| 214 | </xsl:element> |
---|
| 215 | </xsl:if> |
---|
| 216 | |
---|
| 217 | <xsl:if test="rtg:duration"> |
---|
| 218 | <xsl:element name="duration"> |
---|
| 219 | <xsl:value-of select="rtg:duration"/> |
---|
| 220 | </xsl:element> |
---|
| 221 | </xsl:if> |
---|
| 222 | |
---|
| 223 | </xsl:element> |
---|
| 224 | </xsl:template> |
---|
| 225 | <!-- ===================================================== ====================================================== --> |
---|
| 226 | <xsl:template name="ALLOCATION_STATUS_MAPPING_TEMPLATE"> |
---|
| 227 | <xsl:param name="STATUS"/> |
---|
| 228 | |
---|
| 229 | <xsl:choose> |
---|
| 230 | <xsl:when test="$STATUS='Requested'">REQUESTED</xsl:when> |
---|
| 231 | <xsl:when test="$STATUS='Reserved'">RESERVED</xsl:when> |
---|
| 232 | <xsl:when test="$STATUS='PartiallyReserved'">PARTIALLY_RESERVED</xsl:when> |
---|
| 233 | <xsl:when test="$STATUS='insufficientResourcesRejection'">INSUFFICIENT_RESOURCES_REJECTION</xsl:when> |
---|
| 234 | <xsl:when test="$STATUS='insufficientBudgetRejection'">INSUFFICIENT_BUDGET_REJECTION</xsl:when> |
---|
| 235 | <xsl:when test="$STATUS='Pending'">PENDING</xsl:when> |
---|
| 236 | <xsl:when test="$STATUS='Allocated'">ALLOCATED</xsl:when> |
---|
| 237 | <xsl:when test="$STATUS='PartiallyAllocated'">PARTIALLY_ALLOCATED</xsl:when> |
---|
| 238 | <xsl:when test="$STATUS='NotAllocated'">NOT_ALLOCATED</xsl:when> |
---|
| 239 | </xsl:choose> |
---|
| 240 | </xsl:template> |
---|
| 241 | <!-- ===================================================== ====================================================== --> |
---|
| 242 | </xsl:transform> |
---|