/********************************************************************* Copyright (C) 2003 Imperial College London This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ***********************************************************************/ package vishnu.server; import java.util.*; import org.apache.xpath.XPathAPI; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.InputSource; import javax.xml.parsers.*; public class Cluster { static{ System.loadLibrary("Cluster"); } public Cluster() { } public native String getCC(int[] i, String collection_home); /* public String getCluster(Element request) { String collection = request.getAttribute("collection"); Node doc_list = XMLUtil.getChildByTagName(request,"documentNodeList); String[] docStr = XMLUtil.getAttributeValuesFromList((Element)doc_list,"docNum"); String view = "full"; int[] docNums = new int[docStr.length]; for( int i = 0; i < docNums.length; i++ ){ docNums[i] = Integer.parseInt(docStr[i]); } String result = getCC(docNums,collection,view); return result; } */ public String getCluster(String collection_home, Vector docNums) { int[] dn = new int[docNums.size()]; for( int i = 0; i < dn.length; i++ ) { String st = String.valueOf(((Integer)docNums.elementAt(i)).intValue()); dn[i] = Integer.parseInt(st); } System.out.println("Calling getCC through JNI.."); String result = getCC(dn,collection_home); //System.out.print("Results: "); //System.out.println(result); return result; } }