Package org.apache.bsf

Examples of org.apache.bsf.BSFManager


/**
* Returns true if we can load class <var>klass</var>.
*/
public boolean canFind(String klass) {
    BSFManager manager = new BSFManager();
    boolean found = false;
    try {
  manager.getClassLoader().loadClass(klass);
  found = true;
    }
    catch (ClassNotFoundException e) {}
    return found;
}
View Full Code Here


    return getBsfManager(defaultLanguage);
}

/** Returns BSFManager for <var>language</var>. */
public BSFManager getBsfManager(String language) throws BSFException {
    BSFManager manager = (BSFManager)managers.get(language);
    if (manager == null) {
  manager = new BSFManager();
  manager.declareBean("report", report, Report.class);
  BSFManager.registerScriptingEngine(language,
             (String)languages.get(language), null);
  managers.put(language, manager);
    }
    return manager;
View Full Code Here

    final WrapperExpressionRuntime runtimeWrapper = new WrapperExpressionRuntime();
    runtimeWrapper.update(null, getRuntime());
    legacyDataRowWrapper.setParent(getDataRow());
    try
    {
      final BSFManager interpreter = new BSFManager();
      interpreter.declareBean("chart", originalChart, JFreeChart.class); //$NON-NLS-1$
      interpreter.declareBean("runtime", runtimeWrapper, ExpressionRuntime.class); //$NON-NLS-1$
      interpreter.declareBean("dataRow", legacyDataRowWrapper, DataRow.class); //$NON-NLS-1$
      final Object o = interpreter.eval
          (postProcessingLanguage, "expression", 1, 1, postProcessingScript); //$NON-NLS-1$
      if (o instanceof JFreeChart)
      {
        return (JFreeChart) o;
      }
View Full Code Here

      return definition;
    }

    try
    {
      final BSFManager interpreter = new BSFManager();
      interpreter.declareBean("definition", definition, MasterReport.class); //$NON-NLS-1$
      interpreter.declareBean("flowController", flowController, DefaultFlowController.class); //$NON-NLS-1$
      final Object o = interpreter.eval(getLanguage(), "expression", 1, 1, script);
      if (o instanceof MasterReport == false)
      {
        throw new ReportDataFactoryException("Not a MasterReport");
      }
      return (MasterReport) o; //$NON-NLS-1$
View Full Code Here

      return definition;
    }

    try
    {
      final BSFManager interpreter = new BSFManager();
      interpreter.declareBean("definition", definition, SubReport.class); //$NON-NLS-1$
      interpreter.declareBean("flowController", flowController, DefaultFlowController.class); //$NON-NLS-1$
      final Object o = interpreter.eval(getLanguage(), "expression", 1, 1, script);
      if (o instanceof SubReport == false)
      {
        throw new ReportDataFactoryException("Not a MasterReport");
      }
      return (SubReport) o; //$NON-NLS-1$
View Full Code Here

   */
  protected BSFManager createInterpreter()
  {
    try
    {
      final BSFManager interpreter = new BSFManager();
      initializeInterpreter(interpreter);
      return interpreter;
    }
    catch (Exception e)
    {
View Full Code Here

    private String scriptDir;

    public boolean initialize(String handlerName, Server server) {
        super.initialize(handlerName, server);
        registerLanguages();
        manager = new BSFManager();
        scriptDir = SCRIPT_DIR_OPTION.getProperty( server, handlerName ) ;
        return true;
    }
View Full Code Here

public class BSFTest extends TestCase {

    protected BSFManager manager;

    protected void setUp() throws Exception {
        manager = new BSFManager();
    }
View Full Code Here

    private static final Class CACHING_ENGINE = CachingGroovyEngine.class;

    protected void setUp() throws Exception {
        // override standard engine with caching one
        BSFManager.registerScriptingEngine("groovy", CACHING_ENGINE.getName(), new String[]{"groovy", "gy"});
        manager = new BSFManager();
    }
View Full Code Here

            "org.codehaus.groovy.bsf.GroovyEngine",
            new String[] { "groovy", "gy" }
           );

      // I suppose we need one BSFManager per processing thread
      manager = new BSFManager();

      manager.setClassLoader(Thread.currentThread().getContextClassLoader());
      manager.loadScriptingEngine(language);
      manager.declareBean("log", log, Logger.class);
      manager.declareBean("server", server, MBeanServer.class);
View Full Code Here

TOP

Related Classes of org.apache.bsf.BSFManager

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.