Sun Java System Directory Server Enterprise Edition 6.0 Reference

Transformation Examples

The following sections provide use cases in which virtual data views are required, and the combination of transformation models and actions required to implement the use cases.


Example 23–4 Adapting an ADAM Object Class For LDAP Compliance

An organization, Example A, stores its users in an LDAP directory. Example A acquires another company, Example B, which stores its users in an ADAM directory.

In Example A's LDAP directory, a user is stored as an inetOrgPerson. In Example B's directory, a user is stored as a user. A transformation is required that maps the ADAM user object class to the LDAP inetOrgPerson object class.

The following transformation is defined on the physical data view of Example A's directory:

$ dpconf add-virtual-transformation -h myHost -p 2389 -D "cn=Proxy Manager" \
 exampleB-view-name mapping attr-value-mapping objectclass internal-value:user \
 view-value:inetOrgPerson


Example 23–5 Constructing an Attribute With a Write Transformation

Example A stores user entries in its directory. All user entries require a mail attribute. If user entries without a mail attribute are added, a schema violation error is returned. Example A has a client application that adds user entries to the directory. Some user entries do not contain a mail attribute and the client application is incapable of generating one. To avoid schema violations when a user entry is added, a transformation is defined that adds the mail attribute to an add request. The value of the mail attribute is taken from the uid provided in the client add request, with the addition of @example.com.

The following diagram indicates the transformation that occurs on an add request.

Figure shows the creation of an attribute with a write
transformation

This transformation is defined on the physical data view by using the following dpconf command.

$ dpconf add-virtual-transformation -h myHost -p 2389 -d "cn=Proxy Manager" \
 exampleA-view-name write add-attr mail \${uid}@example.com

In this command, \${uid} means the value of the uid attribute for that entry.



Example 23–6 Constructing an Attribute With a Read Transformation

Example A does not store the mail addresses of its users in its directory. However, a new client application requires that a user's mail address be returned with the user entry.

All mail addresses in the organization take the form firstname.lastname@example.com. The organization defines a virtual view in which the mail attribute is added to each user entry for reads only. The value of the mail attribute is generated by taking the value of the givenName and sn attributes that already exist in the user entry.

The following diagram indicates the transformation that occurs on user entries when they are returned in a search.

Figure shows the creation of an attribute with a read
transformation

This transformation is defined on the physical data view by using the following dpconf command.

$ dpconf add-virtual-transformation -h myHost -p 2389 -d "cn=Proxy Manager" \
 exampleA-view-name read add-attr mail \${givenname}.\${sn}@example.com


Example 23–7 Adding a Default Attribute Value

Example A stores a number of products in its directory. In the past, each product was associated with a support person, an employee responsible for handling all support calls for that product. In the physical data store, each product is therefore associated with a supportPerson attribute, whose value is the DN of an employee in the organization.

The organization has changed its business process for support queries and now sends all product queries to a central hotline. To handle this change without changing the physical data, the organization defines a virtual data view where all product entries do not have a supportPerson attribute, but have a hotline attribute instead. The value of the hotline attribute is an 0800 number that is the same for all products.

The following diagram indicates the transformation that occurs on product entries when they are returned in a search.

Figure shows transformation of an entry with no reference
to other entries.

This transformation is defined on the physical data view by using the following dpconf commands:

$ dpconf add-virtual-transformation -h myHost -p 2389 -d "cn=Proxy Manager" \
 exampleA-view-name read remove-attr supportPerson
$ dpconf add-virtual-transformation -h myHost -p 2389 -d "cn=Proxy Manager" \
 exampleA-view-name read add-attr hotline "0800755 8625"


Example 23–8 Using a Virtual Transformation to Rename a DN

Example A has a client application that needs to sort entries according to their object class.

To do this, Example A defines a virtual transformation that rewrites the RDN of entries to include the object class of the entry along with its cn, whenever an entry is returned to that specific client application.

The following transformation is defined on the physical data view of Example A's directory:


$ dpconf add-virtual-transformation -h myHost -p 2389 -d "cn=Proxy Manager" \
 exampleB-view-name mapping attr-value-mapping dn internal-value:cn=\${cn} \
 view-value:cn=\${cn},objectclass=\${objectclass}