/**
   * Gets the loader specified in the configuration file.
   *
   * @return TemplateLoader
   */
  public static ResourceLoader getLoader(RuntimeServices rs, String loaderClassName)
      throws Exception {
    ResourceLoader loader = null;

    try {
      loader = ((ResourceLoader) Class.forName(loaderClassName).newInstance());

      rs.info("Resource Loader Instantiated: " + loader.getClass().getName());

      return loader;
    } catch (Exception e) {
      rs.error(
          "Problem instantiating the template loader.\n"
              + "Look at your properties file and make sure the\n"
              + "name of the template loader is correct. Here is the\n"
              + "error: "
              + StringUtils.stackTrace(e));

      throw new Exception(
          "Problem initializing template loader: "
              + loaderClassName
              + "\nError is: "
              + StringUtils.stackTrace(e));
    }
  }
Example #2
0
  public Object init(InternalContextAdapter context, Object data) throws Exception {
    /*
     * hold onto the RuntimeServices
     */

    rsvc = (RuntimeServices) data;

    int i, k = jjtGetNumChildren();

    for (i = 0; i < k; i++) {
      try {
        jjtGetChild(i).init(context, data);
      } catch (ReferenceException re) {
        rsvc.error(re);
      }
    }

    return data;
  }