use of org.apache.sling.scripting.core.impl.helper.SlingScriptEngineManager in project sling by apache.
the class ScriptEngineManagerFactory method refreshScriptEngineManager.
/**
* Refresh the script engine manager.
*/
private void refreshScriptEngineManager() {
// create (empty) script engine manager
final ClassLoader loader = getClass().getClassLoader();
final SlingScriptEngineManager tmp = new SlingScriptEngineManager(loader);
// register script engines from bundles
synchronized (this.engineSpiBundles) {
for (final Bundle bundle : this.engineSpiBundles) {
registerFactories(tmp, bundle);
}
}
// register script engines from registered services
synchronized (this.engineSpiServices) {
for (final Map.Entry<ScriptEngineFactory, Map<Object, Object>> factory : this.engineSpiServices.entrySet()) {
registerFactory(tmp, factory.getKey(), factory.getValue());
}
}
scriptEngineManager.setDelegatee(tmp);
final List<ScriptEngineFactory> factories = tmp.getEngineFactories();
for (final ScriptEngineFactory factory : factories) {
log.info("ScriptEngine {}/{} is now handling {}, {}, {}.", new Object[] { factory.getEngineName(), factory.getEngineVersion(), factory.getExtensions(), factory.getMimeTypes(), factory.getNames() });
}
}
Aggregations