javax.script.ScriptEngineFactory源码实例Demo

java.util.ServiceLoader.Provider#javax.script.ScriptEngineFactory源码实例Demo

下面列出了java.util.ServiceLoader.Provider#javax.script.ScriptEngineFactory 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

protected void setScriptingLanguage( final String lang, final JComboBox languageField ) {
  if ( lang == null ) {
    languageField.setSelectedItem( null );
    return;
  }

  final ListModel model = languageField.getModel();
  for ( int i = 0; i < model.getSize(); i++ ) {
    final ScriptEngineFactory elementAt = (ScriptEngineFactory) model.getElementAt( i );
    if ( elementAt == null ) {
      continue;
    }
    if ( elementAt.getNames().contains( lang ) ) {
      languageField.setSelectedItem( elementAt );
      return;
    }
  }
}
 
源代码2 项目: hottub   文件: TrustedScriptEngineTest.java
@Test
public void factoryOptionsTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            // specify --no-syntax-extensions flag
            final String[] options = new String[] { "--no-syntax-extensions" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                // try nashorn specific extension
                e.eval("var f = funtion(x) 2*x;");
                fail("should have thrown exception!");
            } catch (final Exception ex) {
                //empty
            }
            return;
        }
    }

    fail("Cannot find nashorn factory!");
}
 
源代码3 项目: openjdk-jdk9   文件: TrustedScriptEngineTest.java
@Test
public void factoryOptionsTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            // specify --no-syntax-extensions flag
            final String[] options = new String[] { "--no-syntax-extensions" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                // try nashorn specific extension
                e.eval("var f = funtion(x) 2*x;");
                fail("should have thrown exception!");
            } catch (final Exception ex) {
                //empty
            }
            return;
        }
    }

    fail("Cannot find nashorn factory!");
}
 
private void updateComponents() {
  final ScriptEngineFactory globalLanguage = (ScriptEngineFactory) globalLanguageField.getSelectedItem();
  globalScriptTextArea.setSyntaxEditingStyle
    ( DataFactoryEditorSupport.mapLanguageToSyntaxHighlighting( globalLanguage ) );
  queryLanguageListCellRenderer.setDefaultValue( globalLanguage );

  final ScriptEngineFactory queryScriptLanguage = (ScriptEngineFactory) queryLanguageField.getSelectedItem();
  if ( queryScriptLanguage == null ) {
    queryScriptTextArea.setSyntaxEditingStyle( globalScriptTextArea.getSyntaxEditingStyle() );
  } else {
    queryScriptTextArea
      .setSyntaxEditingStyle( DataFactoryEditorSupport.mapLanguageToSyntaxHighlighting( queryScriptLanguage ) );
  }

  final boolean querySelected = dialogModel.isQuerySelected();
  queryScriptTextArea.setEnabled( querySelected );
  queryLanguageField.setEnabled( querySelected );
  queryTemplateAction.update();
  if ( querySelected == false ) {
    queryTemplateAction.setEnabled( false );
  }

  globalTemplateAction.update();

}
 
源代码5 项目: openjdk-8   文件: TrustedScriptEngineTest.java
@Test
public void factoryOptionsTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            // specify --no-syntax-extensions flag
            final String[] options = new String[] { "--no-syntax-extensions" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                // try nashorn specific extension
                e.eval("var f = funtion(x) 2*x;");
                fail("should have thrown exception!");
            } catch (final ScriptException se) {
            }
            return;
        }
    }

    fail("Cannot find nashorn factory!");
}
 
源代码6 项目: jdk8u_nashorn   文件: TrustedScriptEngineTest.java
@Test
/**
 * Test repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error".
 */
public void noLoaderPerCompilerTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
源代码7 项目: jdk8u60   文件: TrustedScriptEngineTest.java
@Test
/**
 * Test repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error".
 */
public void noLoaderPerCompilerTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
源代码8 项目: binnavi   文件: LanguageBox.java
private void fillLanguageBox(final ScriptEngineManager manager) {
  final List<ScriptEngineFactory> factories = manager.getEngineFactories();

  final List<ScriptingLanguage> languages = new ArrayList<ScriptingLanguage>();

  for (final ScriptEngineFactory factory : factories) {
    // Disable Rhino scripting engine for JavaScript / ECMAScript.
    if (factory.getLanguageName().equals("python")) {
      languages
          .add(new ScriptingLanguage(factory.getLanguageName(), factory.getLanguageVersion()));
    }
  }

  Collections.sort(languages);

  for (final ScriptingLanguage language : languages) {
    addItem(language);
  }
}
 
源代码9 项目: GreasySpoon   文件: ScriptsInfoPage.java
/**
   * @return HTML string with ScriptEngines description
   */
  public static String getEnginesParameters(){
      StringBuilder stb = new StringBuilder();
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
for (ScriptEngineFactory factories : scriptEngineManager.getEngineFactories()){
       stb.append("\t").append(factories.getEngineName())
       	.append(" - language:\t").append(factories.getLanguageName())
       	.append(" - version:\t").append(factories.getLanguageVersion())
       	.append("<br>\r\n");			
}
//Add GS Java scripts
if (javax.tools.ToolProvider.getSystemJavaCompiler()!=null){
	stb.append("\t").append("Native Gs Scripts")
   	.append(" - language:\t").append("Java")
   	.append(" - version:\t").append(System.getProperty("java.vm.version"))
   	.append("<br />\r\n");
}
      return stb.toString();
  }
 
/**
 * For error messages - returns null if there are any exceptions of any 
 * kind building the string (or of the list is empty for some unknown reason).
 * @param ext - if true, list of extensions, otherwise a list of engine names
 */
private static String getSupportedEngines(ScriptEngineManager mgr,
                                          boolean ext) {
  String result = null;
  try {
    List<ScriptEngineFactory> factories = mgr.getEngineFactories();
    if (null == factories) return result;

    Set<String> engines = new LinkedHashSet<>(factories.size());
    for (ScriptEngineFactory f : factories) {
      if (ext) {
        engines.addAll(f.getExtensions());
      } else {
        engines.addAll(f.getNames());
      }
    }
    result = String.join(", ", engines);
  } catch (RuntimeException e) {
    /* :NOOP: */
  }
  return result;
}
 
源代码11 项目: openjdk-jdk9   文件: ModulesTest.java
/**
 * Basic test of stream() to ensure that elements for providers in named
 * modules come before elements for providers in unnamed modules.
 */
@Test
public void testStreamOrder() {
    List<Class<?>> types = ServiceLoader.load(ScriptEngineFactory.class)
            .stream()
            .map(Provider::type)
            .collect(Collectors.toList());

    boolean foundUnnamed = false;
    for (Class<?> factoryClass : types) {
        if (factoryClass.getModule().isNamed()) {
            if (foundUnnamed) {
                assertTrue(false, "Named module element after unnamed");
            }
        } else {
            foundUnnamed = true;
        }
    }
}
 
源代码12 项目: openjdk-jdk9   文件: ModulesTest.java
/**
 * Basic test of ServiceLoader.load using a custom Layer as the context.
 */
@Test
public void testWithCustomLayer2() {
    ModuleLayer layer = createCustomLayer("bananascript");

    List<ScriptEngineFactory> factories
        = collectAll(ServiceLoader.load(layer, ScriptEngineFactory.class));

    // should have at least 2 x bananascript
    assertTrue(factories.size() >= 2);

    // first element should be the provider in the custom layer
    ScriptEngineFactory factory = factories.get(0);
    assertTrue(factory.getClass().getModule().getLayer() == layer);
    assertTrue(factory.getEngineName().equals("BananaScriptEngine"));

    // remainder should be the boot layer
    factories.remove(0);
    Set<String> names = factories.stream()
            .map(ScriptEngineFactory::getEngineName)
            .collect(Collectors.toSet());
    assertTrue(names.contains("BananaScriptEngine"));
    assertFalse(names.contains("PearScriptEngine"));
}
 
源代码13 项目: pentaho-reporting   文件: JdbcDataSourceDialog.java
private void updateComponents() {
  final ScriptEngineFactory globalLanguage = (ScriptEngineFactory) globalLanguageField.getSelectedItem();
  globalScriptTextArea.setSyntaxEditingStyle( DataFactoryEditorSupport.mapLanguageToSyntaxHighlighting( globalLanguage ) );
  queryLanguageListCellRenderer.setDefaultValue( globalLanguage );

  final ScriptEngineFactory queryScriptLanguage = (ScriptEngineFactory) queryLanguageField.getSelectedItem();
  if ( queryScriptLanguage == null ) {
    queryScriptTextArea.setSyntaxEditingStyle( globalScriptTextArea.getSyntaxEditingStyle() );
  } else {
    queryScriptTextArea.setSyntaxEditingStyle( DataFactoryEditorSupport.mapLanguageToSyntaxHighlighting( queryScriptLanguage ) );
  }

  final boolean querySelected = dialogModel.isQuerySelected();
  queryScriptTextArea.setEnabled( querySelected );
  queryLanguageField.setEnabled( querySelected );
  queryTemplateAction.update();
  if ( querySelected == false ) {
    queryTemplateAction.setEnabled( false );
  }

  globalTemplateAction.update();

}
 
源代码14 项目: pentaho-reporting   文件: PmdDataSourceEditor.java
private String mapLanguageToSyntaxHighlighting( final ScriptEngineFactory script ) {
  if ( script == null ) {
    return SyntaxConstants.SYNTAX_STYLE_NONE;
  }

  final String language = script.getLanguageName();
  if ( "ECMAScript".equalsIgnoreCase( language )
     || "js".equalsIgnoreCase( language )
     || "rhino".equalsIgnoreCase( language )
     || "javascript".equalsIgnoreCase( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_JAVASCRIPT;
  }
  if ( "groovy".equalsIgnoreCase( language ) ) {
    return SyntaxConstants.SYNTAX_STYLE_GROOVY;
  }
  return SyntaxConstants.SYNTAX_STYLE_NONE;
}
 
源代码15 项目: netbeans   文件: Scripting.java
EngineManager(boolean allowAllAccess, ClassLoader loader) {
    super(loader);
    this.allowAllAccess = allowAllAccess;
    if (allowAllAccess) {
        getBindings().put("allowAllAccess", true); // NOI18N
    }
    this.extra = populateExtras(this);
    for (ScriptEngineFactory f : extra) {
        registerEngineName(f.getEngineName(), f);
        for (String ext : f.getExtensions()) {
            registerEngineExtension(ext, f);
        }
        for (String mime : f.getMimeTypes()) {
            registerEngineMimeType(mime, f);
        }
    }
}
 
源代码16 项目: openjdk-jdk9   文件: TrustedScriptEngineTest.java
@Test
/**
 * Test repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error".
 */
public void noLoaderPerCompilerTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
源代码17 项目: pentaho-reporting   文件: PmdDataSourceEditor.java
protected void setScriptingLanguage( final String lang, final JComboBox languageField ) {
  if ( lang == null ) {
    languageField.setSelectedItem( null );
    return;
  }

  final ListModel model = languageField.getModel();
  for ( int i = 0; i < model.getSize(); i++ ) {
    final ScriptEngineFactory elementAt = (ScriptEngineFactory) model.getElementAt( i );
    if ( elementAt == null ) {
      continue;
    }
    if ( elementAt.getNames().contains( lang ) ) {
      languageField.setSelectedItem( elementAt );
      return;
    }
  }
}
 
源代码18 项目: openjdk-8-source   文件: TrustedScriptEngineTest.java
@Test
public void factoryOptionsTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            // specify --no-syntax-extensions flag
            final String[] options = new String[] { "--no-syntax-extensions" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                // try nashorn specific extension
                e.eval("var f = funtion(x) 2*x;");
                fail("should have thrown exception!");
            } catch (final ScriptException se) {
            }
            return;
        }
    }

    fail("Cannot find nashorn factory!");
}
 
源代码19 项目: openjdk-8   文件: TrustedScriptEngineTest.java
@Test
/**
 * Test that we can use same script name in repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error" as name was derived from script name.
 */
public void noLoaderPerCompilerWithSameNameTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            e.put(ScriptEngine.FILENAME, "test.js");
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
源代码20 项目: jdk8u_nashorn   文件: TrustedScriptEngineTest.java
@Test
public void factoryClassLoaderTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final MyClassLoader loader = new MyClassLoader();
            // set the classloader as app class loader
            final ScriptEngine e = nfac.getScriptEngine(loader);
            try {
                e.eval("Packages.foo");
                // check that the class loader was attempted
                assertTrue(loader.reached(), "did not reach class loader!");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }

    fail("Cannot find nashorn factory!");
}
 
源代码21 项目: unitime   文件: ScriptOptionsBackend.java
@Override
@PreAuthorize("checkPermission('Scripts')")
public ScriptOptionsInterface execute(GetScriptOptionsRpcRequest request, SessionContext context) {
	ScriptOptionsInterface options = new ScriptOptionsInterface();
	
	for (ScriptEngineFactory factory: new ScriptEngineManager().getEngineFactories())
		options.addEngine(factory.getLanguageName());
	
	for (Right right: Right.values()) {
		if (!right.hasType() || right.type().equals(Session.class) || right.type().equals(Department.class) || right.type().equals(SubjectArea.class))
			options.addPermission(right.toString());
	}
	
	options.setCanAdd(context.hasPermission(Right.ScriptEdit));
	options.setEmail(context.getUser().getEmail());
	
	return options;
}
 
源代码22 项目: openjdk-8-source   文件: TrustedScriptEngineTest.java
@Test
/**
 * Test that we can use same script name in repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error" as name was derived from script name.
 */
public void noLoaderPerCompilerWithSameNameTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            e.put(ScriptEngine.FILENAME, "test.js");
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
@Test
public void factoryOptionsTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            // specify --no-syntax-extensions flag
            final String[] options = new String[] { "--no-syntax-extensions" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                // try nashorn specific extension
                e.eval("var f = funtion(x) 2*x;");
                fail("should have thrown exception!");
            } catch (final Exception ex) {
                //empty
            }
            return;
        }
    }

    fail("Cannot find nashorn factory!");
}
 
@Test
/**
 * Test repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error".
 */
public void noLoaderPerCompilerTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
@Test
/**
 * Test that we can use same script name in repeated evals with --loader-per-compile=false
 * We used to get "class redefinition error" as name was derived from script name.
 */
public void noLoaderPerCompilerWithSameNameTest() {
    final ScriptEngineManager sm = new ScriptEngineManager();
    for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
        if (fac instanceof NashornScriptEngineFactory) {
            final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
            final String[] options = new String[] { "--loader-per-compile=false" };
            final ScriptEngine e = nfac.getScriptEngine(options);
            e.put(ScriptEngine.FILENAME, "test.js");
            try {
                e.eval("2 + 3");
                e.eval("4 + 4");
            } catch (final ScriptException se) {
                se.printStackTrace();
                fail(se.getMessage());
            }
            return;
        }
    }
    fail("Cannot find nashorn factory!");
}
 
源代码26 项目: openjdk-jdk9   文件: ModulesTest.java
/**
 * Basic test of Provider::get
 */
@Test
public void testProviderGet() {
    Set<String> names = ServiceLoader.load(ScriptEngineFactory.class)
            .stream()
            .map(Provider::get)
            .map(ScriptEngineFactory::getEngineName)
            .collect(Collectors.toSet());
    assertTrue(names.contains("BananaScriptEngine"));
    assertTrue(names.contains("PearScriptEngine"));
}
 
/**
 * Retrieve a {@link ScriptEngine} from the given {@link ScriptEngineManager}
 * by name, delegating to {@link ScriptEngineManager#getEngineByName} but
 * throwing a descriptive exception if not found or if initialization failed.
 * @param scriptEngineManager the ScriptEngineManager to use
 * @param engineName the name of the engine
 * @return a corresponding ScriptEngine (never {@code null})
 * @throws IllegalArgumentException if no matching engine has been found
 * @throws IllegalStateException if the desired engine failed to initialize
 */
public static ScriptEngine retrieveEngineByName(ScriptEngineManager scriptEngineManager, String engineName) {
	ScriptEngine engine = scriptEngineManager.getEngineByName(engineName);
	if (engine == null) {
		Set<String> engineNames = new LinkedHashSet<>();
		for (ScriptEngineFactory engineFactory : scriptEngineManager.getEngineFactories()) {
			List<String> factoryNames = engineFactory.getNames();
			if (factoryNames.contains(engineName)) {
				// Special case: getEngineByName returned null but engine is present...
				// Let's assume it failed to initialize (which ScriptEngineManager silently swallows).
				// If it happens to initialize fine now, alright, but we really expect an exception.
				try {
					engine = engineFactory.getScriptEngine();
					engine.setBindings(scriptEngineManager.getBindings(), ScriptContext.GLOBAL_SCOPE);
				}
				catch (Throwable ex) {
					throw new IllegalStateException("Script engine with name '" + engineName +
							"' failed to initialize", ex);
				}
			}
			engineNames.addAll(factoryNames);
		}
		throw new IllegalArgumentException("Script engine with name '" + engineName +
				"' not found; registered engine names: " + engineNames);
	}
	return engine;
}
 
源代码28 项目: snap-desktop   文件: NewAction.java
private void showEngineDetails(JComponent parent, ScriptEngineFactory scriptEngineFactory) {
    StringBuilder out = new StringBuilder();

    out.append(String.format("Engine name: %s\n", scriptEngineFactory.getEngineName()));
    out.append(String.format("Engine version: %s\n", scriptEngineFactory.getEngineVersion()));
    out.append(String.format("Language name: %s\n", scriptEngineFactory.getLanguageName()));
    out.append(String.format("Language version: %s\n", scriptEngineFactory.getLanguageVersion()));

    out.append("File name extension(s):");
    final List<String> extensions = scriptEngineFactory.getExtensions();
    for (String extension : extensions) {
        out.append(" ");
        out.append(extension);
    }
    out.append("\n");

    out.append("File content type(s):");
    final List<String> mimeTypes = scriptEngineFactory.getMimeTypes();
    for (String mimeType : mimeTypes) {
        out.append(" ");
        out.append(mimeType);
    }
    out.append("\n");

    out.append("Engine factory name(s): ");
    final List<String> names = scriptEngineFactory.getNames();
    for (String name : names) {
        out.append(" ");
        out.append(name);
    }
    out.append("\n");

    JOptionPane.showMessageDialog(parent, out.toString(), "Script Engine Details", JOptionPane.INFORMATION_MESSAGE);
}
 
源代码29 项目: flowable-engine   文件: ScriptingEngines.java
public void setScriptEngineFactories(List<ScriptEngineFactory> scriptEngineFactories) {
    if (scriptEngineFactories != null) {
        for (ScriptEngineFactory scriptEngineFactory : scriptEngineFactories) {
            scriptEngineManager.registerEngineName(scriptEngineFactory.getEngineName(), scriptEngineFactory);
        }
    }
}
 
源代码30 项目: activiti6-boot2   文件: ScriptingEngines.java
public void setScriptEngineFactories(List<ScriptEngineFactory> scriptEngineFactories) {
  if (scriptEngineFactories != null) {
    for (ScriptEngineFactory scriptEngineFactory : scriptEngineFactories) {
      scriptEngineManager.registerEngineName(scriptEngineFactory.getEngineName(), scriptEngineFactory);
    }
  }
}