Project

General

Profile

« Previous | Next » 

Revision 3257

Added by berkley over 17 years ago

updated the kepler skin to use paging. need to do a bit more work on this to make it behave more like other web applications

View differences:

lib/log4j.properties
33 33
################################################################################
34 34

  
35 35
# set the log level to WARN and the log should be printed to stdout. 
36
log4j.rootLogger=INFO, stdout
36
log4j.rootLogger=WARN, stdout
37 37
#log4j.threshold=FATAL, ERROR, WARN, INFO
38 38

  
39 39

  
lib/web.xml.tomcat5
125 125
    <servlet-class>edu.ucsb.nceas.metacat.spatial.SldFactory</servlet-class>
126 126
  </servlet>
127 127

  
128
   <servlet>
128
   <!--<servlet>
129 129
      <servlet-name>gwt</servlet-name>
130 130
      <servlet-class>org.kepler.web.service.KeplerServiceServlet</servlet-class>
131 131
      <init-param>
......
137 137
        <param-value>true</param-value>
138 138
      </init-param>
139 139
      <load-on-startup>2</load-on-startup>
140
    </servlet>
140
    </servlet>-->
141 141

  
142 142

  
143 143
    <servlet>
......
248 248
    <load-on-startup>100</load-on-startup>
249 249
  </servlet>
250 250

  
251
  <servlet-mapping>
251
  <!--<servlet-mapping>
252 252
        <servlet-name>gwt</servlet-name>
253 253
        <url-pattern>/gwt</url-pattern>
254
    </servlet-mapping>
254
    </servlet-mapping>-->
255 255
  
256 256
    <servlet-mapping>
257 257
        <servlet-name>metacat</servlet-name>
lib/style/skins/kepler/resultset.xsl
129 129
        </script>
130 130

  
131 131
        <div class="body">
132
          <p class="emphasis">
133
            <xsl:number value="count(resultset/document)" /> components found
134
          </p>
132
          <xsl:if test="/resultset/pagesize = 0">
133
            <p class="emphasis">
134
              <xsl:number value="count(resultset/document)" /> components found
135
            </p>
136
          </xsl:if>
137
          
138
          <xsl:if test="/resultset/pagesize &gt; 0">
139
          <table cellspacing="0" cellpadding="0" style="width: 100%;">
140
          <tr>
141
          <td>
142
          <xsl:if test="/resultset/previouspage != -1">
143
            <div class="emphasis">
144
              <a style="font-size: smaller;">
145
                        <xsl:attribute name="href">
146
                          <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
147
                          
148
                          <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
149
                            <xsl:text>&amp;anyfield=</xsl:text>
150
                            <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
151
                          </xsl:if>
152
                          
153
                          <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
154
                            <xsl:text>&amp;anyfield=%25</xsl:text>
155
                          </xsl:if>
156
                          
157
                          <xsl:text>&amp;qformat=</xsl:text>
158
                          <xsl:value-of select="$qformat"/>
159
                          
160
                          <xsl:text>&amp;sessionid=</xsl:text>
161
                          <xsl:value-of select="$sessid"/>
162
                          
163
                          <xsl:for-each select="/resultset/query/pathquery/returndoctype">
164
                            <xsl:text>&amp;returndoctype=</xsl:text>
165
                            <xsl:value-of select="."/>
166
                          </xsl:for-each>
167
                          
168
                          <xsl:for-each select="/resultset/query/pathquery/returnfield">
169
                            <xsl:text>&amp;returnfield=</xsl:text>
170
                            <xsl:value-of select="."/>
171
                          </xsl:for-each>
172
                          
173
                          <xsl:text>&amp;pagestart=</xsl:text>
174
                          <xsl:value-of select="/resultset/previouspage"/>
175
                          
176
                          <xsl:text>&amp;pagesize=</xsl:text>
177
                          <xsl:value-of select="/resultset/pagesize"/>
178
                        </xsl:attribute>
179
  
180
                        <xsl:text>Previous Page</xsl:text>
181
                      </a>
182
            </div>
183
          </xsl:if>
184
          </td>
135 185

  
186
          <td>
187
          <div class="emphasis">
188
            <a style="font-size: smaller;">
189
                      <xsl:attribute name="href">
190
                        <xsl:text>metacat?action=query&amp;operator=INTERSECT&amp;enableediting=false</xsl:text>
191
                        
192
                        <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &gt; 0">
193
                          <xsl:text>&amp;anyfield=</xsl:text>
194
                          <xsl:value-of select="/resultset/query/pathquery/querygroup/queryterm/value"/>
195
                        </xsl:if>
196
                        
197
                        <xsl:if test="count(/resultset/query/pathquery/querygroup/queryterm/value) &lt;= 0">
198
                          <xsl:text>&amp;anyfield=%25</xsl:text>
199
                        </xsl:if>
200
                        
201
                        <xsl:text>&amp;qformat=</xsl:text>
202
                        <xsl:value-of select="$qformat"/>
203
                        
204
                        <xsl:text>&amp;sessionid=</xsl:text>
205
                        <xsl:value-of select="$sessid"/>
206
                        
207
                        <xsl:for-each select="/resultset/query/pathquery/returndoctype">
208
                          <xsl:text>&amp;returndoctype=</xsl:text>
209
                          <xsl:value-of select="."/>
210
                        </xsl:for-each>
211
                        
212
                        <xsl:for-each select="/resultset/query/pathquery/returnfield">
213
                          <xsl:text>&amp;returnfield=</xsl:text>
214
                          <xsl:value-of select="."/>
215
                        </xsl:for-each>
216
                        
217
                        <xsl:text>&amp;pagestart=</xsl:text>
218
                        <xsl:value-of select="/resultset/nextpage"/>
219
                        
220
                        <xsl:text>&amp;pagesize=</xsl:text>
221
                        <xsl:value-of select="/resultset/pagesize"/>
222
                      </xsl:attribute>
223

  
224
                      <xsl:text>Next Page</xsl:text>
225
                    </a>
226
          </div>
227
          </td>
228
          </tr>
229
          </table>
230
          </xsl:if>
231
          
136 232
          <!-- This tests to see if there are returned documents,
137 233
              if there are not then don't show the query results -->
138 234

  
lib/style/skins/kepler/index.html
63 63
  <input name="qformat" value="kepler" type="hidden">
64 64
  <input name="enableediting" value="false" type="hidden">
65 65
  <input name="operator" value="UNION" type="hidden">
66
  <input name="pagesize" value="10" type="hidden">
67
  <input name="pagestart" value="0" type="hidden">
66 68
  <input name="returnfield" value="entity/@name" type="hidden">
67 69
  <input name="returnfield" value="entity/property[@name='karId']/@value" type="hidden">
68 70
  <input name="returnfield" value="entity/property[@name='documentation']/property[@name='author']/configure" type="hidden">
......
81 83
      </menu>
82 84
  <p>&nbsp;</p>
83 85
  <li>
84
  <a href="@servlet-path@?action=query&operator=INTERSECT&qformat=kepler&enableediting=false&operator=UNION&returnfield=entity%2F%40name&returnfield=entity%2Fproperty%5B%40name%3D%27karId%27%5D%2F%40value&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27author%27%5D%2Fconfigure&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27version%27%5D%2Fconfigure&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27description%27%5D%2Fconfigure&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27userLevelDocumentation%27%5D%2Fconfigure&returndoctype=entity&returndoctype=kepler%3A%2F%2Fkepler-project.org%2Fkepler-moml-1.0.0">Browse existing Kepler analytical components</a>
86
  <a href="@servlet-path@?action=query&qformat=kepler&enableediting=false&operator=UNION&returnfield=entity%2F%40name&returnfield=entity%2Fproperty%5B%40name%3D%27karId%27%5D%2F%40value&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27author%27%5D%2Fconfigure&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27version%27%5D%2Fconfigure&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27description%27%5D%2Fconfigure&returnfield=entity%2Fproperty%5B%40name%3D%27documentation%27%5D%2Fproperty%5B%40name%3D%27userLevelDocumentation%27%5D%2Fconfigure&returndoctype=entity&returndoctype=kepler%3A%2F%2Fkepler-project.org%2Fkepler-moml-1.0.0&pagestart=0&pagesize=10">Browse existing Kepler analytical components</a>
85 87
  <br />
86 88
    <menu>
87 89
    Browse all existing data sets by title.  This operation can slow as the
lib/metacat.properties
239 239
# End of Harvester properties
240 240

  
241 241
######## Spatial section              #########################################
242
runSpatialOption=true
243
regenerateCacheOnRestart=true
242
runSpatialOption=false
243
regenerateCacheOnRestart=false
244 244

  
245 245
# Comma-seperated list of schemas containing spatial bounding boxes
246 246
# name corresponds to the docname stored in xml_documents table
src/edu/ucsb/nceas/metacat/DBQuery.java
302 302
      else
303 303
      {
304 304
        //knb format, in this case we will get whole result and sent it out
305
    	response.setContentType("text/html");
305
        response.setContentType("text/html");
306 306
        PrintWriter nonout = null;
307 307
        StringBuffer xml = createResultDocument(xmlquery, qspec, nonout, user,
308 308
                                                groups, useXMLIndex, pagesize, 
......
311 311
        //transfer the xml to html
312 312
        try
313 313
        {
314
         double startHTMLTransform = System.currentTimeMillis()/1000;
314

  
315 315
         DBTransform trans = new DBTransform();
316 316
         response.setContentType("text/html");
317 317

  
......
324 324
         trans.transformXMLDocument(xml.toString(), "-//NCEAS//resultset//EN",
325 325
                                 "-//W3C//HTML//EN", qformat, out, params,
326 326
                                 sessionid);
327
         double endHTMLTransform = System.currentTimeMillis()/1000;
328
         logMetacat.warn("The time for transfering resultset from xml to html format is "
329
        		                             +(endHTMLTransform -startHTMLTransform));
327

  
330 328
        }
331 329
        catch(Exception e)
332 330
        {
......
390 388
    
391 389
    resultset.append("<?xml version=\"1.0\"?>\n");
392 390
    resultset.append("<resultset>\n");
391
    resultset.append("  <pagestart>" + pagestart + "</pagestart>\n");
392
    resultset.append("  <pagesize>" + pagesize + "</pagesize>\n");
393
    resultset.append("  <nextpage>" + (pagestart + 1) + "</nextpage>\n");
394
    resultset.append("  <previouspage>" + (pagestart - 1) + "</previouspage>\n");
395

  
393 396
    resultset.append("  <query>" + xmlquery + "</query>");
394 397
    //send out a new query
395 398
    if (out != null)
......
455 458
                                      int pagesize, int pagestart, String sessionid)
456 459
                                      throws Exception
457 460
    {
458
      double startSelectionTime = System.currentTimeMillis()/1000;
459 461
      String query = null;
460 462
      int count = 0;
461 463
      int index = 0;
......
533 535
      rs = pstmt.executeQuery();
534 536

  
535 537
      double queryExecuteTime = System.currentTimeMillis() / 1000;
536
      logMetacat.warn("Time to execute select docid query is "
538
      logMetacat.warn("Time to execute query: "
537 539
                    + (queryExecuteTime - startTime));
538 540

  
539 541
      boolean tableHasRows = rs.next();
......
546 548
      
547 549
      int currentIndex = 0;
548 550
      while (tableHasRows)
549
      //for(int z=pagestart * pagesize; z<(pagesize * pagestart) + pagesize;)
550 551
      {
551 552
        logMetacat.warn("############getting result: " + currentIndex);
552 553
        docid = rs.getString(1).trim();
......
565 566
             && !qspec.isPercentageSearch())
566 567
         {
567 568
           logMetacat.warn("Back tracing now...");
568
           double startBackTracingTime = System.currentTimeMillis()/1000;
569 569
           String sep = MetaCatUtil.getOption("accNumSeparator");
570 570
           StringBuffer btBuf = new StringBuffer();
571 571
           btBuf.append("select docid from xml_relation where ");
......
592 592
            npstmt.execute();
593 593
            ResultSet btrs = npstmt.getResultSet();
594 594
            boolean hasBtRows = btrs.next();
595
            Hashtable list = new Hashtable();
596 595
            while (hasBtRows)
597 596
            {
598 597
               //there was a backtrackable document found
......
627 626
                if (docid_org == null)
628 627
                {
629 628
                   logMetacat.info("Docid_org was null.");
630
                   hasBtRows = btrs.next();
631
                   continue;
629
                   //continue;
632 630
                }
633 631
                docid = docid_org.trim();
634
                if (list.containsKey(docid))
635
                {
636
                	logMetacat.info("DocumentResultSet already has docid "+docid+" and skip it");
637
                    hasBtRows = btrs.next();
638
                    continue;
639
                }
640 632
                docname = xmldoc.getDocname();
641 633
                doctype = xmldoc.getDoctype();
642 634
                createDate = xmldoc.getCreateDate();
......
668 660
                // Store the document id and the root node id
669 661
                docListResult.addResultDocument(
670 662
                  new ResultDocument(docid, (String) document.toString()));
671
                list.put(docid, docid);
672 663
                currentIndex++;
673 664
                logMetacat.warn("$$$$$$$real result: " + docid);
674 665
                count++;
......
678 669
              }//while
679 670
              npstmt.close();
680 671
              btrs.close();
681
              double endBackTracingTime = System.currentTimeMillis()/1000;
682
              logMetacat.warn("Back tracing time for one doc is "+
683
            		               (endBackTracingTime - startBackTracingTime));
684 672
        }
685 673
        else if (returndocVec.size() == 0 || returndocVec.contains(doctype))
686 674
        {
......
751 739
     
752 740
     rs.close();
753 741
     pstmt.close();
754
     double docListTime = System.currentTimeMillis() / 1000;
755
     logMetacat.warn("======Total time to get docid list is: "
756
                    + (docListTime - startSelectionTime ));
757 742
     //if docListResult is not empty, it need to be sent.
758 743
     if (docListResult.size() != 0)
759 744
     {
760 745
       handleSubsetResult(qspec,resultsetBuffer, out, docListResult,
761 746
                              user, groups,dbconn, useXMLIndex);
762
       double returnFieldTime = System.currentTimeMillis() / 1000;
763
       logMetacat.warn("======Total time to get return fields is: "
764
                      + (returnFieldTime - docListTime));
765 747
     }
766
     
748
     double docListTime = System.currentTimeMillis() / 1000;
749
     logMetacat.warn("prepare docid list time: "
750
                    + (docListTime - queryExecuteTime));
767 751

  
768 752
     return resultsetBuffer;
769 753
    }//findReturnDoclist
......
783 767
     
784 768
     // check if there is a record in xml_returnfield
785 769
     // and get the returnfield_id and usage count
786
    double startGetReturnValueFromQueryresultable = System.currentTimeMillis()/1000;
787 770
     int usage_count = getXmlReturnfieldsTableId(qspec, dbconn);
788 771
     boolean enterRecords = false;
789 772

  
......
797 780
     if(usage_count > count){
798 781
         enterRecords = true;
799 782
     }
800
     
783

  
801 784
     if(returnfield_id < 0){
802 785
         logMetacat.warn("Error in getting returnfield id from"
803 786
                                  + "xml_returnfield table");
......
809 792
     logMetacat.info("size of partOfDoclist before"
810 793
                             + " docidsInQueryresultTable(): "
811 794
                             + partOfDoclist.size());
812
     
813 795
     Hashtable queryresultDocList = docidsInQueryresultTable(returnfield_id,
814 796
                                                        partOfDoclist, dbconn);
815 797

  
......
818 800
     while (_keys.hasMoreElements()){
819 801
         partOfDoclist.remove((String)_keys.nextElement());
820 802
     }
821
     double endGetReturnValueFromQueryresultable = System.currentTimeMillis()/1000;
822
     logMetacat.warn("Time to get return fields from xml_queryresult table is (Part1 in return fields) " +
823
    		               (endGetReturnValueFromQueryresultable-startGetReturnValueFromQueryresultable));
803

  
824 804
     // backup the keys-elements in partOfDoclist to check later
825 805
     // if the doc entry is indexed yet
826 806
     Hashtable partOfDoclistBackup = new Hashtable();
......
837 817
     //add return fields for the documents in partOfDoclist
838 818
     partOfDoclist = addReturnfield(partOfDoclist, qspec, user, groups,
839 819
                                        dbconn, useXMLIndex);
840
     double endExtendedQuery = System.currentTimeMillis()/1000;
841
     logMetacat.warn("Time to get return fields through execute extended query (Part2 in return fields) "
842
    		                                          + (endExtendedQuery - endGetReturnValueFromQueryresultable));
843 820
     //add relationship part part docid list for the documents in partOfDocList
844 821
     partOfDoclist = addRelationship(partOfDoclist, qspec, dbconn, useXMLIndex);
845 822

  
846
     double startStoreReturnField = System.currentTimeMillis()/1000;
823

  
847 824
     Iterator keys = partOfDoclist.getDocids();
848 825
     String key = null;
849 826
     String element = null;
......
875 852
             pstmt.execute();
876 853
             pstmt.close();
877 854
         }
878
         
855

  
879 856
         // A string with element
880 857
         String xmlElement = "  <document>" + element + "</document>";
881
        
858

  
882 859
         //send single element to output
883 860
         if (out != null)
884 861
         {
......
886 863
         }
887 864
         resultset.append(xmlElement);
888 865
     }//while
889
     double endStoreReturnField = System.currentTimeMillis()/1000;
890
     logMetacat.warn("Time to store new return fields into xml_queryresult table (Part4 in return fields) "
891
             + (endStoreReturnField -startStoreReturnField));
892 866

  
867

  
893 868
     Enumeration keysE = queryresultDocList.keys();
894 869
     while (keysE.hasMoreElements())
895 870
     {
......
1121 1096
            tableHasRows = rs.next();
1122 1097
          }*/
1123 1098

  
1124
          /* double extendedAccessQueryEnd = System.currentTimeMillis() / 1000;
1099
           double extendedAccessQueryEnd = System.currentTimeMillis() / 1000;
1125 1100
           logMetacat.info( "Time for execute access extended query: "
1126
                          + (extendedAccessQueryEnd - extendedQueryStart));*/
1101
                          + (extendedAccessQueryEnd - extendedQueryStart));
1127 1102

  
1128 1103
           String extendedQuery =
1129 1104
               qspec.printExtendedSQL(doclist.toString(), useXMLIndex);
......
1137 1112
               rs = pstmt.getResultSet();
1138 1113
               double extendedQueryEnd = System.currentTimeMillis() / 1000;
1139 1114
               logMetacat.info(
1140
                   "Time to execute extended query: "
1115
                   "Time for execute extended query: "
1141 1116
                   + (extendedQueryEnd - extendedQueryStart));
1142 1117
               tableHasRows = rs.next();
1143 1118
               while (tableHasRows) {
......
1211 1186
               } //while
1212 1187
               double docListResultEnd = System.currentTimeMillis() / 1000;
1213 1188
               logMetacat.warn(
1214
                   "Time for prepare ResultDocumentSet after"
1215
                   + " executing extended query: "
1189
                   "Time for prepare doclistresult after"
1190
                   + " execute extended query: "
1216 1191
                   + (docListResultEnd - extendedQueryEnd));
1217 1192
           }
1218 1193

  
......
1239 1214
    StringBuffer document = null;
1240 1215
    double startRelation = System.currentTimeMillis() / 1000;
1241 1216
    Iterator docidkeys = docListResult.getDocids();
1242
    //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!1beofre the while loop the docid keys is "+docidkeys);
1243 1217
    while (docidkeys.hasNext())
1244 1218
    {
1245 1219
      //String connstring =
1246 1220
      // "metacat://"+util.getOption("server")+"?docid=";
1247 1221
      String connstring = "%docid=";
1248
      //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!1beofre the null line the docid keys is "+docidkeys);
1249
      String docidkey = (String) docidkeys.next();
1250
      //System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!1after the null line the docid string is "+docidkey);
1222
      String docidkey;
1223
      synchronized(docListResult)
1224
      {
1225
        docidkey = (String) docidkeys.next();
1226
      }
1251 1227
      pstmt = dbconn.prepareStatement(QuerySpecification
1252 1228
                      .printRelationSQL(docidkey));
1253 1229
      pstmt.execute();
......
1289 1265
      pstmt.close();
1290 1266
    }//while
1291 1267
    double endRelation = System.currentTimeMillis() / 1000;
1292
    logMetacat.info("Time to add relationship to return fields (part 3 in return fields): "
1268
    logMetacat.info("Time for adding relation to docListResult: "
1293 1269
                             + (endRelation - startRelation));
1294 1270

  
1295 1271
    return docListResult;

Also available in: Unified diff