+ protected boolean updateSessionDocument() throws java.io.IOException {
+ if (!isModified() && !scappd.isModified())
+ return false;
+ VamsasSession session = sclient._session;
+ log.debug("updating Session Document in "+session.sessionDir);
+ // update the VamsasDocument structure with any new appData's.
+ // try to update the sessionFile
+ log.debug("Attempting to update session "+sclient.session.getSessionUrn());
+ if (scappd.isModified()) {
+ ClientHandle client = sclient.client;
+ scappd.closeForWriting();
+ long newAppd = scappd.newAppData.sessionFile.length();
+
+ if (scappd.appsGlobal==null) {
+ ApplicationData appd = scappd.appsGlobal = new ApplicationData();
+ appd.setName(client.getClientName());
+ appd.setUrn(client.getClientUrn());
+ appd.setVersion(client.getVersion());
+ doc.addApplicationData(appd);
+ // embed or jarEntry ? - for now only jarEntry's are dealt with.
+ appd.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()));
+ }
+ if (scappd.newAppData!=null && scappd.newAppData.sessionFile.exists()) {
+ if (scappd.appsGlobal.getData()!=null) {
+ scappd.appsGlobal.setData(null);
+ scappd.appsGlobal.setDataReference(AppDataReference.uniqueAppDataReference(doc, sclient.client.getClientUrn()));
+ }
+
+
+
+ }
+ if (scappd.usersData==null) {
+
+ }
+
+ }
+ cdocument.archive.putVamsasDocument(vdoc);
+ // write the appHandle to the lastupdate file.
+ }
+ if (scappd!=null) {
+ if (scappd.accessedDocument)
+ }
+ va = new org.vamsas.client.simpleclient.VamsasArchive(newf, false, true, sfile);
+ doc = va.getVamsasDocument();
+ doc.addVAMSAS(Core.getDemoVamsas());
+ doc.addApplicationData(makeDemoAppdata(va,
+ "org.vamsas.test.simpleclient.VamsasArchive", "another old Bugger esq", "rescinded"));
+ if (va.transferRemainingAppDatas())
+ log.info("Remain appdatas were transferred.");
+ else
+ log.warn("No appdatas were transferred. This is wrong.");
+ va.putVamsasDocument(doc);
+ va.closeArchive();
+
+ return true; // successfully updated.
+ }
+ /* (non-Javadoc)
+ * @see java.lang.Object#finalize()
+ */
+ protected void finalize() throws Throwable {
+ log.debug("Garbage collecting on ClientDocument instance.");
+ if (scappd!=null) {
+ scappd.finalize();
+ scappd = null;
+ }
+ // TODO local garbage collection
+ super.finalize();
+ }
+