Skip to content

Commit

Permalink
feat(jans-core): corrected StandaloneCustomScriptManager
Browse files Browse the repository at this point in the history
  • Loading branch information
yuriyz committed May 13, 2022
1 parent 5da6e27 commit 0a52ec8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public boolean executeCustomScriptDestroy(CustomScriptConfiguration customScript
return externalType.destroy(configurationAttributes);
} catch (Exception ex) {
log.error(ex.getMessage(), ex);
externalTypeCreator.saveScriptError(customScriptConfiguration.getCustomScript(), ex);
saveScriptError(customScriptConfiguration.getCustomScript(), ex);
}

return false;
Expand Down Expand Up @@ -403,4 +403,12 @@ public boolean isSupportedType(CustomScriptType customScriptType) {
return supportedCustomScriptTypes.contains(customScriptType);
}

public void saveScriptError(CustomScript customScript, Exception exception) {
externalTypeCreator.saveScriptError(customScript, exception);
}

public void clearScriptError(CustomScript customScript) {
externalTypeCreator.clearScriptError(customScript);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class StandaloneCustomScriptManager extends CustomScriptManager {

private static final long serialVersionUID = -7212146007659551839L;

private List<ExternalScriptService> externalScriptServices = new ArrayList<ExternalScriptService>();
private List<ExternalScriptService> externalScriptServices = new ArrayList<>();

public StandaloneCustomScriptManager(PersistenceEntryManager entryManager, String scriptsBaseDn, String pythonModulesDir) {
// Configure python service
Expand All @@ -40,9 +40,13 @@ public StandaloneCustomScriptManager(PersistenceEntryManager entryManager, Strin
StandaloneCustomScriptService standaloneCustomScriptService = new StandaloneCustomScriptService();
standaloneCustomScriptService.configure(entryManager, scriptsBaseDn);

ExternalTypeCreator externalTypeCreator = new ExternalTypeCreator();
externalTypeCreator.pythonService = pythonService;
externalTypeCreator.customScriptService = standaloneCustomScriptService;

this.log = LoggerFactory.getLogger(StandaloneCustomScriptManager.class);
this.supportedCustomScriptTypes = new ArrayList<CustomScriptType>();
this.pythonService = pythonService;
this.supportedCustomScriptTypes = new ArrayList<>();
this.externalTypeCreator = externalTypeCreator;
this.customScriptService = standaloneCustomScriptService;
}

Expand Down

0 comments on commit 0a52ec8

Please sign in to comment.