package org.autoplot.hapi; import java.io.IOException; import java.io.InputStream; import java.net.URL; /** * The Connection implementation wraps the command line version * of cache-tools. * @author jbf */ public class HapiCacheConnection extends Connection { Process p; public HapiCacheConnection( URL url ) throws IOException { super(url); String scommand = "java -jar /home/jbf/ct/hapi/git/cache-tools/java/dist/cache-tools.jar" + " --fetchOnce --cache-dir=/home/jbf/hapi-cache/ --url="+url; String[] command= scommand.split("\\s+"); p= new ProcessBuilder(command).start(); } @Override InputStream getInputStream() throws IOException { return p.getInputStream(); } @Override InputStream getErrorStream() throws IOException { return p.getErrorStream(); } @Override int getResponseCode() throws IOException { return 200; } @Override String getResponseMessage() throws IOException { return ""; } @Override void disconnect() { p.destroy(); } }