View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  /**
24   *
25   */
26  package com.gisgraphy.domain.valueobject;
27  
28  import org.dom4j.io.OutputFormat;
29  
30  /**
31   * @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a> Some
32   *         Constants
33   */
34  public class Constants {
35  
36      /**
37       * Default charset
38       */
39      public static final String CHARSET = "UTF-8";
40  
41      /**
42       * Default Date pattern
43       */
44      public static final String GIS_DATE_PATTERN = "yyyy-MM-dd";
45  
46      /**
47       * The field on which we want to search
48       */
49      public static final String QF_PARAMETER = "qf";
50  
51      /**
52       * The output format (XML, json,...) parameter name
53       * 
54       * @see OutputFormat
55       */
56      public final static String OUTPUT_FORMAT_PARAMETER = "wt";
57  
58      /**
59       * The XSLT stylesheet parameter name
60       * 
61       * @see OutputFormat
62       */
63      public final static String STYLESHEET_PARAMETER = "tr";
64  
65      /**
66       * The name of the XSL to apply to output ATOM format
67       * 
68       * @see OutputFormat
69       */
70      public final static String ATOM_STYLESHEET = "atom.xsl";
71  
72      /**
73       * The name of the XSL to apply to output Geo RSS format
74       * 
75       * @see OutputFormat
76       */
77      public final static String GEORSS_STYLESHEET = "georss.xsl";
78  
79      /**
80       * The field list to return (Solr parameter name)
81       */
82      public static final String FL_PARAMETER = "fl";
83      
84      /**
85       * The field list to return (Solr parameter name)
86       */
87      public static final String FQ_PARAMETER = "fq";
88  
89      /**
90       * The parameter to specifie the text to search (Solr parameter name)
91       */
92      public static final String QUERY_PARAMETER = "q";
93  
94      /**
95       * The query type parameter (dismax, standard, ...) (Solr parameter name)
96       */
97      public static final String QT_PARAMETER = "qt";
98      
99      /**
100      * The boost query type parameter 
101      */
102     public static final String BQ_PARAMETER = "bq";
103     
104     /**
105      * The boost field type parameter 
106      */
107     public static final String BF_PARAMETER = "bf";
108 
109     /**
110      * The rows parameter (useful for paginate, Solr parameter name)
111      */
112     public static final String ROWS_PARAMETER = "rows";
113 
114     /**
115      * The indent parameter (Solr parameter name)
116      */
117     public static final String INDENT_PARAMETER = "indent";
118 
119     /**
120      * The echoparam parameter (if the query parameters should be print in the
121      * response, Solr parameter name)
122      */
123     public static final String ECHOPARAMS_PARAMETER = "echoParams";
124 
125     /**
126      * The start rows parameter (useful for paginate, Solr parameter name)
127      */
128     public static final String START_PARAMETER = "start";
129     
130     /**
131      * The parameter name to active the spellchecker (Solr parameter name)
132      */
133     public static final String SPELLCHECKER_ENABLED_PARAMETER = "spellcheck";
134     
135     /**
136      * The parameter name to Rebuild the spellchecker (Solr parameter name)
137      */
138     public static final String SPELLCHECKER_BUILD_PARAMETER = "spellcheck.build";
139     
140     /**
141      * The parameter name to Rebuild the spellchecker (Solr parameter name)
142      */
143     public static final String SPELLCHECKER_RELOAD_PARAMETER = "spellcheck.reload";
144     
145     /**
146      * The parameter name to define the number of suggestion for the spellchecker (Solr parameter name)
147      */
148     public static final String SPELLCHECKER_NUMBER_OF_SUGGESTION_PARAMETER = "spellcheck.count";
149     
150     /**
151      * The parameter name to define the number of suggestion for the spellchecker (Solr parameter name)
152      */
153     public static final String SPELLCHECKER_COLLATE_RESULTS_PARAMETER = "spellcheck.collate";
154     
155     /**
156      * The parameter name to define the name of the dictionary to use for the spellchecker (Solr parameter name)
157      */
158     public static final String SPELLCHECKER_DICTIONARY_NAME_PARAMETER = "spellcheck.dictionary";
159     
160     /**
161      * The parameter name to define the query to use for the spellchecker (Solr parameter name)
162      */
163     public static final String SPELLCHECKER_QUERY_PARAMETER = "spellcheck.q";
164     
165     /**
166      * The parameter name to define the filter query to use (Solr parameter name)
167      */
168     public static final String FILTER_QUERY_PARAMETER = "fq";
169     
170     /**
171      * The parameter name to define the spatial fields (Solr parameter name)
172      */
173     public static final String SPATIAL_FIELD_PARAMETER = "sfield";
174     
175     /**
176      * The parameter name to define the point to search around (Solr parameter name)
177      */
178     public static final String POINT_PARAMETER = "pt";
179     
180     /**
181      * The parameter name to define the distance to search around (Solr parameter name)
182      */
183     public static final String DISTANCE_PARAMETER = "d";
184     
185     
186     
187 
188     /**
189      * A string that is used to load a class from a string with class.forName()
190      */
191     public static final String ENTITY_PACKAGE = "com.gisgraphy.domain.geoloc.entity.";
192 
193     /**
194      * All the Query type in the Gisgraphy solr config file
195      */
196     public enum SolrQueryType {
197 	standard, numeric, simple, deep, advanced,spellcheck,suggest
198     };
199 
200     /**
201      * The radius of the earth
202      */
203     public static final double RADIUS_OF_EARTH_IN_METERS = 6378100;
204 
205     /**
206      * An Array of the applicationContext names
207      */
208     public final static String[] APPLICATION_CONTEXT_NAMES = new String[] {
209 
210     "classpath:/applicationContext.xml",
211 	    "classpath:/applicationContext-resources.xml",
212 	    "classpath:/applicationContext-repository.xml",
213 	    "classpath:/applicationContext-geoloc.xml",
214 	    "classpath:/applicationContext-dao.xml",
215 	    "classpath:/applicationContext-service.xml",
216 	    "classpath:/WEB-INF/applicationContext-struts.xml",
217 	    "classpath:**/applicationContext*.xml" };
218     
219     /**
220      * application context files to start classpath in a non 
221      * web context, (note that : javax.servlet should be added in the classpath)
222      * then you can start 
223      * 
224      *  new ClassPathXmlApplicationContext(Constants.APPLICATION_CONTEXT_NAMES_NON_WEB);
225      */
226     public final static String[] APPLICATION_CONTEXT_NAMES_NON_WEB= new String[] {
227 
228 	    "classpath:/applicationContext.xml",
229 		    "classpath:/applicationContext-resources.xml",
230 		    "classpath:/applicationContext-repository.xml",
231 		    "classpath:/applicationContext-geoloc.xml",
232 		    "classpath:/applicationContext-dao.xml",
233 		    "classpath:/applicationContext-service.xml",
234 		    "classpath:**/applicationContext*.xml" };
235 
236     /**
237      * An Array of the ApplicationContext names for tests
238      */
239     public final static String[] APPLICATION_CONTEXT_NAMES_FOR_TEST = new String[] {
240 
241     "classpath:/applicationContext.xml",
242 	    "classpath:/applicationContext-resources.xml",
243 	    "classpath:/applicationContext-repository.xml",
244 	    "classpath:/applicationContext-geoloc.xml",
245 	    "classpath:/applicationContext-dao.xml",
246 	    "classpath:/applicationContext-service.xml",
247 	    "classpath:/WEB-INF/applicationContext-struts.xml",
248 	    "classpath:**/applicationContext*.xml",
249 	    "classpath:/applicationContext-test.xml",
250 	    "classpath:/applicationContext-dao-test.xml" };
251 
252    
253    
254     
255 
256     /**
257      * The node name for {@link StreetDistance} node in JAXB
258      */
259     public final static String STREETDISTANCE_JAXB_NAME = "result";
260 
261     
262 
263     /**
264      * The node name for {@link StreetSearchResultsDto} node in JAXB
265      */
266     public final static String STREETSEARCHRESULTSDTO_JAXB_NAME = "results";
267 
268     /**
269      * The name of the ResourceBundle used in this application
270      */
271     public static final String BUNDLE_KEY = "ApplicationResources";
272 
273     /**
274      * The name of the ResourceBundle used in this application for errors
275      */
276     public static final String BUNDLE_ERROR_KEY = "ApplicationErrorResources";
277 
278     /**
279      * The name of the ResourceBundle for Feature class / code used in this
280      * application
281      */
282     public static final String FEATURECODE_BUNDLE_KEY = "featurecodes";
283     
284     /**
285      * The name of the ResourceBundle for environement properties that hold 
286      * gisgraphy configuration
287      */
288     public static final String ENVIRONEMENT_BUNDLE_KEY = "env";
289     
290     /**
291      * The default title for the RSS/ATOM
292      */
293     public static final String FEED_TITLE = "Gisgraphy";
294     
295     /**
296      * The default Link for the RSS/ATOM
297      */
298     public static final String FEED_LINK = "http://www.gisgraphy.com";
299     
300     /**
301      * The default Description for the RSS/ATOM
302      */
303     public static final String FEED_DESCRIPTION = "Gisgraphy search";
304     
305     /**
306      * The Base URL for building GISFeature URL
307      */
308     public static final String GISFEATURE_BASE_URL = "http://services.gisgraphy.com/displayfeature.html?featureId=";
309     
310     public static final String STREET_BASE_URL = "http://services.gisgraphy.com/displaystreet.html?gid=";
311 
312    
313 
314   
315     
316     
317 
318 }