01: /*
02: * ============================================================================
03: * GNU Lesser General Public License
04: * ============================================================================
05: *
06: * JasperReports - Free Java report-generating library.
07: * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
08: *
09: * This library is free software; you can redistribute it and/or
10: * modify it under the terms of the GNU Lesser General Public
11: * License as published by the Free Software Foundation; either
12: * version 2.1 of the License, or (at your option) any later version.
13: *
14: * This library is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17: * Lesser General Public License for more details.
18: *
19: * You should have received a copy of the GNU Lesser General Public
20: * License along with this library; if not, write to the Free Software
21: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22: *
23: * JasperSoft Corporation
24: * 303 Second Street, Suite 450 North
25: * San Francisco, CA 94107
26: * http://www.jaspersoft.com
27: */
28: package net.sf.jasperreports.engine.query;
29:
30: import java.util.Map;
31:
32: import net.sf.jasperreports.engine.JRDataset;
33: import net.sf.jasperreports.engine.JRException;
34:
35: /**
36: * XPath query executer factory.
37: * <p/>
38: * The factory creates {@link net.sf.jasperreports.engine.query.JRXPathQueryExecuter JRXPathQueryExecuter}
39: * query executers.
40: *
41: * @author Lucian Chirita (lucianc@users.sourceforge.net)
42: * @version $Id: JRXPathQueryExecuterFactory.java 1630 2007-03-14 10:42:19Z teodord $
43: */
44: public class JRXPathQueryExecuterFactory implements
45: JRQueryExecuterFactory {
46: /**
47: * Built-in parameter holding the value of the org.w3c.dom.Document used to run the XPath query.
48: */
49: public final static String PARAMETER_XML_DATA_DOCUMENT = "XML_DATA_DOCUMENT";
50:
51: /**
52: * Parameter holding the format pattern used to instantiate java.util.Date instances.
53: */
54: public final static String XML_DATE_PATTERN = "XML_DATE_PATTERN";
55:
56: /**
57: * Parameter holding the format pattern used to instantiate java.lang.Number instances.
58: */
59: public final static String XML_NUMBER_PATTERN = "XML_NUMBER_PATTERN";
60:
61: /**
62: * Parameter holding the value of the datasource Locale
63: */
64: public final static String XML_LOCALE = "XML_LOCALE";
65:
66: /**
67: * Parameter holding the value of the datasource Timezone
68: */
69: public final static String XML_TIME_ZONE = "XML_TIME_ZONE";
70:
71: private final static Object[] XPATH_BUILTIN_PARAMETERS = {
72: PARAMETER_XML_DATA_DOCUMENT, org.w3c.dom.Document.class,
73: XML_DATE_PATTERN, java.lang.String.class,
74: XML_NUMBER_PATTERN, java.lang.String.class, XML_LOCALE,
75: java.util.Locale.class, XML_TIME_ZONE,
76: java.util.TimeZone.class, };
77:
78: public Object[] getBuiltinParameters() {
79: return XPATH_BUILTIN_PARAMETERS;
80: }
81:
82: public JRQueryExecuter createQueryExecuter(JRDataset dataset,
83: Map parameters) throws JRException {
84: return new JRXPathQueryExecuter(dataset, parameters);
85: }
86:
87: public boolean supportsQueryParameterType(String className) {
88: return true;
89: }
90: }
|