Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| 711:scripting_advanced [2024/11/22 10:03] – created Weinlein, Thomas | 711:scripting_advanced [2025/09/17 14:07] (current) – Weinlein, Thomas | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Necessary steps to enable usage of libraries | + | [[: |
| + | |||
| + | ====== Advanced Scripting ====== | ||
| + | |||
| + | Some advanced reports and admin jobs might need to use additional Java library API to provide the requested functionality. As this might pose security risks, explicit whitelisting | ||
| + | |||
| + | Admin Jobs: '' | ||
| + | |||
| + | Reports: '' | ||
| + | |||
| + | Feedback Adapter: '' | ||
| + | |||
| + | e.g. | ||
| + | |||
| + | <code xml config.xml> | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | Stages will prevent access to all other Java API and will log an error message indicating the unavailable class that needs whitelisting. | ||
| + | |||
| + | File system access also needs explicit permission via configuration. | ||
| + | |||
| + | Files to be accessible to Admin Jobs need to be stored in directories within '' | ||
| + | |||
| + | Files to be accessible to Reports need to be stored in directories within '' | ||
| + | |||
| + | e.g. | ||
| + | |||
| + | <code xml config.xml> | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | File read and/or write permissions are configured by the following configuration property. Please note that the file paths need to be specified **relative** to the **base directory** as shown above. | ||
| + | |||
| + | Admin Jobs: | ||
| + | |||
| + | '' | ||
| + | |||
| + | '' | ||
| + | |||
| + | Reports: | ||
| + | |||
| + | '' | ||
| + | |||
| + | '' | ||
| + | |||
| + | For file access | ||
| + | |||
| + | <code javascript> | ||
| + | files.newInputStream(relativeFileName); | ||
| + | files.newOutputStream(relativeFileName); | ||
| + | </ | ||
| + | |||
| + | Please ensure the returned streams are **closed after usage**. | ||
| + | |||
| + | e.g. | ||
| + | |||
| + | <code javascript> | ||
| + | var reader = new java.io.BufferedReader(new java.io.InputStreamReader(Files.newInputStream(" | ||
| + | try { | ||
| + | while ((rline = reader.readLine()) != null) { | ||
| + | log.info(rline); | ||
| + | } | ||
| + | } finally { | ||
| + | reader.close(); | ||
| + | } | ||
| + | </ | ||