Hi Alex!
Thanks for your feedback!
Alex Karasulu wrote:
Yeah Groovy is cool stuff and would be great for LDAP scripts if there
was a good JNDI
binding for Groovy. I spoke to James Strachan a while back about adding
support to
Groovy for LDAP. If I can remember correctly (many beers went down that
evening :)) he
recommended adding a binding to Groovy for JNDI. This binding can
prevent some of
the issues you're encountering with some syntactic sugar so you can
avoid constructs
like " tori.attrs.cn <http://tori.attrs.cn>".
What exactly is a "binding to Groovy for JNDI"? Something
Groovy-specific? I am a Groovy newbie, you know ... Anyway, I was able
to modify my rookie attempt and I am now able to write "tori.cn", both
in search results and when adding a new entry. Adding looks like this in
my "solution", btw.:
---
heather = [:]
heather.objectclass = ['top', 'person']
heather.sn = 'Nova'
heather.cn = 'Heather Nova'
con.add('cn=Heather Nova,dc=example,dc=com', heather)
---
I like it syntactically :-)
Perhaps we can look into this. I sure would like to see Groovy scripts
used for SPs and
for testing since it can lead to cleaner and more succinct code.
However I think we need
to add this binding. If you like I can ask James to comment on how best
we can do this.
Also I'm +1 on bringing about a subproject for this via a sandboxed
effort.
I have documented my attempt here
http://cwiki.apache.org/confluence/display/DIRxSBOX/Groovy+LDAP
Consider this as a proof of concept. Only a few operations are
implemented yet. Nevertheless, the source code (both Java classes and
Groovy example scripts) can be found here
http://svn.apache.org/repos/asf/directory/sandbox/szoerner/groovyldap
It would really be great if James can comment whether this is a way we
can go, or if it it totally nonsense and there are better approaches
available.
Basically, the syntax in the scripts is most important for me. It should
be easy to write simple LDAP scripts which perform things which are not
possible from the command line with one command (ldapmodify etc.).
Simple reports for instance. LDAP abstraction (like JNDI) is a no-no.
One target group are administrators,who are not familiar with JNDI (but
LDAP).
Thanks in advance and greetings from Hamburg,
Stefan