public VelocityTemplateEngine(PipelineContext context, Configuration.Template template, IReader templateReader)
        {
            VelocityInitializer.Init();

            _context        = context;
            _template       = template;
            _templateReader = templateReader;
        }
Example #2
0
        public VelocityTransform(IContext context, IReader reader) : base(context, context.Field.Type)
        {
            VelocityInitializer.Init();

            var fileBasedTemplate = context.Process.Templates.FirstOrDefault(t => t.Name == context.Transform.Template);

            if (fileBasedTemplate != null)
            {
                var memoryLogger = new MemoryLogger();
                context.Transform.Template = reader.Read(fileBasedTemplate.File, null, memoryLogger);
                if (memoryLogger.Errors().Any())
                {
                    foreach (var error in memoryLogger.Errors())
                    {
                        context.Error(error);
                    }
                }
            }

            _input        = MultipleInput();
            _templateName = Context.Field.Alias + " Template";
        }