

































|
LdapProcessor is a processor for Cocoon that performs LDAP queries, translates the resultset into an XML fragment, and inserts the fragment in the original document.The Ldap Processor was written for a project where I work, and carried back over into the Cocoon project.
|
Add LDAP queries to your XML files. The tagset looks like this:
 |  |  |  | <ldap-query server="foo_server">
sn=*Green*
</ldap-query> |  |  |  |  |
This will be replaced by a tagset that looks something like this:
 |  |  |  | <ldapsearch>
<searchresult ID="CN=DGREEN,OU=TBE,OU=AST,OU=ACAD,O=WSU">
<telephonenumber>801-626-6821</telephonenumber>
<facsimiletelephonenumber>801-626-6650</facsimiletelephonenumber>
<title>PROFESSOR/TELECOMMUNICATIONS AND BUSINESS EDUCATION</title>
<givenname>Diana</givenname>
<sn>Green</sn>
<l>B2 218</l>
<ou>TELECOM & BUSINESS ED </ou>
<mail>DGREEN@weber.edu</mail>
<initials>J</initials>
<cn>DGREEN</cn>
<objectclass>newPilotPerson</objectclass>
<objectclass>organizationalPerson</objectclass>
<objectclass>person</objectclass>
<objectclass>top</objectclass>
</searchresult>
</ldapsearch> |  |  |  |  |
You can also have the LdapProcessor substitute values from the servlet request into your query. The syntax for that is:
 |  |  |  | <ldap-query name="foo_server">
sn=*{@name}*
</ldap-query> |  |  |  |  |
This is, of course, highly configurable by setting attributes of the query tag. A partial list of attributes is:
doc-element - The tag with which to wrap the whole shebang. Default is ldapresults. If an empty string is specified, e.g. doc-element="", the whole shebang will not be wrapped.
row-element - The tag with which to wrap each row. Default is searchresult. Same deal as with doc-element.
id-attribute - What is the name of the attribute that uniquely identifies the rows? Default is ID. This is, of course, meaningless if row-element is set to an empty string.
variable-left-delimiter - What string delimits variables in the query on the left side? Default is {@.
variable-right-delimiter - What string delimits variables in the query on the right side? Default is }.
|
The LdapProcessor was written borrowing a lot of ideas and code form Donald Ball's SQLProcessor. Any similarity to his code is purely intended...:) Thanks to Donald for writing good, clean code, and being a good sport about me plagerizing in the name of ultimate 'code re-use'.
|
- support for different context paramaters such as authtype, protocol, and principal.
- the ability to retrieve binary objects such as certificates and images.
- the ability to add different Contols such as a SortContorl for server side sorting.
|
|
|