9.13. Import From an LDAP Server
9.13. Import From an LDAP Server In Teiid Designer, this is how you go about modeling an LDAP Server: LDAP subtrees are represented as if they were tables in a relational database. Each node in the sub-tree is represented as a row in the table. Each attribute of the given node can be represented as a column in the table. The RDN (or DN) can be used to represent a primary key. The LDAP metadata is modeled using the relational metamodel. Each table in the relational model represents a directory entry while each row in the table represents a child entry of the directory entry. Each column of the table represents an attribute of the child entry that may exist. In general, each table and column defines the LDAP-specific information in the property "Name In Source". This allows the connector to identify the attribute or Base DN name within the data source, ie. within LDAP. The actual name of the table and column can differ from the name in source, allowing for more descriptive labelling in models and queries. Create the relational model from LDAP data in this way: In Model Explorer, right-click and then click Import... or click the File > Import... action in the toolbar or select a project, folder or model in the tree and click Import... Select the import option Teiid Designer > LDAP Service >> Source Model and click . Select an existing or LDAP connection profile from the drop-down selector or press New... button to launch the New Connection Profile dialog or Edit... to modify/change an existing connection profile prior to selection. Note Information required for a new connection: Hostname - eg. falcon (if your URL looks like ldap://falcon:389) Port - eg. 389 Bind DN or user - an administrator account to browse the ldap tree, eg. cn=Manager,dc=birds-of-prey,dc=org Bind password - account password Selection of the connection profile populates the LDAP Service URL. For LDAP Base DN you have to click on Fetch Base DNs button. The remaining requirements for the wizard page is the choosing of a suitable model file as the destination of the imported tables. If the selection is an existing model then the wizard will merge the new tables with the model's current content. After selecting a Connection Profile, enter JNDI name and click > . On the Select LDAP Entries to be modelled as tables page, select the LDAP entries from the tree to be created as tables in the source model. Select an entry by ticking its respective checkboxes in the tree. When you highlight an entry, you will see the following attributes: Table Name - this is the table's label and can be modified to a more readable value. Table Source Name - the fully qualified entry name. This is not editable in the wizard and should remain unchanged in the subsequently created source model. Table Source Name Suffix - an additional suffix can be added that further limits the scope of the table's search criteria. The suffix is in the format of ?search_scope?objectClass_name where search_scope is one of OBJECT_SCOPE (first and only one entry returned), ONELEVEL_SCOPE (only entries directly below the selected entry are returned) or SUBTREE_SCOPE (recursively return all entries below the selected entry) and objectClass_name is the name of a specific type of objectClass in the LDAP tree, eg. return only the 'inetOrgPerson' entries. Both criteria are optional (but the '?'s are not) so it is possible to have a suffix such as ? ? inetOrgPerson. Click . The "Select the LDAP Attributes to be modelled as columns" page displays the previously selected LDAP entries and the attributes of their child entries. The purpose of a selected attribute is to be created as a column in the relevant source model table. Select attributes by ticking their respective checkboxes in the tree. When you highlight an attribute, you will see the following properties: Column Name - this is the column's label and can be modified to a more readable value. Column Source Name - the real LDAP attribute name. This is not editable in the wizard and should remain unchanged in the subsequently created source model. Column Distinct Value Count - The number of distinct values assigned to the specific attribute in the LDAP service. This value is useful in optimising queries using the source model. This is not editable in the wizard and should remain unchanged in the subsequently created source model. Column Null Value Count - The number of entries where the specific attribute has no value assigned in the LDAP service. This value is useful in optimising queries using the source model. This is not editable in the wizard and should remain unchanged in the subsequently created source model. Column Length - The maximum length of existing values assigned to the attribute in the LDAP service. This value is assigned as the maximum length of the column. This is not editable in the wizard but can be edited in the source model later should this be required. Click Finish. Once you have completed the wizard, the new source model will be created.