Package org.apache.velocity

Examples of org.apache.velocity.VelocityContext


      ve.setProperty("runtime.log.logsystem.class", VelocityLog.class.getCanonicalName());
      // TODO find a way to set a non static logger
      VelocityLog.setLogger(_logger);
      ve.init();
      Template t = ve.getTemplate(daemonTemplate.getName());
      VelocityContext context = new VelocityContext();
      context.put("w_name", _name);
      context.put("w_long_name", _displayName);
      context.put("w_start_cmd", toStrCommand(_startCmd));
      context.put("w_stop_cmd", toStrCommand(_stopCmd));
      context.put("w_status_cmd", toStrCommand(_statusCmd));
      context.put("w_description", _description);
      context.put("w_conf_file", _confFile);
      context.put("w_app_pid_file", _appPidFile);
      context.put("w_wrapper_pid_file", _wrapperPidFile);
      FileWriter writer = new FileWriter(_daemonScript);

      t.merge(context, writer);
      writer.flush();
      writer.close();
View Full Code Here


      ve.setProperty(VelocityEngine.RESOURCE_LOADER, "file");
      ve.setProperty("file.resource.loader.path", daemonTemplate.getParent());
      ve.setProperty("runtime.log.logsystem.class", VelocityLog.class.getCanonicalName());
      ve.init();
      Template t = ve.getTemplate(daemonTemplate.getName());
      VelocityContext context = new VelocityContext();
      context.put("name", _plistName);
      context.put("command", Arrays.asList(_execCmd.split(" ")));
      context.put("autoStart", "AUTOMATIC".equals(_config.getString("wrapper.ntservice.starttype", DEFAULT_SERVICE_START_TYPE)));
      FileWriter writer = new FileWriter(_plistFile);

      t.merge(context, writer);
      writer.flush();
      writer.close();
View Full Code Here

  public String getScreenTemplate(String rtmphostlocal, String red5httpport, String SID, String ROOM, String DOMAIN){
        try {
          /* lets make a Context and put data into it */
 
          VelocityContext context = new VelocityContext();
 
          context.put("rtmphostlocal", rtmphostlocal); //rtmphostlocal
          context.put("red5httpport", red5httpport); //red5httpport
          context.put("webAppRootKey", "openmeetings"); //TODO: Query webAppRootKey by Servlet
          context.put("SID", SID);
          context.put("ROOM", ROOM);
          context.put("DOMAIN", DOMAIN);
 
          /* lets render a template */
 
          StringWriter w = new StringWriter();
         
View Full Code Here

          Fieldlanguagesvalues labelid667 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(667), default_lang_id);
          Fieldlanguagesvalues labelid668 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(668), default_lang_id);
         
         
          /* lets make a Context and put data into it */
          VelocityContext context = new VelocityContext();
 
          context.put("username", username);
          context.put("userpass", userpass);
          context.put("mail", email);
          context.put("verification_url", verification_url);
          context.put("labelid506", labelid506.getValue());
          context.put("labelid507", labelid507.getValue());
          context.put("labelid508", labelid508.getValue());
          context.put("labelid509", labelid509.getValue());
          context.put("labelid510", labelid510.getValue());
          context.put("labelid511", labelid511.getValue());
          context.put("labelid667", labelid667.getValue());
          context.put("labelid668", labelid668.getValue());
 
          /* lets render a template */
 
          StringWriter w = new StringWriter();
            Velocity.mergeTemplate(templateNameVerification, "UTF-8", context, w );
View Full Code Here

          Fieldlanguagesvalues labelid510 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(510), default_lang_id);
          Fieldlanguagesvalues labelid511 = Fieldmanagment.getInstance().getFieldByIdAndLanguage(new Long(511), default_lang_id);
         
         
          /* lets make a Context and put data into it */
          VelocityContext context = new VelocityContext();
 
          context.put("username", username);
          context.put("userpass", userpass);
          context.put("mail", email);
          context.put("labelid506", labelid506.getValue());
          context.put("labelid507", labelid507.getValue());
          context.put("labelid508", labelid508.getValue());
          context.put("labelid509", labelid509.getValue());
          context.put("labelid510", labelid510.getValue());
          context.put("labelid511", labelid511.getValue());
 
          /* lets render a template */
 
          StringWriter w = new StringWriter();
            Velocity.mergeTemplate(templateName, "UTF-8", context, w );
View Full Code Here

  public String getRequestContactTemplate(String message) {
        try {
         
          /* lets make a Context and put data into it */
 
          VelocityContext context = new VelocityContext();
 
          context.put("message", message);
 
          /* lets render a template */
 
          StringWriter w = new StringWriter();
            Velocity.mergeTemplate(tamplateName, "UTF-8", context, w );
View Full Code Here

      ve.setProperty(VelocityEngine.RESOURCE_LOADER, "file");
      ve.setProperty("file.resource.loader.path", daemonTemplate.getParent());
      ve.setProperty("runtime.log.logsystem.class", VelocityLog.class.getCanonicalName());
      ve.init();
      Template t = ve.getTemplate(daemonTemplate.getName());
      VelocityContext context = new VelocityContext();
      context.put("name", _plistName);
      context.put("command", Arrays.asList(_execCmd.split(" ")));
      context.put("autoStart", "AUTOMATIC".equals(_config.getString("wrapper.ntservice.starttype", DEFAULT_SERVICE_START_TYPE)));
      FileWriter writer = new FileWriter(_plistFile);

      t.merge(context, writer);
      writer.flush();
      writer.close();
View Full Code Here

    public Context getContext()
    {
        Context globalContext =
                pullModelActive ? pullService.getGlobalContext() : null;

        Context ctx = new VelocityContext(globalContext);
        return ctx;
    }
View Full Code Here

     *
     * @return A Context Object.
     */
    public Context getNewContext()
    {
        Context ctx = new VelocityContext();

        // Attach an Event Cartridge to it, so we get exceptions
        // while invoking methods from the Velocity Screens
        EventCartridge ec = new EventCartridge();
        ec.addEventHandler(this);
View Full Code Here

        catch (EngineException ee)
        {
            throw new BuildException(ee);
        }

        context = new VelocityContext();

        // Place our set of data models into the context along
        // with the names of the databases as a convenience for now.
        context.put("dataModels", dataModels);
        context.put("databaseNames", databaseNames);
View Full Code Here

TOP

Related Classes of org.apache.velocity.VelocityContext

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.