Exemplo n.º 1
0
  /**
   * Loads the declarations of the script engines declared in a property set
   *
   * @param props property set containing the configuration
   * @throws ConfigurationException if the scripting languages cannot be loaded
   */
  private void loadScriptingLanguages(Properties props) throws ConfigurationException {
    String strEngineList = loadProperty(props, SCRIPT_ENGINE_LIST_P);

    for (StringTokenizer engineTokenizer = new StringTokenizer(strEngineList);
        engineTokenizer.hasMoreTokens(); ) {
      String engineBaseItem = engineTokenizer.nextToken();
      String engineName = props.getProperty(engineBaseItem + ".name"); // $NON-NLS-1$
      String engineClass = props.getProperty(engineBaseItem + ".class"); // $NON-NLS-1$
      String engineExtProps = props.getProperty(engineBaseItem + ".extensions"); // $NON-NLS-1$
      String[] extArray = null;
      if (engineExtProps != null) {
        List<String> extList = new ArrayList<String>();
        for (StringTokenizer extTokenizer = new StringTokenizer(engineExtProps);
            extTokenizer.hasMoreTokens(); ) {
          String extension = extTokenizer.nextToken();
          ext = extension;
          extList.add(extension);
        }
        extArray = extList.toArray(new String[0]);
      }
      BSFManager.registerScriptingEngine(engineName, engineClass, extArray);
      System.out.println("Script " + engineName + " loaded"); // $NON-NLS-1$ //$NON-NLS-2$
    }

    defaultEngineName = loadProperty(props, DFLT_SCRIPT_ENGINE_P);
  }
Exemplo n.º 2
0
  /**
   * Loads the package information from configuration file and builds the list of the package to
   * load by default
   *
   * @param props the property set containing the package information
   */
  private void loadPackageInfo(Properties props) throws ConfigurationException {
    importPackageCmd = loadProperty(props, IMPORT_PKG_CMD_P);
    addClassPathCmd = loadProperty(props, ADD_CLASSPATH_CMD_P);
    parameterTag = loadProperty(props, PARAMETER_TAG_P);

    List<String> pkgList = new ArrayList<String>();
    for (StringTokenizer pkgTokenizer = new StringTokenizer(IMPORT_PKG_LST, IMPORT_PKG_LST_SEP);
        pkgTokenizer.hasMoreTokens(); ) {
      String packageName = pkgTokenizer.nextToken();
      pkgList.add(packageName);
    }
    if (defaultLanguage) pkgList.add("org.colombbus.tangara.en.*");
    else pkgList.add("org.colombbus.tangara." + getLanguage() + ".*");
    scriptImportPkgList = pkgList.toArray(scriptImportPkgList);
  }