Minor refactoring on AbstractTemplateWritingHandler to support both QueryJ and Template Packaging. refs #418