use of org.gluu.service.custom.script.StandaloneCustomScriptManager in project oxCore by GluuFederation.
the class StandaloneCustomScriptManagerTest method main.
public static void main(String[] args) {
if (System.getenv("PYTHON_HOME") == null) {
System.err.println("PYTHON_HOME environment variable is not defined");
System.exit(-1);
}
PersistenceEntryManager persistenceEntryManager = createLdapEntryManager();
StandaloneCustomScriptManager customScriptManager = new StandaloneCustomScriptManager(persistenceEntryManager, "ou=scripts,o=gluu", "/opt/gluu/python/libs");
// Register required external scripts
SampleIdpExternalScriptService sampleIdpExternalScriptService = new SampleIdpExternalScriptService();
customScriptManager.registerExternalScriptService(sampleIdpExternalScriptService);
// Init script manager and load scripts
customScriptManager.init();
// Call script
Object context = new SampleContext(System.currentTimeMillis());
sampleIdpExternalScriptService.executeExternalUpdateAttributesMethods(context);
// Reload script if needed
customScriptManager.reload();
// Call script
Object context2 = new SampleContext(System.currentTimeMillis());
sampleIdpExternalScriptService.executeExternalUpdateAttributesMethods(context2);
// Destroy custom script manager and scripts
customScriptManager.destory();
}
Aggregations