Hi Christopher,

Here is the latest version of J2EEStore2 version based on the new database schema. 

Attached are the following 
        J2EEStore2
        J2EEContentStore2
        J2EEDescriptor2
        J2EEStore2 howto  ( this is based on Tomcat 4.1.x implementation). the above 
stores can work on 
        TC4.1.x based on original J2EEStore Howto.
        NewDatabase Schema (for SQLServer)
        MTXZip.java( used for the compression)

Notes:
1.The schema attached is for SQLServer. A postgres version of the schema was submitted 
on 08.01.2002 by Jean.
If i get time I will try to generate the schemas for the other databases including the 
HSQLDB.

2. I have incorporated a feature for compression of content before storage. See the 
MTXZip.java for the source. 
Advantages we could gain by having this feature are:
1. Performance and size issues.
2. Solved the issue of truncation of files while retrieval.
The problem is as follows:
Store a small size file say 10k. Now replace the same file with a larger size file say 
95K. While storing the bigger file give a request for the file. It will return the new 
file but only upto 10K, not the 95K.
The reason is new file size info is updated by the descriptor store only after the 
storage by the contentStore
where as the content is fetched after reading the desicptor length info. Hence what 
happens is that
while a 95 k file is being put the descriptor info is still 10k. So the GET request 
has length info 10K and it get the 95 K file from the contentstore (as soon as it gets 
committed) leading to 10K of the 95 K file causing truncation. The 
compression/decompression utility has access to the content length info which enable 
us to  update the descriptor object as soon as the content is read for the length size 
which solves the issue.
The relevant code can be seen in J2EEContentStore2.


+  93 import com.metatomix.commons.util.MTXZip;                         // Document 
+Compression
+ 106 private boolean bcompress = false;
+ 122                   bcompress = 
+(((String)parameters.get("compress")).equals("true"))? true:false; 

+ 171           if (bcompress) {
+ 172                   getLogger().log("DeCompressing the 
+data",LOG_CHANNEL,Logger.INFO);
+ 173                           MTXZip mtxzip = new MTXZip();
+ 174                           is = mtxzip.iUnZip(is);
+ 175                           
+revisionDescriptor.setContentLength(mtxzip.getLength());
+ 176                   }            

+ 385                   long contentLength = 0;
+ 386                   if (bcompress) {
+ 387                           getLogger().log("Compressing the 
+data",LOG_CHANNEL,Logger.INFO);
+ 388                           MTXZip mtxzip = new MTXZip();
+ 389                           is = mtxzip.iZip(is);
+ 390                           contentLength = mtxzip.getLength();
+ 391                   } else {
+ 392                           contentLength = revisionDescriptor.getContentLength();
+ 393                   }

This is controlled from the domain.xml parameter for J2EEContentStore

        <contentstore classname="slidestore.j2ee.J2EEContentStore2">
                <parameter name="datasource">jdbc/mtx_hologram</parameter>
                <parameter name="compress">true</parameter>
        </contentstore> 

If we all find that this is a nice feature to have, I will do some refactoring. 
See the attachment for the sources

Ashok

Attachment: J2EEStore2.zip
Description: J2EEStore2.zip

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to