当前位置: 首页>>代码示例>>Java>>正文


Java BSFDeclaredBean类代码示例

本文整理汇总了Java中org.apache.bsf.BSFDeclaredBean的典型用法代码示例。如果您正苦于以下问题:Java BSFDeclaredBean类的具体用法?Java BSFDeclaredBean怎么用?Java BSFDeclaredBean使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BSFDeclaredBean类属于org.apache.bsf包,在下文中一共展示了BSFDeclaredBean类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
    super.initialize(mgr, lang, declaredBeans);

    interpreter = BshUtil.getMasterInterpreter(null);

    // declare the bsf manager for callbacks, etc.
    try {
        interpreter.set("bsf", mgr);
    } catch (EvalError e) {
        throw new BSFException("bsh internal error: "+e.toString());
    }

    for (int i=0; i<declaredBeans.size(); i++) {
        BSFDeclaredBean bean = (BSFDeclaredBean)declaredBeans.get(i);
        declareBean(bean);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:20,代码来源:OfbizBshBsfEngine.java

示例2: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
/**
 * Initialize the engine.
 */
public void initialize(final BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
    super.initialize(mgr, lang, declaredBeans);
    ClassLoader parent = mgr.getClassLoader();
    if (parent == null)
        parent = GroovyShell.class.getClassLoader();
    setLoader(mgr, parent);
    execScripts = new HashMap<Object, Class>();
    evalScripts = new HashMap<Object, Class>();
    context = shell.getContext();
    // create a shell
    // register the mgr with object name "bsf"
    context.setVariable("bsf", new BSFFunctions(mgr, this));
    int size = declaredBeans.size();
    for (int i = 0; i < size; i++) {
        declareBean((BSFDeclaredBean) declaredBeans.elementAt(i));
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:21,代码来源:CachingGroovyEngine.java

示例3: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
    super.initialize(mgr, lang, declaredBeans);

    interpreter = BshUtil.getMasterInterpreter(null);

    // declare the bsf manager for callbacks, etc.
    try {
        interpreter.set("bsf", mgr);
    } catch (EvalError e) {
        throw new BSFException("bsh internal error: "+e.toString());
    }

    for(int i=0; i<declaredBeans.size(); i++) {
        BSFDeclaredBean bean = (BSFDeclaredBean)declaredBeans.get(i);
        declareBean(bean);
    }
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:20,代码来源:OfbizBshBsfEngine.java

示例4: declareBean

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@Override
public void declareBean(BSFDeclaredBean bean) throws BSFException {
    try {
        interpreter.set(bean.name, bean.bean);
    } catch (EvalError e) {
        throw new BSFException("error declaring bean: " + bean.name + " : " + e.toString());
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:9,代码来源:OfbizBshBsfEngine.java

示例5: undeclareBean

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@Override
public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
    try {
        interpreter.unset(bean.name);
    } catch (EvalError e) {
        throw new BSFException("bsh internal error: " + e.toString());
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:9,代码来源:OfbizBshBsfEngine.java

示例6: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
    super.initialize(mgr, lang, declaredBeans);
    // declare the bsf manager for callbacks, etc.
    context.put("bsf", mgr);
    for (int i = 0; i < declaredBeans.size(); i++) {
        BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.get(i);
        declareBean(bean);
    }
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:12,代码来源:SimpleMethodBsfEngine.java

示例7: declareBean

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@Override
public void declareBean(BSFDeclaredBean bean) throws BSFException {
    if ((bean.bean instanceof Number) ||
        (bean.bean == null) ||
        (bean.bean instanceof String) ||
        (bean.bean instanceof Boolean)) {
        global.put(bean.name, global, bean.bean);
    }
    else {
        // Must wrap non-scriptable objects before presenting to Rhino
        Scriptable wrapped = Context.toObject(bean.bean, global);
        global.put(bean.name, global, wrapped);
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:15,代码来源:BSFJavaScriptEngine.java

示例8: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
/**
 * Initialize the engine.
 * Put the manager into the context-manager
 * map hashtable too.
 */
@Override
public void initialize(BSFManager mgr, String lang,
        @SuppressWarnings("rawtypes") // superclass does not support types
        Vector declaredBeans)
    throws BSFException {

    super.initialize(mgr, lang, declaredBeans);

    // Initialize context and global scope object
    try {
        Context cx = Context.enter();
        global = new ImporterTopLevel(cx);
        Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global);
        global.put("bsf", global, bsf);
        @SuppressWarnings("unchecked") // superclass does not support types
        final Vector<BSFDeclaredBean> beans = declaredBeans;
        for (BSFDeclaredBean declaredBean : beans) {
            declareBean(declaredBean);
        }
    }
    catch (Throwable t) {
        handleError(t);
    }
    finally {
        Context.exit();
    }
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:33,代码来源:BSFJavaScriptEngine.java

示例9: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
/**
 * Initialize the engine.
 */
public void initialize(BSFManager mgr, String lang, Vector declaredBeans) throws BSFException {
    super.initialize(mgr, lang, declaredBeans);

    // create a shell
    shell = new GroovyShell(mgr.getClassLoader());

    // register the mgr with object name "bsf"
    shell.setVariable("bsf", new BSFFunctions(mgr, this));

    int size = declaredBeans.size();
    for (int i = 0; i < size; i++) {
        declareBean((BSFDeclaredBean) declaredBeans.elementAt(i));
    }
}
 
开发者ID:apache,项目名称:groovy,代码行数:18,代码来源:GroovyEngine.java

示例10: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
public void initialize (BSFManager mgr,
	  String lang,
	  Vector declaredBeans) throws BSFException {
  super.initialize (mgr, lang, declaredBeans);
  // Reference the REPL class to get primitives loaded.
  Class repl = REPL.class;
  // register the mgr with object name "bsf"
  js.setGlobalValue ("bsf", new BSFFunctions (mgr, this));

  int size = declaredBeans.size ();
  for (int i = 0; i < size; i++)
    declareBean ((BSFDeclaredBean) declaredBeans.elementAt (i));
}
 
开发者ID:dsyang,项目名称:scheme-droid,代码行数:14,代码来源:Engine.java

示例11: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("unchecked") // super-class does not use generics
@Override
public void initialize(BSFManager mgr, String lang,
        @SuppressWarnings("rawtypes") Vector declaredBeans) // super-class does not use generics
        throws BSFException {
    super.initialize(mgr, lang, declaredBeans);
    jc = JexlHelper.createContext();
    for (int i = 0; i < declaredBeans.size(); i++) {
        BSFDeclaredBean bean = (BSFDeclaredBean) declaredBeans.elementAt(i);
        jc.getVars().put(bean.name, bean.bean);
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:14,代码来源:JexlEngine.java

示例12: initialize

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
/**
 * Initialize the engine.
 * Put the manager into the context-manager
 * map hashtable too.
 */
@Override
public void initialize(BSFManager mgr, String lang,
        @SuppressWarnings("rawtypes") // superclass does not support types
        Vector declaredBeans)
    throws BSFException {

    super.initialize(mgr, lang, declaredBeans);

    // Initialize context and global scope object
    try {
        Context cx = Context.enter();
        global = new ImporterTopLevel(cx);
        Scriptable bsf = Context.toObject(new BSFFunctions(mgr, this), global);
        global.put("bsf", global, bsf);

        for(
            @SuppressWarnings("unchecked")
            Iterator<BSFDeclaredBean> it = declaredBeans.iterator();
            it.hasNext();) {
            declareBean(it.next());
        }
    }
    catch (Throwable t) {
        handleError(t);
    }
    finally {
        Context.exit();
    }
}
 
开发者ID:botelhojp,项目名称:apache-jmeter-2.10,代码行数:35,代码来源:BSFJavaScriptEngine.java

示例13: declareBean

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@Override
public void declareBean(BSFDeclaredBean bean) throws BSFException {
    context.put(bean.name, bean.bean);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:5,代码来源:SimpleMethodBsfEngine.java

示例14: undeclareBean

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@Override
public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
    context.remove(bean.name);
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:5,代码来源:SimpleMethodBsfEngine.java

示例15: undeclareBean

import org.apache.bsf.BSFDeclaredBean; //导入依赖的package包/类
@Override
public void undeclareBean(BSFDeclaredBean bean) throws BSFException {
    global.delete(bean.name);
}
 
开发者ID:johrstrom,项目名称:cloud-meter,代码行数:5,代码来源:BSFJavaScriptEngine.java


注:本文中的org.apache.bsf.BSFDeclaredBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。