Project

General

Profile

« Previous | Next » 

Revision 3799

Added by Jing Tao over 16 years ago

Add a new class will build query result able in advance. It has been done yet.

View differences:

src/edu/ucsb/nceas/metacat/QueryResultTableBuilder.java
1
/**
2
 *  '$RCSfile$'
3
 *    Purpose: A Class that tracks sessions for MetaCatServlet users.
4
 *  Copyright: 2000 Regents of the University of California and the
5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Matt Jones
7
 *
8
 *   '$Author$'
9
 *     '$Date$'
10
 * '$Revision$'
11
 *
12
 * This program is free software; you can redistribute it and/or modify
13
 * it under the terms of the GNU General Public License as published by
14
 * the Free Software Foundation; either version 2 of the License, or
15
 * (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU General Public License
23
 * along with this program; if not, write to the Free Software
24
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
25
 */
26
package edu.ucsb.nceas.metacat;
27

  
28
import java.util.TimerTask;
29

  
30
import org.apache.log4j.Logger;
31

  
32
/**
33
 *  QueryResutlTableBuilder is class to build xml_queryresult table during metacat initialization.
34
 *  xml_querytable is a db table to store query returnfiled value. It is a cache of resultset and 
35
 *  peformance optimization approach to replace xml_index and xml_node tables.  In metacat 1.8.0,
36
 *  xml_queryresult table is built during the first time of query hitting metacat. So first time search
37
 *  will take longer time since this search involves xml_index and xml_node tables.  In order to
38
 *  decrease the first query search time, this class will build the xml_querytable during the metacat
39
 *  intialization base on some metacat common clients' query , e.g. kepler, morpho, esa, knb, nceas,
40
 *  sanparks' regestiry.
41
 */
42
public class QueryResultTableBuilder extends TimerTask
43
{
44
	
45
	private String[] docidList = null;
46
	private String[] returnFieldList = null;
47
	private Logger logMetacat = Logger.getLogger(QueryResultTableBuilder.class);
48
	/**
49
	 * Default the constructor.  It will get doc id list from current xml_table
50
	 *
51
	 */
52
	QueryResultTableBuilder()
53
	{
54
		 docidList = getDocListFromXMLDocumentTables();
55
		 returnFieldList = getReturnFieldList();
56
	}
57
	
58
	/**
59
	 *  Constructor with given docid list
60
	 * @param docList  list of docid
61
	 */
62
	 QueryResultTableBuilder(String[] docList)
63
	 {
64
		 docidList = docList;
65
		 returnFieldList = getReturnFieldList();
66
	 }
67
	 
68
	 /**
69
	  * Builds the result table base on the given docid list and returnfields
70
	  */
71
	public void run()
72
	{
73
		buildQueryResultTable();
74
	}
75
	
76
	/*
77
	 * Build query result table.
78
	 */
79
	private void buildQueryResultTable()
80
	{
81
		if (docidList != null && returnFieldList != null )
82
		{
83
			
84
		}
85
		else
86
		{
87
			logMetacat.warn("There is no doc list or returnfFieldList. We wouldn't build queryresult table ");
88
		}
89
	}
90
	
91
	/*
92
	 * Gets return document list array from xml_documents table.
93
	 */
94
	private String[] getDocListFromXMLDocumentTables()
95
	{
96
		String[] returnDocList = null;
97
		return returnDocList;
98
	}
99
	
100
	/*
101
	 * Gets common return fields list from metacat.properties file.
102
	 */
103
	private String[] getReturnFieldList()
104
	{
105
		String[] returnField = null;
106
		return returnField;
107
		
108
	}
109

  
110
}
0 111

  

Also available in: Unified diff