本文整理汇总了Java中org.mozilla.javascript.commonjs.module.ModuleScript类的典型用法代码示例。如果您正苦于以下问题:Java ModuleScript类的具体用法?Java ModuleScript怎么用?Java ModuleScript使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ModuleScript类属于org.mozilla.javascript.commonjs.module包,在下文中一共展示了ModuleScript类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@Override
public ModuleScript getModuleScript(Context cx, String moduleId,
URI uri, URI base, Scriptable paths)
throws Exception
{
// Overridden to clear the reference queue before retrieving the
// script.
for(;;) {
ScriptReference ref = (ScriptReference)scriptRefQueue.poll();
if(ref == null) {
break;
}
scripts.remove(ref.getModuleId(), ref);
}
return super.getModuleScript(cx, moduleId, uri, base, paths);
}
示例2: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@Override
public ModuleScript getModuleScript(Context cx, String moduleId,
URI uri, Scriptable paths)
throws Exception
{
// Overridden to clear the reference queue before retrieving the
// script.
for(;;) {
ScriptReference ref = (ScriptReference)scriptRefQueue.poll();
if(ref == null) {
break;
}
scripts.remove(ref.getModuleId(), ref);
}
return super.getModuleScript(cx, moduleId, uri, paths);
}
示例3: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
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;
}
示例4: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
public ModuleScript getModuleScript(Context cx, String moduleId,
URI moduleUri, URI baseUri, Scriptable paths) throws Exception
{
final CachedModuleScript cachedModule1 = getLoadedModule(moduleId);
final Object validator1 = getValidator(cachedModule1);
final ModuleSource moduleSource = (moduleUri == null)
? moduleSourceProvider.loadSource(moduleId, paths, validator1)
: moduleSourceProvider.loadSource(moduleUri, baseUri, validator1);
if(moduleSource == ModuleSourceProvider.NOT_MODIFIED) {
return cachedModule1.getModule();
}
if(moduleSource == null) {
return null;
}
final Reader reader = moduleSource.getReader();
try {
final int idHash = moduleId.hashCode();
synchronized(loadLocks[(idHash >>> loadLockShift) & loadLockMask]) {
final CachedModuleScript cachedModule2 = getLoadedModule(moduleId);
if(cachedModule2 != null) {
if(!equal(validator1, getValidator(cachedModule2))) {
return cachedModule2.getModule();
}
}
final URI sourceUri = moduleSource.getUri();
final ModuleScript moduleScript = new ModuleScript(
cx.compileReader(reader, sourceUri.toString(), 1,
moduleSource.getSecurityDomain()),
sourceUri, moduleSource.getBase());
putLoadedModule(moduleId, moduleScript,
moduleSource.getValidator());
return moduleScript;
}
}
finally {
reader.close();
}
}
示例5: putLoadedModule
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@Override
protected void putLoadedModule(String moduleId, ModuleScript moduleScript,
Object validator)
{
scripts.put(moduleId, new ScriptReference(moduleScript.getScript(),
moduleId, moduleScript.getUri(), moduleScript.getBase(),
validator, scriptRefQueue));
}
示例6: getCachedModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
CachedModuleScript getCachedModuleScript() {
final Script script = get();
if(script == null) {
return null;
}
return new CachedModuleScript(new ModuleScript(script, uri, base),
validator);
}
示例7: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
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;
}
示例8: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
public ModuleScript getModuleScript(Context cx, String moduleId,
URI moduleUri, Scriptable paths) throws Exception
{
final CachedModuleScript cachedModule1 = getLoadedModule(moduleId);
final Object validator1 = getValidator(cachedModule1);
final ModuleSource moduleSource = (moduleUri == null)
? moduleSourceProvider.loadSource(moduleId, paths, validator1)
: moduleSourceProvider.loadSource(moduleUri, validator1);
if(moduleSource == ModuleSourceProvider.NOT_MODIFIED) {
return cachedModule1.getModule();
}
if(moduleSource == null) {
return null;
}
final Reader reader = moduleSource.getReader();
try {
final int idHash = moduleId.hashCode();
synchronized(loadLocks[(idHash >>> loadLockShift) & loadLockMask]) {
final CachedModuleScript cachedModule2 = getLoadedModule(moduleId);
if(cachedModule2 != null) {
if(!equal(validator1, getValidator(cachedModule2))) {
return cachedModule2.getModule();
}
}
final URI sourceUri = moduleSource.getUri();
final ModuleScript moduleScript = new ModuleScript(
cx.compileReader(reader, sourceUri.toString(), 1,
moduleSource.getSecurityDomain()),
sourceUri, moduleSource.getBase());
putLoadedModule(moduleId, moduleScript,
moduleSource.getValidator());
return moduleScript;
}
}
finally {
reader.close();
}
}
示例9: putLoadedModule
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@Override
protected void putLoadedModule(String moduleId, ModuleScript moduleScript,
Object validator)
{
scripts.put(moduleId, new ScriptReference(moduleScript.getScript(),
moduleId, moduleScript.getUri(), moduleScript.getBase(),
validator, scriptRefQueue));
}
示例10: getCachedModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
CachedModuleScript getCachedModuleScript() {
final Script script = get();
if(script == null) {
return null;
}
return new CachedModuleScript(new ModuleScript(script, uri, base),
validator);
}
示例11: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@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;
}
示例12: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@Override
public ModuleScript getModuleScript(Context cx, String moduleId,
URI moduleUri, URI baseUri, Scriptable paths) throws Exception
{
final CachedModuleScript cachedModule1 = getLoadedModule(moduleId);
final Object validator1 = getValidator(cachedModule1);
final ModuleSource moduleSource = (moduleUri == null)
? moduleSourceProvider.loadSource(moduleId, paths, validator1)
: moduleSourceProvider.loadSource(moduleUri, baseUri, validator1);
if(moduleSource == ModuleSourceProvider.NOT_MODIFIED) {
return cachedModule1.getModule();
}
if(moduleSource == null) {
return null;
}
final Reader reader = moduleSource.getReader();
try {
final int idHash = moduleId.hashCode();
synchronized(loadLocks[(idHash >>> loadLockShift) & loadLockMask]) {
final CachedModuleScript cachedModule2 = getLoadedModule(moduleId);
if(cachedModule2 != null) {
if(!equal(validator1, getValidator(cachedModule2))) {
return cachedModule2.getModule();
}
}
final URI sourceUri = moduleSource.getUri();
final ModuleScript moduleScript = new ModuleScript(
cx.compileReader(reader, sourceUri.toString(), 1,
moduleSource.getSecurityDomain()),
sourceUri, moduleSource.getBase());
putLoadedModule(moduleId, moduleScript,
moduleSource.getValidator());
return moduleScript;
}
}
finally {
reader.close();
}
}
示例13: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@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;
}
示例14: getModuleScript
import org.mozilla.javascript.commonjs.module.ModuleScript; //导入依赖的package包/类
@Override
public ModuleScript getModuleScript(Context cx, String moduleId,
URI moduleUri, URI baseUri, Scriptable paths) throws Exception
{
final CachedModuleScript cachedModule1 = getLoadedModule(moduleId);
final Object validator1 = getValidator(cachedModule1);
final ModuleSource moduleSource = (moduleUri == null)
? moduleSourceProvider.loadSource(moduleId, paths, validator1)
: moduleSourceProvider.loadSource(moduleUri, baseUri, validator1);
if(moduleSource == ModuleSourceProvider.NOT_MODIFIED) {
return cachedModule1.getModule();
}
if(moduleSource == null) {
return null;
}
final Reader reader = moduleSource.getReader();
try {
final int idHash = moduleId.hashCode();
synchronized(loadLocks[(idHash >>> loadLockShift) & loadLockMask]) {
final CachedModuleScript cachedModule2 = getLoadedModule(moduleId);
if(cachedModule2 != null) {
if(!equal(validator1, getValidator(cachedModule2))) {
return cachedModule2.getModule();
}
}
final URI sourceUri = moduleSource.getUri();
final ModuleScript moduleScript = new ModuleScript(
cx.compileReader(reader, sourceUri.toString(), 1,
moduleSource.getSecurityDomain()),
sourceUri, moduleSource.getBase());
putLoadedModule(moduleId, moduleScript,
moduleSource.getValidator());
return moduleScript;
}
}
finally {
reader.close();
}
}