Advanced Customization > Info*Engine User’s Guide > Info*Engine Custom Tag Reference > Info*Engine Tags > Directory Library Tags
  
Directory Library Tags
To use tags in the directory tag library, you must include a taglib directive similar to the following:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/directory"
prefix="iedir" %>
The syntax for these tags assumes that you have specified the iedir prefix in the taglib directive. If you specify a different prefix, use the prefix you specified in place of iedir in the tag syntax.
* 
The directory library tags can only be used in JSP pages; they are not recognized in standalone tasks.
createObjects
The createObjects tag creates new entries in the specified LDAP directory service.
Before executing this tag, you must create an Info*Engine group that contains elements that define the LDAP entries. Each element must have the following attributes:
dn—The distinguished name of the entry.
objectClass—The object class to associate with the entry. Determines valid values from the directory schema configured for the LDAP server.
You can include additional attributes in each element, if they are required by the object class.
You specify the required Info*Engine input group by nesting the param tag in this tag block and providing the GROUP_IN parameter value.
You also specify the required parameter by nesting the param tag in this tag block.
Syntax
<iedir:createObjects uri="service_URL">
<iedir:param name="GROUP_IN" data="group_name"/>
</iedir:createObjects>
Attribute Descriptions
Required Attributes: uri
uri
Specifies an LDAP URL that identifies the directory service to use when creating the new entries. For example, entering the following URL identifies the host and the base entry as “myHost.myState.myCompany.com”:
ldap://myHost.myState.myCompany.com
This attribute is required.
Example
The following example declares that the page uses tags from the Info*Engine directory and core tag libraries and that the tags have the iedir and ie prefixes. The task tag block creates the group of elements used as input and the createObjects tag block creates LDAP entries in the “myHost.myCompany.com” directory service:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>

<%@ taglib uri="http://www.ptc.com/infoengine/taglib/directory"
prefix="iedir" %>

<ie:task uri="ldaptask.xml">
<ie:param name="GROUP_OUT" data="ldap_group"/>
</ie:task>

<iedir:createObjects
uri="ldap://myHost.myCompany.com">
<iedir:param name="GROUP_IN" data="ldap_group"/>
</iedir:createObjects>
deleteObject
The deleteObject tag deletes one LDAP leaf entry from the LDAP directory service.
Syntax
<iedir:deleteObject uri="entry_URL"/>
Attribute Descriptions
Required Attributes: uri
uri
Specifies an LDAP URL that identifies one LDAP leaf entry to delete.
The format of this LDAP URL is:
ldap://hostname:port/search_base
Replace each part of the URL with the appropriate value:
hostname:port locates the LDAP directory.
search_base is the distinguished name identifying the leaf entry to delete.
This attribute is required.
Example
The following example declares that the page uses tags from the Info*Engine directory tag library and that the tags have the iedir prefix. The deleteObject tag deletes the “com.mycompany.myHost.jAdpater” entry from the directory service located at “myCompany.com”:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/directory"
prefix="iedir" %>
<iedir:deleteObject
uri="ldap://myCompany.com/dc=jAdapter,dc=myHost,dc=myCompany,dc=com"/>
listObjects
The listObjects tag creates an Info*Engine group containing elements that are the relative distinguished names of the LDAP directory entries located directly under the specified base directory entry. Each element in the group consists of one attribute which is the distinguished name relative to the base entry.
If there are no entries directly under the specified base entry, the group returned is empty.
You name the Info*Engine group that is created using the GROUP_OUT parameter on a nested param tag.
You also specify the required parameter by nesting the param tag in this tag block.
Syntax
<iedir:listObjects uri="base_level_URL">
<iedir:param name="GROUP_OUT" data="group_name"/>

</iedir:listObjects>
Attribute Descriptions
Required Attributes: uri
uri
Specifies an LDAP URL that identifies the base directory entry to use when searching for entries. For example, entering the following URL identifies the “myCompany.com” host sets the base entry at “myHost.myState.myCompany.com”:
ldap://myCompany.com/dc=myHost,dc=myState,dc=myCompany,dc=com
This attribute is required.
Example
The following example declares that the page uses tags from the Info*Engine directory tag library and that the tags have the iedir prefix. The listObjects tag block creates the “ldap_myHost” group from entries in the directory service located at “myCompany.com” under the “dc=myHost,dc=myCompany,dc=com” base entry:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/directory"
prefix="iedir" %>

<iedir:listObjects
uri="ldap://myCompany.com/dc=myHost,dc=myCompany,dc=com">

<iedir:param name="GROUP_OUT" data="ldap_myHost"/>
</iedir:listObjects>
queryObjects
The queryObjects tag creates an Info*Engine group containing elements that are the LDAP directory entries matching the search criteria specified. Each element in the group consists of the attributes found in each entry. The names and values of the attributes in each element correspond to the names and values of the LDAP directory entry attributes. At a minimum, every element has the following attributes:
Attribute
Description
dn
The distinguished name of the entry.
objectClass
The object class to associate with the entry.
If there are no entries found using the specified search criteria, the group returned is empty.
You name the Info*Engine group that is created using the GROUP_OUT parameter on a nested param tag.
Syntax
<iedir:queryObjects uri="query_URL">
<iedir:param name="GROUP_OUT" data="group_name"/>
</iedir:queryObjects>
Attribute Descriptions
Required Attributes: uri
uri
Specifies an LDAP URL that identifies the search criteria to use in locating LDAP directory entries.
For the general format of this LDAP URL and examples, see Specifying URIs and URLs.
This attribute is required.
Example
The following example declares that the page uses tags from the Info*Engine directory tag library and that the tags have the iedir prefix. The queryObjects tag block creates the “ldap_query” group that contains all LDAP entries that reside in the directory service located at “myCompany.com” under the “dc=myHost,dc=myCompany,dc=com” base entry and that have an objectClass attribute:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/directory"
prefix="iedir" %>

<iedir:queryObjects
uri="ldap://myCompany.com/dc=myHost,dc=myCompany,dc=com??sub?objectClass=*">
<iedir:param name="GROUP_OUT" data="ldap_query"/>
</iedir:queryObjects>
updateObjects
The updateObjects tag updates existing entries in an LDAP directory service. Using this tag, you can add new attributes to existing LDAP entries, replace existing attributes, or delete existing attributes. Name the Info*Engine group that contains the LDAP attributes that you are updating by using the GROUP_IN parameter on a nested param tag.
Before executing this tag, you must create an Info*Engine group that contains elements that define the LDAP entries to be modified. Each element must have the dn attribute, the distinguished name of the entry. The additional attributes in each element identify names and values of the LDAP attributes to modify.
Syntax
<iedir:updateObjects uri="service_URL" modification="type">
<iedir:param name="GROUP_IN" data="group_name"/>
</iedir:updateObjects>
Attribute Descriptions
Required Attributes: uri
uri
Specifies an LDAP URL that identifies the directory service and the base entry to use when updating entries. For example, entering the following URL identifies the “myCompany.com” directory service:
ldap://myCompany.com/
This attribute is required.
modification
Specifies the type of modification to do. Enter one of the following types:
Modification Type
Description
ADD
Adds the LDAP attributes specified in the group element to the LDAP entry identified by the dn group element attribute.
If an LDAP attribute that is specified in a group element already exists in the LDAP entry, the tag returns an error.
DELETE
Deletes the LDAP attributes other than dn that are named in group element attributes for the LDAP entry. Each LDAP entry is identified by the dn group element attribute. To delete an entire LDAP entry, use the deleteObject tag.
If an LDAP attribute that is specified in a group element does not exist in the LDAP entry, the tag may return an error or may complete without an error, depending on the LDAP server in use.
REPLACE
Replaces the values of existing LDAP attributes that are specified in the group element. The LDAP entry where the replacement is done is identified by the dn group element attribute.
If an LDAP attribute that is specified in the group element does not exist in the LDAP entry, the attribute and its corresponding value are added to the entry.
The default for this optional attribute is REPLACE.
Example
The following example declares that the page uses tags from the Info*Engine directory and core tag libraries and that the tags have the iedir and ie prefixes. The task tag block creates the group of elements used as input and the updateObjects tag block updates LDAP entries in the “myCompany.com” directory service at the “dc=myHost,dc=myCompany,dc=com” base entry:
<%@ taglib uri="http://www.ptc.com/infoengine/taglib/core"
prefix="ie" %>

<%@ taglib uri="http://www.ptc.com/infoengine/taglib/directory"
prefix="iedir" %>

<ie:task uri="ldaptask.xml">
<ie:param name="GROUP_OUT" data="ldap_update"/>
</ie:task>
<iedir:updateObjects
uri="ldap://myCompany.com/dc=myHost,dc=myCompany,dc=com">
<iedir:param name="GROUP_IN" data="ldap_update"/>
</iedir:updateObjects>