Skip to content

Commit

Permalink
Documentation on which exceptions are thrown
Browse files Browse the repository at this point in the history
  • Loading branch information
alienscience committed Feb 9, 2011
1 parent 3ac3043 commit 13340cd
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions README.md
Expand Up @@ -46,7 +46,9 @@ Options is a map with the following entries:
:timeout The timeout when waiting for a response from the server
(milliseconds), defaults to 5 minutes

For example:
Throws a [LDAPException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPException.html) if an error occurs establishing the connection pool or authenticating to any of the servers.

An example:
(ldap/connect conn {:host "ldap.example.com" :num-connections 10})

(ldap/connect conn {:host [{:address "ldap1.example.com" :port 8000}
Expand All @@ -61,21 +63,26 @@ For example:
## get [connection dn]

If successful, returns a map containing the entry for the given DN.
Returns nil if the entry doesn't exist or cannot be read.
Returns nil if the entry doesn't exist.

(ldap/get conn "cn=dude,ou=people,dc=example,dc=com")

Throws a [LDAPException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPException.html) on error.

## add [connection dn entry]

Adds an entry to the connected ldap server. The entry is map of keywords to values which can be strings, sets or vectors.


(ldap/add conn "cn=dude,ou=people,dc=example,dc=com"
{:objectClass #{"top" "person"}
:cn "dude"
:sn "a"
:description "His dudeness"
:telephoneNumber ["1919191910" "4323324566"]})
Throws a [LDAPException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPException.html) if there is an error with the request or the add failed.

## modify [connection dn modifications]

Modifies an entry in the connected ldap server. The modifications are
Expand All @@ -96,6 +103,9 @@ All the keys in the map are optional e.g:
(ldap/modify conn "cn=dude,ou=people,dc=example,dc=com"
{:add {:telephoneNumber "232546265"}})


Throws a [LDAPException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPException.html) on error.

## search [connection base] [connection base options]

Runs a search on the connected ldap server, reads all the results into
Expand All @@ -114,6 +124,8 @@ e.g

(ldap/search conn "ou=people,dc=example,dc=com" {:attributes [:cn]})

Throws a [LDAPSearchException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPSearchException.html) on error.

## search! [connection base f] [connection base options f]

Runs a search on the connected ldap server and executes the given
Expand All @@ -137,10 +149,13 @@ e.g
{:filter "sn=dud*"}
(fn [x]
(println "Hello " (:cn x))))


Throws a [LDAPSearchException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPSearchException.html) if an error occurs during search. Throws an [EntrySourceException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/EntrySourceException.html) if there is an eror obtaining search results.

## delete [connection dn]

Deletes the entry with the given DN on the connected ldap server.

(ldap/delete conn "cn=dude,ou=people,dc=example,dc=com")

Throws a [LDAPException](http://www.unboundid.com/products/ldap-sdk/docs/javadoc/com/unboundid/ldap/sdk/LDAPException.html) if the object does not exist or an error occurs.

0 comments on commit 13340cd

Please sign in to comment.