[prev in list] [next in list] [prev in thread] [next in thread] 

List:       forgerock-openidm
Subject:    [OpenIDM] How to access the openidm object from Groovy???
From:       andi.egloff () forgerock ! com (Andreas Egloff)
Date:       2013-03-07 5:20:51
Message-ID: CALto_txo2LMLck=mfhhHG5RSD9m=T6DzGJ1jTn8a4+Z=dzvZgQ () mail ! gmail ! com
[Download RAW message or body]

We do have extension plans in this area, but if you need to as a short term
work-around you should be able to get a hold of the resource API in one of
two ways.

We have not a chance to try this out though, so this would need verifying.
a) Looking up the router in the service registry. Getting a hold of the
context to look up the service may be done in a manner such as
FrameworkUtil.getBundle(JsonResourceRouterService.class).getBundleContext()
b) Create a custom bundle or fragment that exposes the router in a static

On Wed, Mar 6, 2013 at 1:51 PM, Steven McArdle <smcardle at eossonline.com>wrote:

> Thanks Andi
> 
> An alternative for me would be to get access to the groovy sql(connector)
> function from JavaScript.
> 
> OR
> 
> Pass in the variable to Groovy using the openidm.action() method somehow
> and have it available in the SearchScript.groovy. Something like the
> following
> 
> var myVar = openidm.read('repo/custom/myVar');
> openidm.action('sync',
> {"_action":"recon","mapping":"systemFusion_managedUsers"}, myVar);
> 
> Where myVar is retrieved in the JavaScript and then passed to the
> openidm.action(...) that will eventually call the scripted SQL
> SearchScript.groovy and be available there
> 
> I don't know if something like this is possible....
> 
> 
> Regards
> 
> 
> 
> On Wed, 6 Mar 2013 11:44:09 -0600, Andreas Egloff
> <andi.egloff at forgerock.com> wrote:
> > I did not realize you were talking about access from within the
> connector
> > (scripts), I assumed Groovy in workflows for example. Unfortunately I
> > believe the OpenIDM resource API ("openidm") is not currently populated
> in
> > the scriptable connectors, so I apologize that I may have mislead you
> > there. It sounds like a desirable enhancement though, and I'll double
> check
> > if there is a short term solution to your inquiry there.
> > Andi
> > 
> > On Tue, Mar 5, 2013 at 5:40 PM, Steven McArdle
> > <smcardle at eossonline.com>wrote:
> > 
> > > Hi Guys
> > > 
> > > Can anybody tell me how to get hold of the openidm object from within a
> > > Groovy Script that is run during reconciliation !!!
> > > 
> > > I want to use the openidm.create(...) openidm.update(...) and
> > > openidm.read(...) functions defined on the openidm object that is
> > > available
> > > from within javascript.
> > > 
> > > Basically I am storing a value in the openidm/repo/custom/<MyVariable>
> > > area that I want to retrieve and change at reconciliation time from my
> > > SearchScript.groovy
> > > 
> > > I can GET and PUT this object using the REST API no problem
> > > 
> > > However, I get an NPE with the root cause as follows if I try to use
> the
> > > openidm object from within a Groovy script
> > > 
> > > at
> > > 
> > > 
> 
> org.identityconnectors.framework.impl.api.BufferedResultsProxy$BufferedResultsHandler.run(BufferedResultsProxy.java:162)
> 
> > > Caused by: groovy.lang.MissingPropertyException: No such property:
> > > openidm
> > > for class: Script1
> > > at
> > > 
> > > 
> 
> org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:50)
> 
> > > at
> > > 
> > > 
> 
> org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:49)
> 
> > > at
> > > 
> > > 
> 
> org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:231)
> 
> > > at Script1.run(Script1.groovy:116)
> > > at
> > > 
> > > 
> 
> org.identityconnectors.common.script.groovy.GroovyScriptExecutorFactory$GroovyScriptExecutor.execute(GroovyScriptExecutorFactory.java:71)
> 
> > > at
> > > 
> > > 
> 
> org.forgerock.openicf.scriptedsql.ScriptedSQLConnector.executeQuery(ScriptedSQLConnector.java:328)
> 
> > > ... 20 more
> > > 
> > > 
> > > Regards
> > > 
> > > --
> > > Steven McArdle MIITP
> > > Founder of EOSSOnline Limited (Business made easy)
> > > 
> > > EOSSOnline Limited is a proud sponsor of :
> > > The New Zealand Cloud Code of Practice
> > > The ICT-Connect in schools program
> > > 
> > > www.eossonline.com
> > > _______________________________________________
> > > OpenIDM mailing list
> > > OpenIDM at forgerock.org
> > > https://lists.forgerock.org/mailman/listinfo/openidm
> > > 
> 
> --
> Steven McArdle MIITP
> Founder of EOSSOnline Limited (Business made easy)
> 
> EOSSOnline Limited is a proud sponsor of :
> The New Zealand Cloud Code of Practice
> The ICT-Connect in schools program
> 
> www.eossonline.com
> _______________________________________________
> OpenIDM mailing list
> OpenIDM at forgerock.org
> https://lists.forgerock.org/mailman/listinfo/openidm
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.forgerock.org/pipermail/openidm/attachments/20130306/63a17a28/attachment.html \



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic