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 |
|
---|
19 | package vishnu.server;
|
---|
20 |
|
---|
21 | import java.util.*;
|
---|
22 | import org.apache.xpath.XPathAPI;
|
---|
23 | import org.w3c.dom.Node;
|
---|
24 | import org.w3c.dom.NodeList;
|
---|
25 | import org.w3c.dom.Document;
|
---|
26 | import org.w3c.dom.Element;
|
---|
27 | import org.xml.sax.InputSource;
|
---|
28 | import javax.xml.parsers.*;
|
---|
29 |
|
---|
30 | public 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 |
|
---|