Configure the Adapter – Advanced Method

These configuration files are located in the db-adapter.zip package in the C:\UCMDB\UCMDBServer\content\adapters folder that you extracted when preparing the adapter package. For details, see Prepare the Adapter Package.

Configure the orm.xml File

In this step, you map the CITs and relationships in the CMDB to the tables in the RDBMS.

  1. Open the orm.xml file in a text editor.

    This file, by default, contains a template that you use to map as many CITs and relationships as needed.

    Note Do not edit the orm.xml file in any version of Notepad from Microsoft Corporation. Use Notepad++, UltraEdit, or some other third-party text editor.

  2. Make changes to the file according to the data entities to be mapped. For details, see the following examples.

    The following types of relationships may be mapped in the orm.xml file:

    • One to one:

    • The code for this type of relationship is:

      <one-to-one name="end1" target-entity="node">
              <join-column name="Device_ID" >
      </one-to-one>
      <one-to-one name="end2" target-entity="sw_sub_component">
              <join-column name="Device_ID" >
              <join-column name="Version_ID" >
      </one-to-one>
      
    • Many to one:

    • The code for this type of relationship is:

      <many-to-one name="end1" target-entity="node">
              <join-column name="Device_ID" >
      </many-to-one>
      <one-to-one name="end2" target-entity="sw_sub_component">
              <join-column name="Device_ID" >
              <join-column name="Version_ID" >
      </one-to-one>
      
    • Many to many:

    • The code for this type of relationship is:

      <many-to-one name="end1" target-entity="node">
              <join-column name="Device_ID" >
      </many-to-one>
      <many-to-one name="end2" target-entity="sw_sub_component">
              <join-column name="Device_ID" >
              <join-column name="Version_ID" >
      </many-to-one>
      
  3. For details about naming conventions, see Naming Conventions.

    Example of Entity Mapping Between the Data Model and the RDBMS:

    Note Attributes that do not have to be configured are omitted from the following examples.

    • The class of the CMDB CIT:

      <entity class="generic_db_adapter.node">
      
    • The name of the table in the RDBMS:

      <table name="Device" />
      
    • The column name of the unique identifier in the RDBMS table:

      <column name="Device ID" />
      
    • The name of the attribute in the CMDB CIT:

      <basic name="name">
      
    • The name of the table field in the external data source:

      <column name="Device_Name" />
      
    • The name of the new CIT you created in Create a CI Type:

      <entity class="generic_db_adapter.MyAdapter">
      
    • The name of the corresponding table in the RDBMS:

      <table name="SW_License" />
      
    • The unique identity in the RDBMS:

       

    • The attribute name in the CMDB CIT and the name of the corresponding attribute in the RDBMS:

       

    Example of Relationship Mapping Between the Data Model and the RDBMS:

    • The class of the CMDB relationship:

      <entity class="generic_db_adapter.node_containment_MyAdapter">
      
    • The name of the RDBMS table where the relationship is performed:

      <table name="MyAdapter" />
      
    • The unique ID in the RDBMS:

      <id name="id1">
              <column updatable="false" insertable="false" 
      name="Device_ID">
              <generated-value strategy="TABLE" />
      </id>
      <id name="id2">
              <column updatable="false" insertable="false" 
      name="Version_ID">  
              <generated-value strategy="TABLE" />
      </id>
      
    • The relationship type and the CMDB CIT:

      <many-to-one target-entity="node" name="end1">
      
    • The primary key and foreign key fields in the RDBMS:

      <join-column updatable="false" insertable="false" 
      referenced-column-name="[column_name]" name="Device_ID" />
      

Configure the reconciliation_rules.txt File

In this step you define the rules by which the adapter reconciles the CMDB and the RDBMS (only if Mapping Engine is used, for backward compatibility with version 8.x):

  1. Open META-INF\reconciliation_rules.txt in a text editor.

  2. Make changes to the file according to the CIT you are mapping. For example, to map a node CIT, use the following expression:

    multinode[node] ordered expression[^name]
    

    Note

    • If the data in the database is case sensitive, do not delete the control character (^).

    • Check that each opening square bracket has a matching closing bracket.

For details, see The reconciliation_rules.txt File (for backwards compatibility).