Project

General

Profile

« Previous | Next » 

Revision 8163

Added by Jing Tao almost 11 years ago

If the xpath query is disabled, the query, squery and spatial_query action will be disabled as well.

View differences:

src/edu/ucsb/nceas/metacat/DBQuery.java
62 62

  
63 63
import org.apache.commons.lang.StringEscapeUtils;
64 64
import org.apache.log4j.Logger;
65
import org.dataone.service.exceptions.NotImplemented;
65 66

  
67
import edu.ucsb.nceas.metacat.common.query.EnabledQueryEngines;
66 68
import edu.ucsb.nceas.metacat.database.DBConnection;
67 69
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
68 70
import edu.ucsb.nceas.metacat.properties.PropertyService;
71
import edu.ucsb.nceas.metacat.shared.HandlerException;
69 72
import edu.ucsb.nceas.metacat.util.AuthUtil;
70 73
import edu.ucsb.nceas.metacat.util.DocumentUtil;
71 74
import edu.ucsb.nceas.metacat.util.MetacatUtil;
......
305 308
   * @param user the user name (it maybe different to the one in param)
306 309
   * @param groups the group array
307 310
   * @param sessionid  the sessionid
311
 * @throws NotImplemented 
308 312
   */
309 313
  public void findDocuments(HttpServletResponse response,
310 314
                                       Writer out, Hashtable params,
......
327 331
     * @param groups the group array
328 332
     * @param sessionid  the sessionid
329 333
     */
330
    public void findDocuments(HttpServletResponse response,
334
    private void findDocuments(HttpServletResponse response,
331 335
                                         Writer out, Hashtable params,
332 336
                                         String user, String[] groups,
333
                                         String sessionid, boolean useXMLIndex)
334
    {
337
                                         String sessionid, boolean useXMLIndex) {
338
      if(!EnabledQueryEngines.getInstance().isEnabled(EnabledQueryEngines.PATHQUERYENGINE)) {
339
          try {
340
              String output = "";
341
              output += "<?xml version=\"1.0\"?>";
342
              output += "<error>";
343
              output += "The Metacat Path Query is turned off. If you want to turn it on, please contact the administrator.";
344
              output += "</error>";
345
              out.write(output);
346
              out.close();
347
          } catch (IOException e) {
348
              logMetacat.warn("DBQuery.findDocuments - metacat can't write the message that the pathquery is off to the client since :"+e.getMessage());
349
          } 
350
          return;
351
      }
335 352
      int pagesize = 0;
336 353
      int pagestart = 0;
337 354
      long transferWarnLimit = 0; 

Also available in: Unified diff