00001 package edu.stanford.hci.r3.pen.batch;
00002
00003 import java.io.BufferedWriter;
00004 import java.io.File;
00005 import java.io.FileNotFoundException;
00006 import java.io.IOException;
00007 import java.io.OutputStreamWriter;
00008 import java.io.PrintWriter;
00009 import java.net.Socket;
00010 import java.net.UnknownHostException;
00011
00012 import edu.stanford.hci.r3.util.SystemUtils;
00013
00029 public class BatchImporter {
00030 public static void main(String[] args) {
00031 PrintWriter pw = null;
00032 try {
00033 pw = new PrintWriter(new File("BatchImporter.log"));
00034 pw.println("Running the Batched Pen Data Importer");
00035 for (String arg : args) {
00036 pw.println("Argument: " + arg);
00037 }
00038
00039
00040 final Socket socket = new Socket("localhost", BatchServer.DEFAULT_PLAINTEXT_PORT);
00041 final BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(socket
00042 .getOutputStream()));
00043
00044
00045 bw.write("XML: " + args[0] + SystemUtils.LINE_SEPARATOR);
00046 bw.write(BatchServer.EXIT_COMMAND + SystemUtils.LINE_SEPARATOR);
00047 bw.flush();
00048 bw.close();
00049
00050
00051 socket.close();
00052 } catch (FileNotFoundException e) {
00053 e.printStackTrace();
00054 pw.println(e.getLocalizedMessage());
00055 } catch (UnknownHostException e) {
00056 e.printStackTrace();
00057 pw.println(e.getLocalizedMessage());
00058 } catch (IOException e) {
00059 e.printStackTrace();
00060 pw.println(e.getLocalizedMessage());
00061 }
00062 if (pw != null) {
00063 pw.flush();
00064 pw.close();
00065 }
00066 }
00067 }