> DNU home > online course > DirXML Driver Development
April 2001
DeveloperNet University Course

Lab 4: Programming the Publisher Shim to Modify NDS User Objects


Module Objective: During this lab, you will add the functunality to process <modify> commands to the LabDriver's Publisher Shim.

Note: This lab requires that you have completed Lab 3.

Important

  • You can troubleshoot your program by using printlines similar to the one below:

      System.out.println( debugMsgString );

    Where debugMsgString is your own debug string. Your debug strings will be sent to DSTrace output where they can help you logically isolate problems in your code.

Do This

  1. Once you get the LabDriver from Lab 3 working, shut down ConsoleOne and use the NT Services console to shut down eDirectory.
  2. EXPLANATION: During this lab, you will change the functionality in the driver by writing new methods for its Publisher shim. You must shut down the driver because you will be writing new methods for its Publisher shim. When the driver starts up, it reads and caches all the class/jar files. So, in order for the driver to see the new classes/jars, you must shut it down and restart it.

  3. Find the Lab 4 hints in the file "LabPublicationShim.java" and follow the instructions located there to write code to handle a modify event from PBXSimulator.
  4. The lab driver obtains input events from PBXSimulator by polling it.

    The object obtained from PBXSimulator during a poll is a Vector. The elements inside of this Vector are more Vectors, each of which contains information about a single event.

    Each event Vector contains name value pairs which when put together constitute the event. The strings inside of an event Vector describing an event to modify the title attribute in an NDS object with an associate value of 002, might look like the list of Vector elements below:

    Example:

    element(0) == "evtType^mod employee"
    element(1) == "emplid^002"
    element(2) == "title^new title"

    Note: You don't really need to know the format of the returned value to perform this lab because the lab publisher already has methods that unpack it for you. This information is provided only to help facilitate your understanding of the overall function of the lab publisher.

    The job of a publisher shim is to translate the event from an external system into XDS which is understandable by the DirXML engine which can then implement the event in NDS.

    In the example shown above the lab publisher should produce an XDS document looking something like that shown below:


    <modify class-name="User" src-dn="0199">
    <association state="associated">002</association>
    <modify-attr attr-name="title">
    <remove-all-values/>
    <add-value>
    <value type="string">new title</value>
    </add-value>
    </modify-attr>
    </modify>

    The type mappings in "MappingRule.xml" file are shown below for your convenience.

    NDS Name PBXSimulator Name
    Given Name
    firstName
    Surname
    lastName
    OU
    department
    Title
    title
    L
    location
    Telephone Number
    phone

    Your job in this lab is to use the org.w3c.dom package JavaDoc installed on your workstation for reference to modify the buildModEmpXDS() AND buildModifyAttrElem() methods in LabPublicationShim.java so that the lab publisher will build an XDS output document similar to the one above.

    When the XDS document is sent to the DirXML engine, the engine will perform a change attribute value operation on the target object in the NDS tree.

  5. Test the Publisher side of your driver.

    After you have rebuilt and copied the driver JAR to "c:\Novell\NDS\Lib", start up the driver, DSTrace, and ConsoleOne.

    Make a change to the title attribute in some account in PBXSimulator and then click its "Commit" button. The Publisher should detect the event almost immediately and attempt to perform the change you specified. If the change is pushed to NDS, your Publisher side works (HINT: Don't forget to reopen ConsoleOne windows to refresh their contents before checking for changes.).

    Remember that events are constrained by the publisher's and the driver's respective filters and then supported by the code in the publisher shim. If you add another class and/or attribute to the filters, you must also add code to support the new class and/or attribute type in the publisher shim.

    You can view the document you are building at any time by:


// First, create XmlDocument from DOM Document you are building
XmlDocument xmlDoc = new XmlDocument(doc);

// Second, install indents to make the document easier to read
xmlDoc.setIndent(true);

// Third, print out the document to DSTrace
System.out.println(xmlDoc.getDocumentString());

Previous Contents Next
download sample file