Package javax.script

Examples of javax.script.ScriptEngineManager


     * @param languageShortName The short name of the scripting engine of interest
     * @return the ScriptEngine corresponding to the supplied short name or null if no engine was found
     * @since 1.8.0
     */
    public static ScriptEngine $static_propertyMissing(ScriptEngineManager self, String languageShortName) {
        ScriptEngineManager manager = new ScriptEngineManager();
        return manager.getEngineByName(languageShortName);
    }
View Full Code Here


    Iterator<String> iterator = map.keySet().iterator();
    while(iterator.hasNext()) {
      processFilters.add(map.get(iterator.next()));
    }
   
    scriptEngineManager = new ScriptEngineManager();
  }
View Full Code Here

import javax.script.ScriptEngineManager;


public class JavascriptEventPredicateEngine  extends ScriptEventPredicateEngine {
    public JavascriptEventPredicateEngine() {
        super(new ScriptEngineManager().getEngineByName("JavaScript"));
    }
View Full Code Here

  public ScriptInstance(String scriptlanguage) {
    languageId = scriptlanguage;
    logger.debug("the language id is " + scriptlanguage);

    ScriptEngineManager sm;
    ScriptEngine se;
    Bindings sb;
    try {
      sm = new ScriptEngineManager();
      se = sm.getEngineByName(getLanguageId());
      sb = se.getBindings(ScriptContext.ENGINE_SCOPE);
    }
    catch (Exception e) {
      throw new UnsupportedScriptLanguageException(e, "Scriptlanguage " + getLanguageId() + " is not supported.", scriptlanguage);
    }
View Full Code Here

    new TestScripting();
  }

  public TestScripting() throws Exception
  {
    mgr = new ScriptEngineManager();
    jsEngine = mgr.getEngineByExtension(SCRIPT_ENGINE_NAME);

    // InputStream is = this.getClass().getResourceAsStream("js.js");
    File file = new File(SCRIPT_FILE_NAME);
    InputStream is = new BufferedInputStream(new FileInputStream(file));
View Full Code Here

  private static final Log logger = LogFactory.getLog(JavaScriptConfigParser.class);

  private ConfigService configService;

  public void parseConfig(ConfigFile configFile) {
    ScriptEngineManager factory = new ScriptEngineManager();
    ScriptEngine engine = factory.getEngineByName("JavaScript");
    String content = configFile.getContent();
    engine.put("config", this);
    try {
      engine.eval(content);
    } catch (ScriptException e) {
View Full Code Here

    private Dictionary<String, String> props;
    private ComponentContext ctx;
    private final JmxScriptBindingsProvider jmxScriptBindingsProvider = new JmxScriptBindingsProvider();

    private void assertExpression(String expression, String languageExtension, boolean expected) throws Exception {
        final ScriptEngine rhino = new ScriptEngineManager().getEngineByExtension("js");
        assertNotNull("With the rhino jar in our classpath, we should get a js script engine", rhino);
        final ScriptEngineManager manager = Mockito.mock(ScriptEngineManager.class);
        Mockito.when(manager.getEngineByExtension(Matchers.same("ecma"))).thenReturn(rhino);
        final Field f = hc.getClass().getDeclaredField("scriptEngineManager");
        f.setAccessible(true);
        f.set(hc, manager);
       
        props.put(ScriptableHealthCheck.PROP_EXPRESSION, expression);
View Full Code Here

        }});

        ScriptEngineManagerFactory factory = new ScriptEngineManagerFactory();
        factory.activate(componentCtx);

        ScriptEngineManager first = factory.getScriptEngineManager();

        assertNull(first.getEngineByName("dummy"));

        final Bundle bundle  = context.mock(Bundle.class);

        final File factoryFile = createFactoryFile();

        context.checking(new Expectations() {{

            atLeast(1).of(bundle).getEntry("META-INF/services/javax.script.ScriptEngineFactory");
            will(returnValue(factoryFile.toURI().toURL()));

            atLeast(1).of(bundle).loadClass(SCRIPT_ENGINE_FACTORY.getName());
            will(returnValue(SCRIPT_ENGINE_FACTORY));
        }});

        factory.bundleChanged(new BundleEvent(BundleEvent.STARTED, bundle));

        ScriptEngineManager second = factory.getScriptEngineManager();

        assertNotNull(second.getEngineByName("dummy"));
    }
View Full Code Here

    public void printConfiguration(final PrintWriter pw) {
        pw.println("Available Script Engines");
        pw.println("========================");

        ScriptEngineManager manager = scriptEngineManagerFactory.getScriptEngineManager();
        List<?> factories = manager.getEngineFactories();
        for (Iterator<?> fi = factories.iterator(); fi.hasNext();) {

            final ScriptEngineFactory factory = (ScriptEngineFactory) fi.next();

            pw.println();
View Full Code Here

public class ScriptEngineFactories {
    private static Logger log = Logger.getLogger(ScriptEngineFactories.class.getName());
   
    public static void main(String[] args) {
        List<ScriptEngineFactory> factories =
            new ScriptEngineManager().getEngineFactories();
        for (ScriptEngineFactory factory : factories) {
            log.info("lang name: " + factory.getLanguageName());
            log.info("lang version: " + factory.getLanguageVersion());
            log.info("engine version: " + factory.getEngineVersion());
            log.info("engine name: " + factory.getEngineName());
View Full Code Here

TOP

Related Classes of javax.script.ScriptEngineManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.