Wednesday, October 11, 2006

CondorTest.java
The program to query the collector to get the address of the scheduler of Condor.

import condor.*;
import birdbath.*;
import java.rmi.*;
import java.io.*;
import java.net.*;
import javax.xml.rpc.*;

class CondorTest
{
public static void main(String[] arguments)
throws RemoteException, ServiceException, MalformedURLException, IOException
{
URL collectorLocation = new URL("http://gridfarm001.ucs.indiana.edu:9618");
CondorCollectorLocator collectorLocator = new CondorCollectorLocator();
CondorCollectorPortType collector = collectorLocator.getcondorCollector(collectorLocation);
ClassAdStructArray casArray = collector.queryScheddAds("HasSOAPInterface=?=TRUE");
ClassAdStruct[] casArr = casArray.getItem();
String scheddLocationStr = new String();
int i = 0;
for(i=0; i
ClassAdStructAttr[] casAttrArr = casArr[i].getItem();
for (int j=0; j
ClassAdStructAttr casAttr = casAttrArr[j];
if(casAttr.getName().equals("ScheddIpAddr")) {
scheddLocationStr=casAttr.getValue();
System.out.println(scheddLocationStr);
}
}
}
String tmpStr="http://" + scheddLocationStr.substring(1, scheddLocationStr.length()-1);
URL scheddLocation = new URL(tmpStr);
CondorScheddLocator scheddLocator = new CondorScheddLocator();
CondorScheddPortType schedd = scheddLocator.getcondorSchedd(scheddLocation);
}
}

No comments: