Might save someone an hour or so. Just a simple Java class to invoke the command-line xgrid client on OS X. You can add files to send with the job. There's a pure java xgridclient library but it seems to leak a thread every time a job is submitted (somewhere in the BEEP implementation). I emailed the author but got no reply so I wrote this simple class to invoke Apple's client.
Usage example:
XGridJob job = new XGridJob("host.domain",
"script.sh");
job.addFile(new File("script.sh"));
job.submit();
while (!job.resultsAvailable()) {
Thread.sleep(500);
}
String results = job.getResults();
job.dispose();