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;
appdName = "User's Appdata";
}
log.debug("getting "+appdName+" as a byte array");
- extractAppData(clientdoc.getVamsasDocument());
+ extractAppData();
AppData object;
if (!clientOrUser) {
object = appsGlobal;
}
if (log.isDebugEnabled())
log.debug("getting "+appdName+" as an input stream.");
- extractAppData(clientdoc.getVamsasDocument());
+ extractAppData();
AppData object;
if (!clientOrUser) {
object = appsGlobal;
* 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) {
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))
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))