Velocity.java [src/csip/api/server] Revision:   Date:
/*
 * $Id$
 *
 * This file is part of the Cloud Services Integration Platform (CSIP),
 * a Model-as-a-Service framework, API and application suite.
 *
 * 2012-2022, Olaf David and others, OMSLab, Colorado State University.
 *
 * OMSLab licenses this file to you under the MIT license.
 * See the LICENSE file in the project root for more information.
 */
package csip.api.server;

import java.io.File;
import java.io.IOException;
import java.util.Map;

/**
 * Velocity support.
 *
 *
 * <blockquote><pre>
 *   velocity().merge("/a/tmpl.vm", workspace().getFile("run.txt"),
 *     new HashMap() {{
 *        put("cfg", this);
 *     }}
 *   );
 * </pre></blockquote>
 *
 *
 * @author od
 */

public interface Velocity {

  /**
   * merges a template (tmpl) into the file (out)
   * @param tmpl the input template. (in service resource path)
   * @param out the output file.
   * @throws IOException if merging fails
   */
  void merge(String tmpl, File out) throws IOException;


  /**
   * merges a template (tmpl) into the file (out)
   * @param tmpl the input template. (in service resource path)
   * @param out the output file.
   * @param properties map of objects for property resolution.
   * @throws IOException if merging fails
   */
  void merge(String tmpl, File out, Map<String, Object> properties)
      throws IOException;

}