package client; import org.gridforum.ogsi.OGSIServiceGridLocator; import org.gridforum.ogsi.GridService; import org.gridforum.ogsi.ExtensibilityType; import org.gridforum.ogsi.ServiceDataValuesType; import org.globus.ogsa.utils.AnyHelper; import org.globus.ogsa.utils.QueryHelper; import Calc.service.CalcServiceGridLocator; import Calc.CalcPortType; import Calc.CalcData.CalcDataType; import java.net.URL; public class CalcClient { public static void main(String[] args) { try { // Get command-line arguments URL GSH = new java.net.URL(args[0]); //int a = Integer.parseInt(args[1]); //int b = Integer.parseInt(args[2]); // Get a reference to the Math PortType CalcServiceGridLocator calcServiceLocator = new CalcServiceGridLocator(); CalcPortType calc = calcServiceLocator.getCalcServicePort(GSH); // Get a reference to the GridService PortType OGSIServiceGridLocator locator = new OGSIServiceGridLocator(); GridService gridService = locator.getGridServicePort(GSH); // Get Service Data Element "MathData" ExtensibilityType extensibility = gridService.findServiceData(QueryHelper.getNamesQuery("CalcData")); ServiceDataValuesType serviceData = AnyHelper.getAsServiceDataValues(extensibility); CalcDataType calcData = (CalcDataType) AnyHelper.getAsSingleObject(serviceData, CalcDataType.class); // Write service data System.out.println("Version: " + calcData.getVersion()); System.out.println("Author: " + calcData.getAuthor()); System.out.println("Previous operation: " + calcData.getLastOp()); System.out.println("# of operations: " + calcData.getNumOps()); // Call remote method //int sum = math.add(a,b); // Print result //System.out.println(a + " + " + b + " = " + sum); }catch(Exception e) { System.out.println("ERROR!"); e.printStackTrace(); } } }