From: jprocter Date: Fri, 31 Aug 2007 13:10:09 +0000 (+0000) Subject: bugfix for new appdata writes not overwriting existing appdata if the client has... X-Git-Tag: Release_0.2~68 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=533a6cb86d1320e850a081a8e8889c90c0ebdb1b;p=vamsas.git bugfix for new appdata writes not overwriting existing appdata if the client has not checked for their existence or accessed them. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@452 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/packages/vamsas-client.jar b/packages/vamsas-client.jar index 61be668..cb1ebb4 100644 Binary files a/packages/vamsas-client.jar and b/packages/vamsas-client.jar differ diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java b/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java index ececd9e..7ea7dda 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleClientAppdata.java @@ -86,10 +86,19 @@ public class SimpleClientAppdata implements IClientAppdata { this.clientdoc = clientdoc; } /** + * ensures that the appData information for this client + * instance has been extracted from the vamsas document provided by clientdoc. + */ + private void extractAppData() + { + if (!accessedDocument) + _extractAppData(clientdoc.getVamsasDocument()); + } + /** * gets appropriate app data for the application, if it exists in this dataset * Called by every accessor to ensure data has been retrieved from document. */ - private void extractAppData(uk.ac.vamsas.objects.core.VamsasDocument doc) { + private void _extractAppData(uk.ac.vamsas.objects.core.VamsasDocument doc) { if (doc==null) { log.debug("extractAppData called for null document object"); return; @@ -238,7 +247,7 @@ public class SimpleClientAppdata implements IClientAppdata { appdName = "User's Appdata"; } log.debug("getting "+appdName+" as a byte array"); - extractAppData(clientdoc.getVamsasDocument()); + extractAppData(); AppData object; if (!clientOrUser) { object = appsGlobal; @@ -271,7 +280,7 @@ public class SimpleClientAppdata implements IClientAppdata { } if (log.isDebugEnabled()) log.debug("getting "+appdName+" as an input stream."); - extractAppData(clientdoc.getVamsasDocument()); + extractAppData(); AppData object; if (!clientOrUser) { object = appsGlobal; @@ -315,6 +324,8 @@ public class SimpleClientAppdata implements IClientAppdata { * methods for writing new AppData entries. */ private AppDataOutputStream _getAppdataOutputStream(boolean clientOrUser) { + // Must access document to get any existing references + extractAppData(); String apdname; SessionFile apdfile=null; if (!clientOrUser) { @@ -432,7 +443,7 @@ public class SimpleClientAppdata implements IClientAppdata { public boolean hasClientAppdata() { if (clientdoc==null) throw new Error("Implementation error, Improperly initialized SimpleClientAppdata."); - extractAppData(clientdoc.getVamsasDocument()); + extractAppData(); // LATER - check validity of a DataReference before we return true // TODO: return true if usersData is null but we have already written a new data stream if ((appsGlobal!=null) && (appsGlobal.getDataReference()!=null || appsGlobal.getData()!=null)) @@ -446,7 +457,7 @@ public class SimpleClientAppdata implements IClientAppdata { public boolean hasUserAppdata() { if (clientdoc==null) throw new Error("Implementation error, Improperly initialized SimpleClientAppdata."); - extractAppData(clientdoc.getVamsasDocument()); + extractAppData(); // LATER - check validity of a DataReference before we return true // TODO: return true if usersData is null but we have already written a new data stream if ((usersData!=null) && (usersData.getDataReference()!=null || usersData.getData()!=null))