Le 20/06/2017 à 12:12, Alexander Herr a écrit :

So after a lot of debugging I managed to make it “compile and run”.

Let me vent here a little bit and rant about Java: Errors in Java are an abomination and whoever thought that any of these extremely verbose but content-deflated debugging outputs are of any use to anyone trying to find the problem as fast as possible should get publicly flailed. </rant>

Having said that, I have found out a little about the way javascript works in JSC and I am writing this here, so other people might use it as a reference:

-Of course, functions defined in an external js-file _/can/_ have arguments, so you can pass variables from beans within lsc.xml, i.e.

js:generateEduPersonAffiliation(srcBean.getDatasetValuesById("eduPersonPrimaryAffiliation"))

-The javascript usable is a pretty standard one, so don’t expect fancy and/or new functions. Suffice it to say, the javascript is dependent on your Java installed, so there you are. As an advice, the more basic your javascript code, the better. Trust me, some error outputs can be extremely misleading and won’t help you debug the problem. Better keep that in mind and keep your code simple.

-Most interestingly: Not everything you code in your js-file will be javascript! Some can be Java! For instance, in the above example srcBean.getDatasetValuesById("eduPersonPrimaryAffiliation") will return a Java-Array (thus you have to use Java-Methods), even though you use it in javascript. Keep that in mind!

Hope that helps another person at some point.

Indeed, LSC uses the javascript interpreter provided by your JVM. You can force the use of Rhino by using rjs:, or even choose Groovy with gr:.

See https://lsc-project.org/documentation/latest/scripting/start


--
Clément OUDOT
Consultant en logiciels libres, Expert infrastructure et sécurité
Savoir-faire Linux
137 boulevard de Magenta - 75010 PARIS
Blog: http://sflx.ca/coudot

_______________________________________________________________
Ldap Synchronization Connector (LSC) - http://lsc-project.org

lsc-users mailing list
[email protected]
https://lists.lsc-project.org/cgi-bin/mailman/listinfo/lsc-users

Reply via email to