Pierre van Rooden wrote:
Nico Klasens wrote:
Modified Files:
Tag: MMBase-1_8
Module.java Log Message:
Added initParameter loading from application context
There is no clear javadoc to describe hat ApplicationContextReader
does, so I had to delve a bit in the code to figure out what this
does. I'm not sure how you exactly use it (or why you wouldn't change
the modules) - maybe it has to do with loadbalancing?
Some documentation is needed, I think.
At any rate, I wonder if it is necessary to explicitly call this
method from every individual module's init method.
It would be easier if we use a standard directory path (i.e.
mmbase/<modulename>", and then let the Module class call it from the
loadModulesFromDisk method (right after it loads properties from the
xml).
Then it would apply to all modules without the need for extra coding,
and you do not risk accidentally using the wrong property.
ApplicationContextReader is experimental, but useful enough to be in the
stable release. I am not sure yet if I want it, but when I do want it
then I will bring it in the discussion of the mmcf project. I made
minimal changes to get it to work for what I want.
In OTAP you want to use the same war when moving to a new production
level. With MMbase you always have to change the war for a new
production level.
The idea behind the ApplicationContextReader is to read settings from
the environment which affects the behaviour of the war. There are only a
few settings different for each level. It would be great to have these
settings defined in the production level systems instead of the war. For
example, with tomcat you can use a context.xml file with all environment
settings. A redeployment of the war does not require to update this
file. At the moment a context.xml could look like this
<Context path="/cmsc-webapp" docBase="cmsc-webapp" debug="5"
reloadable="true">
<Resource name="mail/Session" auth="Container" type="javax.mail.Session"
factory="org.apache.naming.factory.MailSessionFactory"
mail.smtp.host="MISSING.MAILSERVER" />
<Resource name="jdbc/cmsc" auth="Container" type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory"
removeAbandoned="true"
removeAbandonedTimeout="60"
logAbandoned="true"
maxActive="10"
maxIdle="1"
maxWait="10000"
username="cmsc"
password="cmsc"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/cmsc?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true"
/>
<Environment name="mmbase/mmbaseroot/datasource-context"
value="java:comp/env" type="java.lang.String" />
<Environment name="mmbase/mmbaseroot/datasource" value="jdbc/cmsc"
type="java.lang.String" />
<Environment name="mmbase/mmbaseroot/basename" value="cmsc"
type="java.lang.String" />
<Environment name="mmbase/imaging/ImageConvertClass"
value="org.mmbase.module.builders.ConvertImageMagick"
type="java.lang.String" />
<Environment name="mmbase/imaging/ImageConvert.ConverterCommand"
value="convert" type="java.lang.String" />
<Environment name="mmbase/imaging/ImageConvert.ConverterRoot"
value="/usr/bin" type="java.lang.String" />
<Environment name="mmbase/rmmci/port" value="1111"
type="java.lang.String" />
<Environment name="mmbase/rmmci/bindname" value="cmsc"
type="java.lang.String" />
<!-- if RMIRegistryServer is not set RemoteMMCI looks for a
RMIRegistryServer
on the host defined in the mmbaseroot.xml module. -->
<!-- <Environment name="mmbase/rmmci/RMIRegistryServer"
value="localhost" type="java.lang.String" /> -->
</Context>
Everything in the file is system install related.
- mailserver
- database server/port/schema/user/password/connections
- imagemagic location
- rmi server/port/name
An advantage is that a war tested on a development system can be copy
onto a production server without any changes. It does not matter which
OS and database you used. The risk to forget a setting is reduces to
zero. Another advantage is that only the systemadmins have to know what
the settings/passwords are in production. A change in production does
not affect the software releases.
Nico
_______________________________________________
Developers mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/developers