org.apache.lucene.xmlparser

Class QueryTemplateManager

public class QueryTemplateManager extends Object

Provides utilities for turning query form input (such as from a web page or Swing gui) into Lucene XML queries by using XSL templates. This approach offers a convenient way of externalizing and changing how user input is turned into Lucene queries. Database applications often adopt similar practices by externalizing SQL in template files that can be easily changed/optimized by a DBA. The static methods can be used on their own or by creating an instance of this class you can store and re-use compiled stylesheets for fast use (e.g. in a server environment)

Author: Mark Harwood

Constructor Summary
QueryTemplateManager()
QueryTemplateManager(InputStream xslIs)
Method Summary
voidaddDefaultQueryTemplate(InputStream xslIs)
voidaddQueryTemplate(String name, InputStream xslIs)
DocumentgetQueryAsDOM(Properties formProperties, String queryTemplateName)
DocumentgetQueryAsDOM(Properties formProperties)
static DocumentgetQueryAsDOM(Properties formProperties, Templates template)
Fast means of constructing query using a cached,precompiled stylesheet
static DocumentgetQueryAsDOM(Properties formProperties, InputStream xslIs)
Slow means of constructing query - parses stylesheet from input stream
StringgetQueryAsXmlString(Properties formProperties, String queryTemplateName)
StringgetQueryAsXmlString(Properties formProperties)
static StringgetQueryAsXmlString(Properties formProperties, Templates template)
Fast means of constructing query using a precompiled stylesheet
static StringgetQueryAsXmlString(Properties formProperties, InputStream xslIs)
Slow means of constructing query parsing a stylesheet from an input stream
static TemplatesgetTemplates(InputStream xslIs)
Parses a query stylesheet for repeated use
static voidtransformCriteria(Properties formProperties, InputStream xslIs, Result result)
Slower transformation using an uncompiled stylesheet (suitable for development environment)
static voidtransformCriteria(Properties formProperties, Templates template, Result result)
Fast transformation using a pre-compiled stylesheet (suitable for production environments)
static voidtransformCriteria(Properties formProperties, Transformer transformer, Result result)

Constructor Detail

QueryTemplateManager

public QueryTemplateManager()

QueryTemplateManager

public QueryTemplateManager(InputStream xslIs)

Method Detail

addDefaultQueryTemplate

public void addDefaultQueryTemplate(InputStream xslIs)

addQueryTemplate

public void addQueryTemplate(String name, InputStream xslIs)

getQueryAsDOM

public Document getQueryAsDOM(Properties formProperties, String queryTemplateName)

getQueryAsDOM

public Document getQueryAsDOM(Properties formProperties)

getQueryAsDOM

public static Document getQueryAsDOM(Properties formProperties, Templates template)
Fast means of constructing query using a cached,precompiled stylesheet

getQueryAsDOM

public static Document getQueryAsDOM(Properties formProperties, InputStream xslIs)
Slow means of constructing query - parses stylesheet from input stream

getQueryAsXmlString

public String getQueryAsXmlString(Properties formProperties, String queryTemplateName)

getQueryAsXmlString

public String getQueryAsXmlString(Properties formProperties)

getQueryAsXmlString

public static String getQueryAsXmlString(Properties formProperties, Templates template)
Fast means of constructing query using a precompiled stylesheet

getQueryAsXmlString

public static String getQueryAsXmlString(Properties formProperties, InputStream xslIs)
Slow means of constructing query parsing a stylesheet from an input stream

getTemplates

public static Templates getTemplates(InputStream xslIs)
Parses a query stylesheet for repeated use

transformCriteria

public static void transformCriteria(Properties formProperties, InputStream xslIs, Result result)
Slower transformation using an uncompiled stylesheet (suitable for development environment)

transformCriteria

public static void transformCriteria(Properties formProperties, Templates template, Result result)
Fast transformation using a pre-compiled stylesheet (suitable for production environments)

transformCriteria

public static void transformCriteria(Properties formProperties, Transformer transformer, Result result)
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.