import java.io.DataInputStream;
import java.io.DataOutput;
import java.io.DataOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.util.Vector;
import java.util.jar.JarEntry;
*/
SessionFile newAppData=null;
JarOutputStream newAppDataStream=null;
+ /**
+ * set by extractAppData
+ */
+ protected ApplicationData appsGlobal = null;
+ /**
+ * set by extractAppData
+ */
+ protected User usersData = null;
+
ClientDocument clientdoc;
/**
* state flags
this.clientdoc = clientdoc;
}
/**
- * set by extractAppData
- */
- protected ApplicationData appsGlobal = null;
- /**
- * set by extractAppData
- */
- protected User usersData = null;
- /**
* 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.
*/
// LATER: deal with error case - do we make session read only, or what ?
}
}
+ /**
+ * flush and close outstanding output streams.
+ * - do this before checking data length.
+ * @throws IOException
+ */
+ protected void closeForWriting() throws IOException {
+ if (newAppDataStream!=null) {
+ newAppDataStream.flush();
+ newAppDataStream.closeEntry();
+ newAppDataStream.close();
+ }
+ if (newUserDataStream!=null) {
+ newUserDataStream.flush();
+ newUserDataStream.closeEntry();
+ newUserDataStream.close();
+ }
+ }
+ /**
+ * copy data from the appData jar file to an appropriately
+ * referenced jar or Data entry for the given ApplicationData
+ * @param vdoc session Document handler
+ * @param appd the AppData whose block is being updated
+ * @param apdjar the new data in a Jar written by this class
+ */
+ protected void updateAnAppdataEntry(VamsasArchive vdoc, AppData appd, SessionFile apdjar) {
+
+ }
+
+ /**
+ *
+ * @return true if any AppData blocks have to be updated in session Jar
+ */
+ protected boolean isModified() {
+ // LATER differentiate between core xml modification and Jar Entry modification.
+ if (newAppData.sessionFile.exists() || newUserData.sessionFile.exists())
+ return true;
+ return false;
+ }
/* (non-Javadoc)
* @see java.lang.Object#finalize()
*/