Properties and Models

5 views
Skip to first unread message

Mike Schrag

unread,
Mar 6, 2007, 9:49:52 AM3/6/07
to wot...@googlegroups.com
Properties are the main way of configuring Project Wonder. There are
tons of them. Quite a few are documented with examples in the
Resources/Properties file in the ERExtensions source. If you're
using Project Wonder, I highly recommend that you browse through that
file to see some of the things you might be missing.

And now for some miscellaneous Properties entries and Properties-
related coolness:

One feature that was added recently that has been really handy for us
is that you can define per-user properties files
(Properties.<username> file). These are loaded at the end, so you
can override default Properties file entries. For instance, I have
Properties.mschrag and I override the er.javamail.adminEmail setting
from the default Properties file for our project. Very useful when
you have multiple people on a team.

----

Here's a really common one: For each eomodel, you can override the
connection dictionary with Properties:
<modelname>.URL=jdbc:FrontBase://127.0.0.1/MyDevelopmentDatabase
<modelname>.DBUser=MyDevelopmentUser
<modelname>.DBPassword=MyDevelopmentPassword

There's a setting for each entry in the connection dictionary
(.URL, .DBUser, .DBPassword, .DBDriver, .DBServer, .DBHostName, .DBJDBCI
nfo, .BDPlugin, etc).

... or you can just declare the global override:
dbConnectURLGLOBAL=jdbc:FrontBase://127.0.0.1/MyDevelopmentDatabase
dbConnectUserGLOBAL=MyDevelopmentUser
dbConnectPasswordGLOBAL=MyDevelopmentPassword

----

Another thing that is always important is SQL logging. Wonder has a
cool SQL logging mechanism that lets you optionally log only slow
queries. Drop this into your Properties file to see it:

er.extensions.ERXAdaptorChannelDelegate.enabled=true
er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.debug=10
er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.info=100
er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.warn=500
er.extensions.ERXAdaptorChannelDelegate.trace.milliSeconds.error=5000
log4j.logger.er.extensions.ERXAdaptorChannelDelegate.sqlLogging=INFO

What this says is that any query that's slower than 5000 milliseconds
gets logged as an error, slower than 500 is a warning, 100 is an
info, and 10 is a debug. The value of your log4j setting of
sqlLogging then controls which level you're interested in seeing.
This is a really great way to avoid parsing through thousands of SQL
statements just to find the slow one.

----

In one of our apps, we found that the HTML responses being generated
could get large in certain cases. You can just turn on response
compression:

er.extensions.ERXApplication.responseCompressionEnabled=true

, which will automagically return gzipped content to your users if
their browser supports it (they basically all do, now). Obviously
weigh the CPU tradeoff against bandwidth, but it's an easy bandwidth
win if you need it.

---

There are tons more ... These are just a handful that you might find
to be useful.

ms

Tobias Crawley

unread,
Mar 10, 2007, 5:10:12 PM3/10/07
to wot...@googlegroups.com
Mike:

You state that Properties.<username> are "loaded at the end". Is this
something that ERXApplication does automatically, or are you
specifying the properties file on the command line? Looking through
the ERXApplication source, the closest thing I can find is where it
looks for 'WebObjects.properties' in user.home.

Thanks,
Tobias

Mike Schrag

unread,
Mar 10, 2007, 5:32:43 PM3/10/07
to wot...@googlegroups.com
It's done automatically inside of (I think) ERXConfiguration (I don't
have Eclipse open at the moment).

ms

Tobias Crawley

unread,
Mar 10, 2007, 6:22:07 PM3/10/07
to wot...@googlegroups.com
Mike:

Thanks for the tip. The file was not being loaded for me, but the
cause was my resources.include.patternset in Eclipse not including **/
Properties.*.

Tobias

Mike Schrag

unread,
Mar 10, 2007, 6:35:11 PM3/10/07
to wot...@googlegroups.com
Oh -- Right ... Forgot to mention that one. I set that on mine so
long ago that I totally forgot.

ms

Reply all
Reply to author
Forward
0 new messages