Package org.apache.velocity.runtime

Examples of org.apache.velocity.runtime.RuntimeServices


  }

  public VelocitySqlSource(Configuration configuration, String scriptText) {
    this.configuration = configuration;
    try {
      RuntimeServices runtimeServices = RuntimeSingleton.getRuntimeServices();
      StringReader reader = new StringReader(scriptText);
      SimpleNode node = runtimeServices.parse(reader, "Template name");
      script = new Template();
      script.setRuntimeServices(runtimeServices);
      script.setData(node);
      script.initDocument();
    } catch (Exception ex) {
View Full Code Here


    }

    @Before
    public void init() throws Exception {
        ExtendedProperties config = new ExtendedProperties();
        RuntimeServices rsvc = new RuntimeInstance();

        config.setProperty("path", "/templates");
        config.setProperty("resource.loader", "");

        rsvc.setConfiguration(config);
        rsvc.setProperty(RUNTIME_LOG_LOGSYSTEM, new Slf4jLogChute(log));
        rsvc.setApplicationAttribute(SpringResourceLoaderAdapter.SPRING_RESOURCE_LOADER_KEY, factory);

        rsvc.init();

        velocityLoader = new SpringResourceLoaderAdapter();
        velocityLoader.commonInit(rsvc, config);
        velocityLoader.init(config);
    }
View Full Code Here

    }

    @Before
    public void init() throws Exception {
        ExtendedProperties config = new ExtendedProperties();
        RuntimeServices rsvc = new RuntimeInstance();

        config.setProperty("resource.loader", "");
        config.setProperty(PreloadedResourceLoader.PRELOADED_RESOURCES_KEY, preloadingResources());

        rsvc.setConfiguration(config);
        rsvc.setProperty(RUNTIME_LOG_LOGSYSTEM, new Slf4jLogChute(log));

        rsvc.init();

        velocityLoader = new PreloadedResourceLoader();
        velocityLoader.commonInit(rsvc, config);
        velocityLoader.init(config);
    }
View Full Code Here

        ri.setProperty(EVENTHANDLER_REFERENCEINSERTION, RuntimeServicesExposer.class.getName());
        ri.init();

        // 初始化EventCartridge,以后不用再初始化了,以确保性能。
        CloneableEventCartridge eventCartridge = configuration.getEventCartridge();
        RuntimeServices rs = assertNotNull((RuntimeServices) ri.getProperty(RUNTIME_SERVICES_KEY), "RuntimeServices");

        eventCartridge.initOnce(rs);
    }
View Full Code Here

        ri.setProperty(EVENTHANDLER_REFERENCEINSERTION, RuntimeServicesExposer.class.getName());
        ri.init();

        // ��ʼ��EventCartridge���Ժ����ٳ�ʼ���ˣ���ȷ�����ܡ�
        CloneableEventCartridge eventCartridge = configuration.getEventCartridge();
        RuntimeServices rs = assertNotNull((RuntimeServices) ri.getProperty(RUNTIME_SERVICES_KEY), "RuntimeServices");

        eventCartridge.initOnce(rs);
    }
View Full Code Here

            ica.setCurrentResource( this );

            /*
             *  init the AST
             */
            RuntimeServices rsvc=VelocityUtil.getEngine().getRuntimeServices();
            ((SimpleNode)data).init( ica, rsvc);

            String property = scopeName+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
            provideScope = rsvc.getBoolean(property, provideScope);
        }
        finally
        {
            /*
             *  in case something blows up...
View Full Code Here

        if (errorCondition != null)
        {
            throw errorCondition;
        }

        RuntimeServices rsvc=VelocityUtil.getEngine().getRuntimeServices();
        if( data != null)
        {
            /*
             *  create an InternalContextAdapter to carry the user Context down
             *  into the rendering engine.  Set the template name and render()
             */

            InternalContextAdapterImpl ica = new InternalContextAdapterImpl( context );

            /**
             * Set the macro libraries
             */
            ica.setMacroLibraries(macroLibraries);

            if (macroLibraries != null)
            {
                for (int i = 0; i < macroLibraries.size(); i++)
                {
                    /**
                     * Build the macro library
                     */
                    try
                    {
                        rsvc.getTemplate((String) macroLibraries.get(i));
                    }
                    catch (ResourceNotFoundException re)
                    {
                        /*
                        * the macro lib wasn't found.  Note it and throw
View Full Code Here

        /*
         * The new string needs to be parsed since the text has been dynamically generated.
         */
        String templateName = context.getCurrentTemplateName();
        SimpleNode nodeTree = null;
        RuntimeServices rsvc=VelocityUtil.getEngine().getRuntimeServices();
        try
        {
            nodeTree = rsvc.parse(new StringReader(sourceText), templateName, false);
        }
        catch (ParseException pex)
        {
            // use the line/column from the template
            Info info = new Info( templateName, node.getLine(), node.getColumn() );
View Full Code Here

     */
    public void init( RuntimeServices rs, InternalContextAdapter context,
                      Node node)
        throws TemplateInitException
    {
        RuntimeServices rsvc=VelocityUtil.getEngine().getRuntimeServices();
        String property = getScopeName()+'.'+RuntimeConstants.PROVIDE_SCOPE_CONTROL;
        this.provideScope = rsvc.getBoolean(property, provideScope);
    }
View Full Code Here

    public void init(RuntimeServices rs, InternalContextAdapter context,
                     Node node)
        throws TemplateInitException
    {
        super.init( rs, context, node );
        RuntimeServices rsvc=VelocityUtil.getEngine().getRuntimeServices();

        /*
         *  get the msg, and add the space so we don't have to
         *  do it each time
         */
        outputMsgStart = rsvc.getString(RuntimeConstants.ERRORMSG_START);
        outputMsgStart = outputMsgStart + " ";

        outputMsgEnd = rsvc.getString(RuntimeConstants.ERRORMSG_END );
        outputMsgEnd = " " + outputMsgEnd;
    }
View Full Code Here

TOP

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

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.