--- /dev/null
+/**
+ *
+ */
+package org.vamsas.test.simpleclient;
+
+import java.io.File;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.vamsas.client.ClientHandle;
+import org.vamsas.client.UserHandle;
+import org.vamsas.client.simpleclient.FileWatcher;
+import org.vamsas.client.simpleclient.SessionFile;
+import org.vamsas.client.simpleclient.VamsasArchive;
+import org.vamsas.client.simpleclient.VamsasFile;
+
+/**
+ * @author jimp
+ * test the VamsasFile routines for watching, reading and updating a vamsas document jar file.
+ */
+public class ArchiveClient {
+ Log log = LogFactory.getLog(ArchiveClient.class);
+ UserHandle user=null;
+ ClientHandle me = new ClientHandle("ArchiveClient","0.01");
+ VamsasFile vsess;
+
+ /**
+ * @param user
+ * @param vsess
+ */
+ public ArchiveClient(UserHandle user, VamsasFile vsess) {
+ super();
+ this.user = user;
+ this.vsess = vsess;
+ }
+ public ArchiveClient(String username, String organization, String vsess) {
+ super();
+ this.user = new UserHandle(username, organization);
+ try {
+ this.vsess = new VamsasFile(new File(vsess));
+ } catch (Exception e) {
+ log.error("Couldn't open session on file "+vsess,e);
+ this.vsess=null;
+ }
+ }
+ public void valid() {
+ if (vsess==null)
+ throw new Error("ArchiveClient instance is invalid!.");
+ }
+ /**
+ *
+ * @param time - length of time to watch for.
+ * @return IO interface for session document.
+ */
+ public VamsasArchive watch(long time) {
+ valid();
+ // wait around watching for a change.
+ VamsasArchive varch=null;
+ // FileWatcher w = new FileWatcher(vsess);
+ return varch;
+ }
+
+ /**
+ * @param args
+ */
+ public static void usage() {
+ throw new Error("Usage: Username Organization VamsasFile [command,args]*");
+ }
+ public static void main(String[] args) {
+ // really simple.
+ if (args.length<3)
+ usage();
+ ArchiveClient client = new ArchiveClient(args[0],args[1], args[2]);
+
+ }
+
+}