You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-user@jakarta.apache.org by "Kumar, Ashok" <ak...@metatomix.com> on 2002/08/02 16:42:13 UTC

Latest J2EEStore2 based on the new Database Schema

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

Re: J2EEStore schema problem

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
Patrick van Kann wrote:
> I did not realise that the current stores were not working - I will wait 
> to test them in a few months. Perhaps for the future, the schema could 
> have a comment indicating which store version it works with? Or vice-verse?

Old stores are likely to be removed soon and no incompatible stuff will 
remain then. There will be a working version of the J2EE store in the 
2.0 release. So, stay tuned :)

Oliver



---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: J2EEStore schema problem

Posted by Patrick van Kann <pa...@fortune-cookie.com>.
Thanks Oliver - you are correct. I am now using the older J2EENodeStore 
that accompanied the schema and everything is fine.

I did not realise that the current stores were not working - I will wait 
to test them in a few months. Perhaps for the future, the schema could 
have a comment indicating which store version it works with? Or vice-verse?

Cheers,

Patrick

Oliver Zeigermann wrote:

> I seems you combined two incompatible store versions. SQL code seems 
> to have lower case table names, while schema is upper case. If you 
> need something working *now* do not mix stuff, but use what Ashok has 
> sent. If you can wait some time, wait for the store in the proposals 
> section of the CVS. Though, it does not work, yet.
>
> Oliver
>
> Patrick van Kann wrote:
>
>> Hello,
>>
>> I just configured the J2EEStore according to various  instructions 
>> posted  to this list. The version of J2EEStore I am using is 
>> "Revision: 1.6" according to the header in the J2EEStore.java... it's 
>> in the last nightly build I could find that would actually compile.
>>
>> Everything went fine (i.e. tyrex datasource config, server.xml and 
>> web.xml), except at Domain initiation I get this SQL Exception.
>>
>> 19 Nov 2003 12:54:24 - slidestore.j2ee.J2EEDescriptorsStore - ERROR - 
>> java.sql.SQLException: [FC-PK-01]Invalid object name 'objects'.
>>
>> I'm using a schema called SLIDE_DB_SCHEMA_NFK.SQL. This was sent by 
>> Ashok to this list some time ago - I'm guessing that the schema is 
>> out of date because it accompanied a version of the J2EE stores 
>> labelled "Revision: 1.5".
>>
>> Can someone point me to the correct schema... or alternatively to the 
>> J2EE store I should be using!
>>
>> BTW: My database is SQL Server 2000 and the driver is the InetSoft 
>> Opta2000 driver. I'm running Slide as a webapp in Tomcat 4.1.18.
>>
>> Cheers,
>>
>> Patrick
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: slide-user-help@jakarta.apache.org
>>
>>
>> .
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: J2EEStore schema problem

Posted by Oliver Zeigermann <oz...@c1-fse.de>.
I seems you combined two incompatible store versions. SQL code seems to 
have lower case table names, while schema is upper case. If you need 
something working *now* do not mix stuff, but use what Ashok has sent. 
If you can wait some time, wait for the store in the proposals section 
of the CVS. Though, it does not work, yet.

Oliver

Patrick van Kann wrote:

> Hello,
> 
> I just configured the J2EEStore according to various  instructions 
> posted  to this list. The version of J2EEStore I am using is "Revision: 
> 1.6" according to the header in the J2EEStore.java... it's in the last 
> nightly build I could find that would actually compile.
> 
> Everything went fine (i.e. tyrex datasource config, server.xml and 
> web.xml), except at Domain initiation I get this SQL Exception.
> 
> 19 Nov 2003 12:54:24 - slidestore.j2ee.J2EEDescriptorsStore - ERROR - 
> java.sql.SQLException: [FC-PK-01]Invalid object name 'objects'.
> 
> I'm using a schema called SLIDE_DB_SCHEMA_NFK.SQL. This was sent by 
> Ashok to this list some time ago - I'm guessing that the schema is out 
> of date because it accompanied a version of the J2EE stores labelled 
> "Revision: 1.5".
> 
> Can someone point me to the correct schema... or alternatively to the 
> J2EE store I should be using!
> 
> BTW: My database is SQL Server 2000 and the driver is the InetSoft 
> Opta2000 driver. I'm running Slide as a webapp in Tomcat 4.1.18.
> 
> Cheers,
> 
> Patrick
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: slide-user-help@jakarta.apache.org
> 
> 
> .
> 




---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


J2EEStore schema problem

Posted by Patrick van Kann <pa...@fortune-cookie.com>.
Hello,

I just configured the J2EEStore according to various  instructions 
posted  to this list. The version of J2EEStore I am using is "Revision: 
1.6" according to the header in the J2EEStore.java... it's in the last 
nightly build I could find that would actually compile.

Everything went fine (i.e. tyrex datasource config, server.xml and 
web.xml), except at Domain initiation I get this SQL Exception.

19 Nov 2003 12:54:24 - slidestore.j2ee.J2EEDescriptorsStore - ERROR - 
java.sql.SQLException: [FC-PK-01]Invalid object name 'objects'.

I'm using a schema called SLIDE_DB_SCHEMA_NFK.SQL. This was sent by 
Ashok to this list some time ago - I'm guessing that the schema is out 
of date because it accompanied a version of the J2EE stores labelled 
"Revision: 1.5".

Can someone point me to the correct schema... or alternatively to the 
J2EE store I should be using!

BTW: My database is SQL Server 2000 and the driver is the InetSoft 
Opta2000 driver. I'm running Slide as a webapp in Tomcat 4.1.18.

Cheers,

Patrick




---------------------------------------------------------------------
To unsubscribe, e-mail: slide-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: slide-user-help@jakarta.apache.org


Re: Latest J2EEStore2 based on the new Database Schema

Posted by Christopher Lenz <cm...@gmx.de>.
Hi Ashok

Kumar, Ashok wrote:
> Hi Christopher,
> 
> Here is the latest version of J2EEStore2 version based on the new database schema. 

I've had a look at the files and it is looking quite good. I've got a 
couple of issues though:

Most importantly, I'd really need a schema that works with HSQLDB, and 
is closer to "standard" SQL. I currently don't have the time nor the 
knowledge to create one. Any volunteers?

MTXZip: It would be great if you could move that file into the 
slidestore.reference.util package (for example) and give it a more 
descriptive name. I don't quite like the design of the class, as it 
provides methods that probably should be static, except that the length 
is stored as instance variable. Maybe using a struct-like class 
containing both InputStream/OutputStream and the length could be used as 
return value?

Coding style: the source is only partially conforming to the coding 
style used in Slide. In particular, the names for variables (l_* for 
local vars, hsh_uri* for the hashtables, etc) don't seem very java-ish 
to me. Lines should be wrapped at column 80, they often exceed that 
limit in your code.

If we could get those issues resolved, I'd love to commit your great 
contribution to our CVS!

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Latest J2EEStore2 based on the new Database Schema

Posted by Christopher Lenz <cm...@gmx.de>.
Kumar, Ashok wrote:
> Hi Christopher,
> 
> Here is the latest version of J2EEStore2 version based on the new database schema. 

Many thanks Ashok,

I'm off on a weekend camping trip now, but I promise I'll look at and 
eventually commit your constributions next week, if noone does before me ;o)

-- 
Christopher Lenz
/=/ cmlenz at gmx.de


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Latest J2EEStore2 based on the new Database Schema

Posted by Jacob Lund <ja...@qualiware.com>.
Hi Ashok!

I have been playing a bit with the store2 stores and it seems to me that
that are "stepping on each others feet". If I change the transaction
level to allow reading uncommitted data on some of the select statements
then I can get the content store working - how this will affect the data
consistency I'm not sure!! I will try to give a more detailed overview
of where I see problems when I have done some more testing!

Also have you tried to have descriptorsstore and contentstore split-up
into two different databases?

/Jacob

-----Original Message-----
From: Kumar, Ashok [mailto:akumar@metatomix.com] 
Sent: 2. august 2002 16:42
To: Slide Developers Mailing List
Cc: Slide Users Mailing List
Subject: Latest J2EEStore2 based on the new Database Schema


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


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>