From e96aa19ea301f3386b47043a435b3e0091eadbec Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 21 Mar 2006 17:18:41 +0000 Subject: [PATCH] intermediate cjeckin - nfs woes! git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@196 be28352e-c001-0410-b1a7-c7978e42abec --- src/org/vamsas/client/IClient.java | 2 + .../vamsas/client/simpleclient/ClientDocument.java | 226 ++++++++++++++------ .../vamsas/client/simpleclient/SimpleClient.java | 48 ++++- .../client/simpleclient/SimpleClientAppdata.java | 56 ++++- .../client/simpleclient/SimpleDocBinding.java | 2 + .../vamsas/client/simpleclient/SimpleDocument.java | 5 +- src/org/vamsas/objects/utils/AppDataReference.java | 19 ++ 7 files changed, 268 insertions(+), 90 deletions(-) diff --git a/src/org/vamsas/client/IClient.java b/src/org/vamsas/client/IClient.java index 51367c9..c73aaa4 100644 --- a/src/org/vamsas/client/IClient.java +++ b/src/org/vamsas/client/IClient.java @@ -83,6 +83,8 @@ public interface IClient { * New objects without provenance information will be * given a default entry using the IClient's application, * user (and session) handles + * Validity of IClientDocument object instances after this call is implementation dependent + * TODO: consider refactoring to remove the redundant IClientDocument parameter for this method */ public void updateDocument(IClientDocument newdoc); /** diff --git a/src/org/vamsas/client/simpleclient/ClientDocument.java b/src/org/vamsas/client/simpleclient/ClientDocument.java index 71365ee..6b1d7fc 100644 --- a/src/org/vamsas/client/simpleclient/ClientDocument.java +++ b/src/org/vamsas/client/simpleclient/ClientDocument.java @@ -3,22 +3,20 @@ */ package org.vamsas.client.simpleclient; -import java.util.Hashtable; import java.util.Vector; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.vamsas.client.IClient; +import org.vamsas.client.ClientHandle; import org.vamsas.client.IClientAppdata; import org.vamsas.client.IClientDocument; -import org.vamsas.client.VorbaId; import org.vamsas.client.Vobject; -import org.vamsas.objects.core.AppData; +import org.vamsas.client.VorbaId; import org.vamsas.objects.core.ApplicationData; -import org.vamsas.objects.core.User; import org.vamsas.objects.core.VAMSAS; import org.vamsas.objects.core.VamsasDocument; import org.vamsas.objects.utils.AppDataReference; +import org.vamsas.test.objects.Core; /** * Maintains a collection of vamsas objects, appdatas and states, and provides api for a SimpleClient's client. @@ -40,6 +38,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements public boolean isModified() { return isModified; } + private java.util.Hashtable objrefs=null; /** * * prepare Application-side dataset from the vamsas Document archive @@ -57,6 +56,7 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements this.sclient = sclient; archive = docHandler; this.doc = doc; + objrefs = Factory.getVorbaIdHash(); } /* @@ -65,8 +65,9 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements * @see org.vamsas.client.IClientDocument#getObject(org.vamsas.client.VorbaId) */ public Vobject getObject(VorbaId id) { - // TODO: look up id in document Vobject - // retrieve Vobject and return + if (objrefs.containsKey(id)) + return (Vobject) objrefs.get(id); + log.debug("Returning null Vobject reference for id "+id.getId()); return null; } @@ -76,8 +77,13 @@ public class ClientDocument extends org.vamsas.client.ClientDocument implements * @see org.vamsas.client.IClientDocument#getObjects(org.vamsas.client.VorbaId[]) */ public Vobject[] getObjects(VorbaId[] ids) { - // TODO: getObject in bulk - return null; + Vobject[] vo = new Vobject[ids.length]; + for (int i=0,j=ids.length; i