alexevansigg
Visitor.
297 views

Load Shared Scriptlet Into scriptletContext

Jump to solution

I have a use case for introducing a common shared scriptlet which could be used as a helper library for other developers which contain common functions we use for scriptlets. 
I'm looking for something like this:
scriptletContext.loadScriptlet(/library/path/to/scriptlet);
Does something like that exist?
Is there any way to load multiple scriptlets into one? I'm pretty sure I could achieve this also by loading a systemProperty holding the script then using eval but that feels abit messy. 

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Load Shared Scriptlet Into scriptletContext

Jump to solution

Hi,

Scriptlets are not loaded into the context by default as other configuration items. As such there is no method to load them into context, therefore the only method would be to load the scriptlet content into system properties and use eval. 

Keep in mind that if you go for this aproach  the scriptlets will increase the size of the context of all executions (since they are available for all executions by default) and you may run into memory issues during execution, depending on the size of the scriptlets.

You can have only one  script loaded as shared script. 

Instead of loading all scripts into one and then adding more logic  to figgure out which one is needed, why not create a content pack which just contains  these scriptlets and they can mix and match the scriptlets from that content pack as needed?

Regards,

Vlad

2 Replies
Micro Focus Expert
Micro Focus Expert

Re: Load Shared Scriptlet Into scriptletContext

Jump to solution

Hi,

Scriptlets are not loaded into the context by default as other configuration items. As such there is no method to load them into context, therefore the only method would be to load the scriptlet content into system properties and use eval. 

Keep in mind that if you go for this aproach  the scriptlets will increase the size of the context of all executions (since they are available for all executions by default) and you may run into memory issues during execution, depending on the size of the scriptlets.

You can have only one  script loaded as shared script. 

Instead of loading all scripts into one and then adding more logic  to figgure out which one is needed, why not create a content pack which just contains  these scriptlets and they can mix and match the scriptlets from that content pack as needed?

Regards,

Vlad

alexevansigg
Visitor.

Re: Load Shared Scriptlet Into scriptletContext

Jump to solution

Thanks for quick response Vlad, not convinced a library of different scriptlets would work in out scenario because there could be plenty of usecases to apply multiple scriptlets to single operation.  Anyway will explore the eval approach alittle more. Alex

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.