2.11 Driver Configuration

The DirXML engine, in conjunction with ConsoleOne, provides a mechanism for you to define driver-specific configuration parameters. This is accomplished with an XML file that describes the parameters. ConsoleOne uses this XML file to dynamically construct a simple user interface that administrators can use to configure your driver for a particular installation.

In general, your driver must be configurable from Novell adminstrator utilities such as Console One and iManager.

A sample XML configuration file from the Java skeleton driver appears below:

  <?xml version="1.0" encoding="UTF-8" ?> 
  <!--  this file contains a sample driver options xml document;
        it is designed for use with the Java DirXML skeleton
        driver 
  com.novell.nds.dirxml.driver.skeleton.SkeletonDriverShim
  
        It illustrates some of the concepts in driver options
        files
  -->
  <driver-config name="Java Skeleton Driver">
     <driver-options>
        <option-1 display-name="Sample String option">This is a string</option-1>
        <option-2 display-name="Sample int option (enter an integer)">10</option-2>
     </driver-options>
     <subscriber-options>
        <sub-1 display-name="Sample Subscriber option">String for Subscriber</sub-1>
     </subscriber-options>
     <publisher-options>
        <pub-1 display-name="Sample Publisher option">String for Publisher</pub-1>
        <polling-interval display-name="Polling interval in seconds">2</polling-interval>
     </publisher-options>
  </driver-config>
  

Your configuration XML file must conform to the above format, in that it must contain a <driver-config> element with zero or one of each the following elements as children: <driver-options>, <subscriber-options>, and <publisher-options>.

The children of the <driver-options>, <subscriber-options>, and <publisher-options> elements can be named anything you like and should have an attribute named "display-name". The value of the display-name attribute is used to label an entry field in the user interface generated by ConsoleOne.

The <driver-options>, <subscriber-options>, and <publisher-options> together with their content are passed to the corresponding object init methods in your driver as children of the <init-params> element.

In addition, the DirXML engine provides a mechanism for attribute values from an eDirectory object to be passed to your init methods. This is accomplished by placing a <config-object> element as a child of one of the options elements. The content of the <config-object> element is a <query> that specifies the eDirectory object and attributes to read. The <config-object> element has a display-name attribute that is used to label a field in the generated user interface. The user interface field allows the user to specify the eDirectory object referenced in the <query> element’s "dest-dn" attribute (see example, below). The <read-attr> element underneath a <query> element has a "type" attribute with two possible values: "default" and "xml". If "xml" is specified, the attribute is assumed to be serialized XML and will be parsed and pasted into the initialization document as XML, rather than as a string, octet string, or stream.

For example, the following modifications to the XML configuration file for the Java skeleton driver results in the XML data from the skeleton driver’s Create Rule (in this particular installation) being passed to the DriverShim init method:

  <?xml version="1.0" encoding="UTF-8" ?> 
  <!--  this file contains a sample driver options xml document
        it is designed for use with the Java DirXML skeleton driver 
        com.novell.nds.dirxml.driver.skeleton.SkeletonDriverShim
  
        It illustrates some of the concepts in driver options files
  -->
  <driver-config name="Java Skeleton Driver">
     <driver-options>
        <config-object display-name="Create Rule">
           <query dest-dn="novell\Driver Set\Java Skeleton Driver\Subscriber\Create Rule" scope="entry">
              <read-attr attr-name="XmlData" type="xml"/>
           </query>
        </config-object>
        <option-1 display-name="Sample String option">This is a string</option-1>
        <option-2 display-name="Sample int option (enter an integer)">10</option-2>
     </driver-options>
     <subscriber-options>
        <sub-1 display-name="Sample Subscriber option">String for Subscriber</sub-1>
     </subscriber-options>
     <publisher-options>
        <pub-1 display-name="Sample Publisher option">String for Publisher</pub-1>
        <polling-interval display-name="Polling interval in seconds">2</polling-interval>
     </publisher-options>
  </driver-config>
  
  

Using this configuration file, the DirXML engine sends the following initialization document to the skeleton driver.

  <nds dtdversion="1.0" ndsversion="8.5">
     <source>
        <product version="1.0">DirXML</product>
        <contact>Novell, Inc.</contact>
     </source>
     <input>
        <init-params src-dn="\PERIN-TAO\novell\Driver Set\Java Skeleton Driver">
           <authentication-info>
              <server>server.app:400</server>
              <user>User1</user>
              <password><!-- content suppressed --></password>
           </authentication-info>
           <driver-options>
              <instance class-name="DirXML-Rule" src-dn="PERIN-TAO\novell\Driver Set\Java Skeleton Driver\Subscriber\Create Rule" src-entry-id="35867">
                 <attr attr-name="XmlData">
                    <value timestamp="965252142#6" type="xml">
                       <create-rules>
                          <create-rule class-name="User">
                             <required-attr attr-name="Surname"/>
                             <required-attr attr-name="Telephone Number"/>
                          </create-rule>
                       </create-rules>
                    </value>
                 </attr>
              </instance>
              <option-1 display-name="Sample String option">This is a
                       string</option-1>
              <option-2 display-name="Sample int option (enter an
                       integer)">10</option-2>
           </driver-options>
        </init-params>
     </input>
  </nds>
  

The above document shows that the data of the XmlData attribute has been embedded in the initialization document. Reading the create rule is not useful for a driver, but it does serve to illustrate the concept of obtaining the value of an eDirectory attribute as part of the driver initialization data.