I inserted an initialization check if everything is OK in the database definitions for 
JDBC repositories support of mail attributes and behave accordingly.

The check uses the new columnExists(DatabaseMetaData dbMetaData, String tableName, 
String columnName) and columnExistsCaseSensitive(DatabaseMetaData dbMetaData, String 
tableName, String columnName) methods in JDBCUtil to do that.

1) If the definitions are wrong, a fatal message is logged to the mailstore log and a 
fatal SQLException is thrown with the same message, stopping the server.

2) If everything is ok, an info message is logged.

3) If mail attributes are not activated, a warn message is logged, and mail attributes 
are not persistent (should we behave instead as in 1?).

The consistency check is done repository per repository, not systemwide.

The "columnExists" check is done on the harcoded name of "message_attributes", 
assuming that the users will not play around with sqlResources.xml.

Vincenzo

P.S. I committed both branch_2_1_fcs and HEAD; comparing the two versions of 
JDBCMailRepository, I found some of the patches applied for mbox support (?) missing 
in HEAD. It may not be "politically correct" ;-) to say this, but aren't we risking 
that HEAD gets behind? It looks always a "pain in the neck" to keep them in sync.

> -----Original Message-----
> From: Vincenzo Gianferrari Pini
> [mailto:[EMAIL PROTECTED]
> Sent: mercoledi 20 agosto 2003 18.02
> To: James Developers List
> Subject: RE: Mail attributes and sqlResources.xml
> 
> 
> Serge,
> 
> I committed on August 18 a change to sqlResources.xml to become 
> "mail attributes enabled" by default.
> 
> As I'm now using a very slow and expensive Internet connection 
> (using my cell phone as a modem), I have to wait until beginning 
> of September to write a comprehensive note in wiki about mail 
> attributes and about how to upgrade db based repositories.
> 
> As suggested by you in September I'll write code to check if the 
> system is valid for mail attributes: it's fairly easy. Just 
> adding a new "public boolean columnExists(DatabaseMetaData 
> dbMetaData, String tableName, String columnName)" method to 
> JDBCUtil and calling it as appropriate in JDBCMailRepository.
> 
> In the meantime, here is a short note on how to to upgrade db 
> based repositories:
> 
> <steps>
> 
> 1) Stop the server.
> 
> 2) Alter both the "inbox" and "spool" tables adding the 
> "message_attributes" column (look in sqlResources.xml for the 
> "message_attributes" definition in the <sql name="createTable" 
> db="???"> entry appropriate for your DBMS). Nulls *must* be 
> allowed for backward and forward compatibility.
> 
> 3) Deploy the current sqlResources.xml updated from CVS (or look 
> for "attributes support" string in the sqlResources.xml coming 
> with James v2.2.0a9 Test Build and comment/uncomment following 
> the instructions).
> 
> 4) Restart the server.
> 
> </steps>
> 
> You can restart the server in between steps 2) and 3) as many 
> times as you want.
> 
> THE ONLY THING TO AVOID IS exchanging steps 2) with 3) restarting 
> the server in the middle: it would generate SQLException-s.
> 
> All this also means that, from now on, deploying the current CVS 
> sqlResources.xml implies that either the "inbox" and "spool" 
> tables are manually altered or being automatically created from scratch.
> 
> I hope that this is enough for the moment, otherwise let me know.
> 
> Vincenzo
> 
> 
> > -----Original Message-----
> > From: Serge Knystautas [mailto:[EMAIL PROTECTED]
> > Sent: lunedi 18 agosto 2003 16.07
> > To: James Developers List
> > Subject: Re: Mail attributes and sqlResources.xml
> > 
> > 
> > Vincenzo Gianferrari Pini wrote:
> > > I suggest then to modify sqlResources.xml accordingly in CVS to 
> > become "mail attributes enabled" by default. Some notes (in wiki? 
> > in the faq?) should be written to help administrators enable 
> > existing servers that have db based repositories (I can do that 
> > when back home).
> > 
> > +1.  I look forward to the notes on how to upgrade my database 
> structure 
> > to support mail attributes. :)  There's a related bug in bugzilla about 
> > how a bad table structure could crash JDBCMailRepository... maybe we 
> > could use DatabaseMetaData to determine whether the system is 
> valid, and 
> > even make the error message that your database isn't configured 
> for mail 
> > attributes appear automagically.
> > 
> > 
> > -- 
> > Serge Knystautas
> > President
> > Lokitech >> software . strategy . design >> http://www.lokitech.com
> > p. 301.656.5501
> > e. [EMAIL PROTECTED]
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


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

Reply via email to