Thursday, May 06, 2010

Adding SCOM Class Properties to the DGML

Updated transform for SCOM/OpsMgr management pack diagramming with DGML. This time I added in the SCOM class attributes as properties on DGML nodes – perhaps I should’ve used categories?? The legend in the visual studio viewer then lets you highlight parts of the class model based upon properties.

scr1

Next thing would be to include attributes about relationships as properties on the links. Also, what about referencing other system center management packs?

<?xmlversion="1.0" encoding="utf-8"?>
<
xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.microsoft.com/vs/2009/dgml" version="1.0">
    <
xsl:outputmethod="xml" indent="yes"/>
    <
xsl:templatematch="/">
        <
DirectedGraph>
            <
Nodes>
                <
xsl:apply-templatesselect="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType" />
            </
Nodes>
            <
Links>
                <
xsl:apply-templatesselect="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType" />
            </
Links>
            <
Categories>
            </
Categories>
            <
Properties>
                <
PropertyId="Accessibility" Label="Accessibility" Description="Accessibility" DataType="System.String" />
                <
PropertyId="Abstract" Label="Abstract" Description="Whether this is an abstract class" DataType="System.Boolean" />
                <
PropertyId="Base" Label="Base" Description="Whether this is a base class" DataType="System.String"/>
                <
PropertyId="Hosted" Label="Hosted" Description="Whether this is hosted" DataType="System.Boolean"/>
                <
PropertyId="Singleton" Label="Singleton" Description="Whether this is singleton" DataType="System.Boolean"/>
            </
Properties>
        </
DirectedGraph>
    </
xsl:template>
    <
xsl:templatematch="ManagementPack/TypeDefinitions/EntityTypes/ClassTypes/ClassType">
        <
xsl:elementname="Node">
            <
xsl:attributename="Id">
                <
xsl:value-ofselect="@ID"/>
            </
xsl:attribute>
            <
xsl:attributename="Accessibility">
                <
xsl:value-ofselect="@Accessibility"/>
            </
xsl:attribute>
            <
xsl:attributename="Abstract">
                <
xsl:value-ofselect="@Abstract"/>
            </
xsl:attribute>
            <
xsl:attributename="Base">
                <
xsl:value-ofselect="@Base"/>
            </
xsl:attribute>
            <
xsl:attributename="Hosted">
                <
xsl:value-ofselect="@Hosted"/>
            </
xsl:attribute>
            <
xsl:attributename="Singleton">
                <
xsl:value-ofselect="@Singleton"/>
            </
xsl:attribute>
        </
xsl:element>
    </
xsl:template>

    <
xsl:templatematch="ManagementPack/TypeDefinitions/EntityTypes/RelationshipTypes/RelationshipType">
        <
Link>
            <
xsl:attributename="Source">
                <
xsl:value-ofselect="Source"/>
            </
xsl:attribute>
            <
xsl:attributename="Target">
                <
xsl:value-ofselect="Target"/>
            </
xsl:attribute>
        </
Link>
    </
xsl:template>
</
xsl:stylesheet>

No comments: