started on ClientDocument implementation and Locked IO tests for VamsasArchive
[vamsas.git] / src / org / vamsas / client / simpleclient / ClientDocument.java
index 05fe494..3e5fcfa 100644 (file)
@@ -16,16 +16,11 @@ import org.vamsas.objects.core.VamsasDocument;
  * @author jimp Contains a collection of vamsas objects and reference to a
  *         specified ClientHandle's information.
  */
-public class ClientDocument implements IClientDocument {
+public class ClientDocument extends org.vamsas.client.ClientDocument implements IClientDocument {
   protected IClient vorba;
   protected org.vamsas.objects.core.VAMSAS[] roots;
   protected byte[] appData;
-
-  /**
-   * collection of org.vamsas.client.object references
-   */
-  protected Hashtable vamsasObjects;
-  
+  protected VamsasArchive archive = null;
   /*
    * (non-Javadoc)
    * 
@@ -33,18 +28,12 @@ public class ClientDocument implements IClientDocument {
    */
 
   /**
-   * 
-   * @param data
-   * @param doc
-   * @param objects
-   * @param vorba
    */
-  protected ClientDocument(byte[] data, VAMSAS[] roots, Hashtable objects, IClient vorba) {
-    // TODO Auto-generated constructor stub
-    appData = data;
-    this.roots =roots;
-    vamsasObjects = objects;
+  protected ClientDocument(VamsasArchive document, IdFactory Factory, IClient vorba) {
+    super(Factory.getVorbaIdHash(), Factory);
     this.vorba = vorba;
+    archive = document;
+    roots = null;
   }
 
   public byte[] getApplicationData() {
@@ -148,12 +137,10 @@ public class ClientDocument implements IClientDocument {
 /*
    * (non-Javadoc)
    * 
-   * @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.object)
+   * @see org.vamsas.client.IClientDocument#setApplicationData(byte[])
    */
-public VorbaId registerObject(object unregistered) {
-    if (!unregistered.isRegistered())
-      unregistered.setVorbaId(unregistered.__vorba.makeVorbaId());
-    return unregistered.getVorbaId();
+  public void setApplicationData(byte[] newData) {
+    appData = newData;
   }
   /*
    * (non-Javadoc)
@@ -170,12 +157,11 @@ public VorbaId registerObject(object unregistered) {
     return null;
   }
 
-  /*
-   * (non-Javadoc)
-   * 
-   * @see org.vamsas.client.IClientDocument#setApplicationData(byte[])
+  /* (non-Javadoc)
+   * @see org.vamsas.client.IClientDocument#registerObject(org.vamsas.client.object)
    */
-  public void setApplicationData(byte[] newData) {
-    appData = newData;
+  public VorbaId registerObject(object unregistered) {
+    // TODO: add provenance stuff to newly registered object
+    return _registerObject(unregistered);
   }
 }