Tuesday, May 24, 2011

SCOM 2007 R2 Authoring: What are classes?

Definition:
Classes are used to create or use pre-defined tables in the OperationsManager database.  When you see them in the XML format of a ManagementPack, you’ll find they use <Classtype tags. Classes can be inherited from other ManagementPacks and ManagementPack Libraries. They have attributes and they can have properties which map one to one to the SQL Server Table which just so happens to have the same name as the Class’ ID.
Classes are used for a variety of reasons and with a variety of other classes, discoveries, rules and monitors.
Classes have attributes which serve to reveal the personality of the class.
Attributes:
Accessibility:  Either Public or Internal. Public and the class can be referenced by other ManagementPacks.  Internal and it can’t.
Abstract: Either True or False. True, the class is inheritable.  False, it is not.
Base:  System!System.Entity Is the highest base reference you can make. Any library that has the Accessibility attribute set to public and abstract attributes set for inheritance can be referenced by your class.
ID:   Name of your class.
Hosted:  True or false and it is not entirely arbitrary. If you reference another class from another mp or library, if that class is hosted then your class will be hosted. On the other hand, if you create your own class, you can set it to true or false. However, if you set it to true, you must have a property with a key attribute set to true.
Non-hosted classes generally have a relationship tag that binds them to a hosted class.
Singleton:  True or False. All classes which inherit classes from the system – that is, inherit from SCOM --have their Singleton attribute set to true.
 Properties:
Here’s an example of a class with properties:

 <ClassType ID="LM.Directory.Services.LocalService" Accessibility="Public" Abstract="true" Base="System!System.Entity" Hosted="true" Singleton="false">
          <Property ID="AcceptPause" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
          <Property ID="AcceptStop" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
          <Property ID="Caption" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
          <Property ID="DisplayName" Type="string" Key="true" CaseSensitive="false" Length="256" MinLength="0" />
          <Property ID="Name" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
          <Property ID="State" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
          <Property ID="Status" Type="string" Key="false" CaseSensitive="false" Length="256" MinLength="0" />
 </ClassType>

Technically, the ID, Key and Type attributes are the only attributes required. The additional tags serve to fine tune the database fields.

No comments:

Post a Comment