source: trunk/greenstone3-extensions/vishnu/src/vishnu/server/Cluster.java@ 8189

Last change on this file since 8189 was 8189, checked in by kjdon, 20 years ago

first version of Imperial College's Visualiser code

  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/*********************************************************************
2 Copyright (C) 2003 Imperial College London
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program 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
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17***********************************************************************/
18
19package vishnu.server;
20
21import java.util.*;
22import org.apache.xpath.XPathAPI;
23import org.w3c.dom.Node;
24import org.w3c.dom.NodeList;
25import org.w3c.dom.Document;
26import org.w3c.dom.Element;
27import org.xml.sax.InputSource;
28import javax.xml.parsers.*;
29
30public class Cluster
31{
32 static{
33 System.loadLibrary("Cluster");
34 }
35
36 public Cluster()
37 {
38 }
39
40 public native String getCC(int[] i, String collection_home);
41
42 /* public String getCluster(Element request)
43 {
44 String collection = request.getAttribute("collection");
45 Node doc_list = XMLUtil.getChildByTagName(request,"documentNodeList);
46 String[] docStr = XMLUtil.getAttributeValuesFromList((Element)doc_list,"docNum");
47
48 String view = "full";
49 int[] docNums = new int[docStr.length];
50 for( int i = 0; i < docNums.length; i++ ){
51 docNums[i] = Integer.parseInt(docStr[i]);
52 }
53
54 String result = getCC(docNums,collection,view);
55 return result;
56 }
57
58 */
59 public String getCluster(String collection_home, Vector docNums)
60 {
61 int[] dn = new int[docNums.size()];
62 for( int i = 0; i < dn.length; i++ )
63 {
64 String st = String.valueOf(((Integer)docNums.elementAt(i)).intValue());
65 dn[i] = Integer.parseInt(st);
66 }
67
68 System.out.println("Calling getCC through JNI..");
69 String result = getCC(dn,collection_home);
70 //System.out.print("Results: ");
71 //System.out.println(result);
72 return result;
73 }
74}
75
Note: See TracBrowser for help on using the repository browser.