latest schema.
[vamsas.git] / src / org / vamsas / client / SimpleClientFactory.java
index 5a53bd2..5b9346f 100644 (file)
@@ -1,28 +1,38 @@
 package org.vamsas.client;
+
+import java.io.File;
+import java.io.IOException;
+
 /**
  * TODO document type SimpleClientFactory
  * @author jimp
  *
  */
 public class SimpleClientFactory implements IClientFactory {
-  static SimpleClientFactory singleton = null;
-
-  static private void CreateClientFactory() {
-    if (singleton != null) {
-
-    } else {
-      // Create singleton class.
-
-    }
+  File sessionArena;
+  
+  /**
+   * default constructor - called by CreateClientFactory only.
+   *
+   */
+  public SimpleClientFactory() {
+    sessionArena = null;
   }
   /**
    * Create a client factory that works with sessions at the given
    * path.
    * @param path
    */
-  public SimpleClientFactory(String path) {
+  public SimpleClientFactory(String path) throws IOException {
     // Check path is valid and read/writeable.
-    // make housekeeping files...
+    File newarena = new File(path);
+    if (newarena.isDirectory() && newarena.canRead() && newarena.canWrite()) {
+      sessionArena = newarena;
+    } else {
+      sessionArena = null;
+      throw(new IOException("Cannot read and write to a directory called "+path));
+    }
   }
   /* (non-Javadoc)
    * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle)