Поделиться через


How to Create a Class

Назначение: System Center Operations Manager 2007

The following procedures explain how to create classes in the Operations Manager 2007 Authoring console. Before you perform these procedures, you must first complete the prerequisite procedure, How to Create a New Management Pack, in which you first create a new management pack before adding the classes shown here.

The classes created in the following procedures have these characteristics:

  • Abstract class based on Windows Computer Role named MyMP.MyComputerRoleBase. Class has a single non-key property named Version and no key property.

  • Two classes based on the abstract class named MyComputerRole1 and MyComputerRole2.

  • Single application component hosted by a computer role called MyApplicationComponent. Class has a single key property named ComponentName.

To create an abstract class

  1. In the Authoring console, select Service Model, and then select Classes.

  2. Right-click in the Classes pane, select New, and then select Windows Server role.

  3. In the ID box, type the name MyMP.MyComputerRoleBase.

  4. In the Display Name box, type My Computer Role Base.

  5. Click Finish.

  6. Right click MyMP.MyComputerRoleBase and select Properties.

  7. On the General tab, in the Attributes pane, select Abstract.

  8. On the Properties tab, do the following:

    1. Right-click in the navigation pane and select Add Property.

    2. In the Choose a unique identifier box, type Version, and then click OK.

    3. In the Display Name box, type Version. Because you are expecting only a single instance of this class on a computer, it does not require a key property.

    4. Click OK.

  9. Select File, and then click Save.

To create classes based on a custom abstract class

  1. In the Authoring console, select Service Model, and then select Classes.

  2. Right-click in the Classes pane, select New, and then select Custom Class.

  3. In the Choose a unique identifier box, type the name MyMP.MyComputerRole1, and then click OK.

  4. On the General tab, do the following:

    1. In the Base Class box, select MyMP.MyComputerRoleBase.

    2. In the Display Name box, type My Computer Role 1. Click OK.

  5. Right-click in the Classes pane, select New, and then select Custom Class.

  6. In the Choose a unique identifier box, type the name MyMP.MyComputerRole2, and then click OK.

  7. On the General tab, do the following:

    1. In the Base Class box, select MyMP.MyComputerRoleBase.

    2. In the Display Name box, type My Computer Role 2. Click OK.

  8. Select File, and then click Save.

To create an application component

  1. In the Authoring console, select Service Model, and then select Classes.

  2. Right-click in the Classes pane, select New, and then select Windows Local Application Component.

  3. On the General page, do the following:

    1. In the ID box, type the name MyMP.MyApplicationComponent.

    2. In the Display Name box, type My Application Component.

    3. Click Next.

  4. On the Key Properties page, do the following:

    1. Check the Specify a key property box. You are expecting multiple instances of MyApplicationComponent for each instance of MyApplication, which is its hosting parent. Therefore, the class requires a key property.

    2. In the ID box, replace the existing text with ComponentName.

    3. In the Type box, select string.

    4. In the Name box, type Component Name. Click Next.

  5. On the Hosting Class page, do the following:

    1. In the Hosting Class box, type MyMP.MyComputerRole1.

    2. In the Hosting Relationship ID box, type MyMP.MyComputerRole1HostsMyApplicationComponent.

    3. In the Hosting Relationship Name box, type My Computer Role 1 Hosts My Application Component. Click Finish.

  6. Select File, and then click Save.

См. также

Основные понятия

Classes
Choosing a Base Class