Java 类org.mozilla.javascript.commonjs.module.ModuleScriptProvider 实例源码

项目:HL4A    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:HL4A    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:whackpad    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the 
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:whackpad    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:TaleCraft    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:TaleCraft    文件:MultiModuleScriptProvider.java   
@Override
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                      URI base, Scriptable paths) throws Exception {
      for (ModuleScriptProvider provider : providers) {
          final ModuleScript script = provider.getModuleScript(cx, moduleId,
                  uri, base, paths);
          if(script != null) {
              return script;
          }
      }
      return null;
  }
项目:code404    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:code404    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:rhino-jscover    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:rhino-jscover    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:LoboEvolution    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:LoboEvolution    文件:MultiModuleScriptProvider.java   
@Override
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                       URI base, Scriptable paths) throws Exception {
       for (ModuleScriptProvider provider : providers) {
           final ModuleScript script = provider.getModuleScript(cx, moduleId,
                   uri, base, paths);
           if(script != null) {
               return script;
           }
       }
       return null;
   }
项目:astor    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:astor    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:Rhino-Prov-Mod    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:Rhino-Prov-Mod    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:android-js    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:android-js    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:closure-compiler-old    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:closure-compiler-old    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:closure-compiler-copy    文件:MultiModuleScriptProvider.java   
/**
 * Creates a new multiplexing module script provider tht gathers the
 * specified providers
 * @param providers the providers to multiplex.
 */
public MultiModuleScriptProvider(Iterable<? extends ModuleScriptProvider> providers) {
    final List<ModuleScriptProvider> l = new LinkedList<ModuleScriptProvider>();
    for (ModuleScriptProvider provider : providers) {
        l.add(provider);
    }
    this.providers = l.toArray(new ModuleScriptProvider[l.size()]);
}
项目:closure-compiler-copy    文件:MultiModuleScriptProvider.java   
public ModuleScript getModuleScript(Context cx, String moduleId, URI uri,
                                    URI base, Scriptable paths) throws Exception {
    for (ModuleScriptProvider provider : providers) {
        final ModuleScript script = provider.getModuleScript(cx, moduleId,
                uri, base, paths);
        if(script != null) {
            return script;
        }
    }
    return null;
}
项目:Equella    文件:ScriptingServiceImpl.java   
private Object executeInternal(final String script, final String scriptName, final ScriptContext context,
    final boolean function, final Class<?> expectedResultClass) throws ScriptException
{
    // never ever execute an empty script, it's just a waste of time
    if( !Check.isEmpty(script) )
    {
        // In most cases apart from calls from birt, we can expect that
        // there'll be no current context, thus one will be generated by
        // this call into the ContextFactory
        return ContextFactory.getGlobal().call(new ContextAction()
        {
            @Override
            public Object run(Context cx)
            {
                Logger errorLogger = context.getLogger();
                if( errorLogger == null )
                {
                    errorLogger = logger;
                }

                Scriptable userScriptScope = ((DefaultScriptContext) context).getUserScriptScope(cx);
                ScriptableModuleSourceProvider sourceProvider = new ScriptableModuleSourceProvider(userScriptScope);
                ModuleScriptProvider scriptProvider = new SoftCachingModuleScriptProvider(sourceProvider);

                cx.initStandardObjects();
                Scriptable scope = ((DefaultScriptContext) context).getScope(cx);

                RequireBuilder builder = new RequireBuilder();
                // The "uri" property must not exist in a sandbox
                builder.setSandboxed(false);
                builder.setModuleScriptProvider(scriptProvider);

                Require require = builder.createRequire(cx, scope);

                cx.setOptimizationLevel(-1);
                cx.setErrorReporter(new ScriptErrorReporter(errorLogger));


                final String execScript = (function ? "function runScript() {\n" + script + "\n}\n runScript();"
                    : script);
                final String execScriptName = (scriptName != null ? scriptName : "script");

                try
                {
                    context.scriptEnter();
                    require.install(scope);

                    Object result = cx.evaluateString(scope, execScript, execScriptName, 1, null);

                    context.scriptExit();
                    if( expectedResultClass == String.class )
                    {
                        return result.toString();
                    }
                    return result;
                }
                catch( JavaScriptException js )
                {
                    throw new ScriptException(js);
                }
                catch( EcmaError ec )
                {
                    throw new ScriptException(ec);
                }
                catch( EvaluatorException ev )
                {
                    throw new ScriptException(ev);
                }
            }
        });
    }
    return Boolean.TRUE;

}