Package org.apache.velocity.runtime

Examples of org.apache.velocity.runtime.RuntimeInstance


            throws Exception
    {
        Method verifyMethod = TestInterface.class.getMethod("getTestValue", new Class[0]);


        RuntimeInstance ri = new RuntimeInstance();
        Introspector introspector = ri.getIntrospector();

        Method testMethod = introspector.getMethod(TestObject.class, "getTestValue", new Object[0]);
        assertNotNull(testMethod);
        assertEquals("Method object does not match!", verifyMethod, testMethod);
    }
View Full Code Here


    }
   
    public void setUp()
            throws Exception
    {
        ri = new RuntimeInstance();
        ri.init();
    }
View Full Code Here

        initVelocityRuntime();
    }

    private static void initVelocityRuntime() {
        // init static velocity engine
        sharedRuntime = new RuntimeInstance();

        // set null logger
        sharedRuntime.addProperty(
                RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
                new NullLogSystem());
View Full Code Here

    velocityContext.put("StringUtils", StringUtils.class);
  }

  protected String velocify(String template) throws EmailException {
    try {
      RuntimeInstance runtime = args.velocityRuntime;
      String templateName = "OutgoingEmail";
      SimpleNode tree = runtime.parse(new StringReader(template), templateName);
      InternalContextAdapterImpl ica = new InternalContextAdapterImpl(velocityContext);
      ica.pushCurrentTemplateName(templateName);
      try {
        tree.init(ica, runtime);
        StringWriter w = new StringWriter();
View Full Code Here

    }
  }

  protected String velocifyFile(String name) throws EmailException {
    try {
      RuntimeInstance runtime = args.velocityRuntime;
      if (runtime.getLoaderNameForResource(name) == null) {
        name = "com/google/gerrit/server/mail/" + name;
      }
      Template template = runtime.getTemplate(name, "UTF-8");
      StringWriter w = new StringWriter();
      template.merge(velocityContext, w);
      return w.toString();
    } catch (EmailException e) {
      throw e;
View Full Code Here

    } else {
      p.setProperty(rl, "class");
      p.setProperty("class." + rl + ".class", pkg + ".ClasspathResourceLoader");
    }

    RuntimeInstance ri = new RuntimeInstance();
    try {
      ri.init(p);
    } catch (Exception err) {
      throw new ProvisionException("Cannot configure Velocity templates", err);
    }
    return ri;
  }
View Full Code Here

      throws Exception
    {
  Method verifyMethod = TestInterface.class.getMethod("getTestValue", new Class[0]);
 
 
  RuntimeInstance ri = new RuntimeInstance();
  Introspector introspector = ri.getIntrospector();
 
  Method testMethod = introspector.getMethod(TestObject.class, "getTestValue", new Object[0]);
  assertNotNull(testMethod);
  assertEquals("Method object does not match!", verifyMethod, testMethod);
    }
View Full Code Here

    private RuntimeInstance instance;

    public void setUp() throws Exception
    {
        this.instance = new RuntimeInstance();
        this.instance.setProperty(RuntimeConstants.VM_CONTEXT_LOCALSCOPE, Boolean.TRUE);
        this.instance.init();
    }
View Full Code Here

        initVelocityRuntime();
    }

    private static void initVelocityRuntime() {
        // init static velocity engine
        sharedRuntime = new RuntimeInstance();

        // set null logger
        sharedRuntime.addProperty(
                RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
                new NullLogSystem());
View Full Code Here

        initVelocityRuntime();
    }

    private static void initVelocityRuntime() {
        // init static velocity engine
        sharedRuntime = new RuntimeInstance();

        // set null logger
        sharedRuntime.addProperty(
                RuntimeConstants.RUNTIME_LOG_LOGSYSTEM,
                new NullLogSystem());
View Full Code Here

TOP

Related Classes of org.apache.velocity.runtime.RuntimeInstance

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.