KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > jasperreports > engine > query > JRXPathQueryExecuterFactory


1 /*
2  * ============================================================================
3  * GNU Lesser General Public License
4  * ============================================================================
5  *
6  * JasperReports - Free Java report-generating library.
7  * Copyright (C) 2001-2006 JasperSoft Corporation http://www.jaspersoft.com
8  *
9  * 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 JavaDoc;
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 1538 2006-12-22 17:04:25 +0200 (Fri, 22 Dec 2006) teodord $
43  */

44 public class JRXPathQueryExecuterFactory implements JRQueryExecuterFactory
45 {
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 JavaDoc 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 JavaDoc 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 JavaDoc XML_NUMBER_PATTERN = "XML_NUMBER_PATTERN";
60
61 // uncomment below block when patterns will be more dedicated
62

63 // /**
64
// * Parameter holding the format pattern used to instantiate java.math.BigDecimal instances.
65
// */
66
// public final static String XML_BIGDECIMAL_PATTERN = "XML_BIGDECIMAL_PATTERN";
67
//
68
// /**
69
// * Parameter holding the format pattern used to instantiate java.math.BigInteger instances.
70
// */
71
// public final static String XML_BIGINTEGER_PATTERN = "XML_BIGINTEGER_PATTERN";
72
//
73
// /**
74
// * Parameter holding the format pattern used to instantiate java.lang.Byte instances.
75
// */
76
// public final static String XML_BYTE_PATTERN = "XML_BYTE_PATTERN";
77
//
78
// /**
79
// * Parameter holding the format pattern used to instantiate java.lang.Double instances.
80
// */
81
// public final static String XML_DOUBLE_PATTERN = "XML_DOUBLE_PATTERN";
82
//
83
// /**
84
// * Parameter holding the format pattern used to instantiate java.lang.Float instances.
85
// */
86
// public final static String XML_FLOAT_PATTERN = "XML_FLOAT_PATTERN";
87
//
88
// /**
89
// * Parameter holding the format pattern used to instantiate java.lang.Integer instances.
90
// */
91
// public final static String XML_INTEGER_PATTERN = "XML_INTEGER_PATTERN";
92
//
93
// /**
94
// * Parameter holding the format pattern used to instantiate java.lang.Long instances.
95
// */
96
// public final static String XML_LONG_PATTERN = "XML_LONG_PATTERN";
97
//
98
// /**
99
// * Parameter holding the format pattern used to instantiate java.lang.Short instances.
100
// */
101
// public final static String XML_SHORT_PATTERN = "XML_SHORT_PATTERN";
102
//
103
// /**
104
// * Parameter holding the format pattern used to instantiate java.sql.Date instances.
105
// */
106
// public final static String XML_SQLDATE_PATTERN = "XML_SQLDATE_PATTERN";
107
//
108
// /**
109
// * Parameter holding the format pattern used to instantiate java.sql.Time instances.
110
// */
111
// public final static String XML_SQLTIME_PATTERN = "XML_SQLTIME_PATTERN";
112
//
113
// /**
114
// * Parameter holding the format pattern used to instantiate java.sql.Timestamp instances.
115
// */
116
// public final static String XML_SQLTIMESTAMP_PATTERN = "XML_SQLTIMESTAMP_PATTERN";
117
//
118
// /**
119
// * Parameter holding the format pattern used to instantiate java.lang.String instances.
120
// */
121
// public final static String XML_STRING_PATTERN = "XML_STRING_PATTERN";
122

123     /**
124      * Parameter holding the value of the datasource Locale
125      */

126     public final static String JavaDoc XML_LOCALE = "XML_LOCALE";
127     
128     /**
129      * Parameter holding the value of the datasource Timezone
130      */

131     public final static String JavaDoc XML_TIME_ZONE = "XML_TIME_ZONE";
132     
133     private final static Object JavaDoc[] XPATH_BUILTIN_PARAMETERS = {
134         PARAMETER_XML_DATA_DOCUMENT, org.w3c.dom.Document JavaDoc.class,
135         XML_DATE_PATTERN, java.lang.String JavaDoc.class,
136         XML_NUMBER_PATTERN, java.lang.String JavaDoc.class,
137         
138         // uncomment below block when patterns will be more dedicated
139
/*
140         XML_BIGDECIMAL_PATTERN, java.lang.String.class,
141         XML_BIGINTEGER_PATTERN, java.lang.String.class,
142         XML_BYTE_PATTERN, java.lang.String.class,
143         XML_DOUBLE_PATTERN, java.lang.String.class,
144         XML_FLOAT_PATTERN, java.lang.String.class,
145         XML_INTEGER_PATTERN, java.lang.String.class,
146         XML_LONG_PATTERN, java.lang.String.class,
147         XML_SHORT_PATTERN, java.lang.String.class,
148         XML_SQLDATE_PATTERN, java.lang.String.class,
149         XML_SQLTIME_PATTERN, java.lang.String.class,
150         XML_SQLTIMESTAMP_PATTERN, java.lang.String.class,
151         XML_STRING_PATTERN, java.lang.String.class,
152 */

153         XML_LOCALE, java.util.Locale JavaDoc.class,
154         XML_TIME_ZONE, java.util.TimeZone JavaDoc.class,
155         };
156
157     public Object JavaDoc[] getBuiltinParameters()
158     {
159         return XPATH_BUILTIN_PARAMETERS;
160     }
161
162     public JRQueryExecuter createQueryExecuter(JRDataset dataset, Map JavaDoc parameters)
163             throws JRException
164     {
165         return new JRXPathQueryExecuter(dataset, parameters);
166     }
167
168     public boolean supportsQueryParameterType(String JavaDoc className)
169     {
170         return true;
171     }
172 }
173
Popular Tags