You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Reinhard Poetz <re...@yahoo.de> on 2006/05/22 15:10:42 UTC
[2.2] Configuration
Von: Carsten Ziegeler <cz...@apache.org>
> Yes, true. What about extending the deployer (or creating another
> plugin) which by default rewrites the web.xml and adds all required
> wrappers (paranoid servlet etc.) and also moves the jars to a different
> directory? With a plugin-configuration this can be turned off.
> (We don't need this for b1)
At the weekend I was thinking about this and using different locations for lib and classes and extending the existing functionality of the maven-war-plugin can be achieved by renaming them after the "original" methods have been called. That's easy :-)
Having a configuration that can turn on/off the support for paranoid classloading is the way to go. The default value is, as proposed by Carsten, true and then the deployer checks whether all necessary configurations in web.xml are set correctly or if not set it adds them.
I don't think that we have to (and should) provide any patching functionality to the deployer as people are in control of the content of WEB-INF and its subdirectories. If they add some file there which has the same name as a file in one of the blocks, it overrides the original version. The only thing that we should do is splitting up our configuration files in smaller chunks so that we get one configuration file for one component so that people get fine-grained control.
--
Reinhard
Re: [2.2] Configuration
Posted by Ralph Goers <Ra...@dslextreme.com>.
OK. I've tried to follow a fairly simple convention for naming the
properties. If you look at the ones I've defined it should jump out at
you. As there may be variations in the properties in 2.2 I think we
should try to standardize on the convention.
Also, once generators, etc. are converted to the ThreadSafe model a lot
of the pool sizes will go away.
By the way, are pipelines still pooled in trunk or can they (or should
they) use a factory pattern instead?
Ralph
Carsten Ziegeler wrote:
> Ralph Goers wrote:
>
>> Running mode is not. I brought back the property stuff to 2.1, although
>> I'm not sure it is exactly the same as in 2.2. I had to implement it in
>> a different place as the core has changed. Also, there are a lot of
>> pre-defined properties in 2.1. I don't know if Carsten has done that in
>> 2.2 and if he has then the variable names probably aren't the same.
>>
>>
> Currently there are no pre-defined properties in 2.2; I think we should
> try to
> use the same ones as in 2.1.x and introduce them in trunk now.
>
> Carsten
>
Re: [2.2] Configuration
Posted by Carsten Ziegeler <cz...@apache.org>.
Ralph Goers wrote:
> Running mode is not. I brought back the property stuff to 2.1, although
> I'm not sure it is exactly the same as in 2.2. I had to implement it in
> a different place as the core has changed. Also, there are a lot of
> pre-defined properties in 2.1. I don't know if Carsten has done that in
> 2.2 and if he has then the variable names probably aren't the same.
>
Currently there are no pre-defined properties in 2.2; I think we should
try to
use the same ones as in 2.1.x and introduce them in trunk now.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [2.2] Configuration
Posted by Ralph Goers <Ra...@dslextreme.com>.
Running mode is not. I brought back the property stuff to 2.1, although
I'm not sure it is exactly the same as in 2.2. I had to implement it in
a different place as the core has changed. Also, there are a lot of
pre-defined properties in 2.1. I don't know if Carsten has done that in
2.2 and if he has then the variable names probably aren't the same.
Ralph
Antonio Gallardo wrote:
> Hi,
>
> This stuff is already available in 2.1, right?
>
> Best Regards,
>
> Antonio Gallardo.
>
> Carsten Ziegeler escribió:
>> Reinhard Poetz wrote:
>>
>>> Carsten Ziegeler wrote:
>>>
>>>
>>>> It was in some readme in the root directory; I guess it moved to
>>>> somewhere else during the great refactoring?
>>>>
>>> hmm, can't find it in
>>> http://svn.apache.org/repos/asf/cocoon/tags/trunk_before_flattening/
>>> :-(
>>>
>>>
>> It was in install.txt: here is the text I orginally committed - but I
>> think others changed the text afterwards:
>>
>>
>> Choosing the running mode
>> -------------------------
>> Cocoon comes with a smart configuration mechanism based on "running
>> modes". The
>> configuration of Cocoon is based on XML files for the various
>> components. To
>> customize these configuration files you can define properties to
>> which you
>> can refer to from within the configuration files.
>> You can define as many property files and define your own properties as
>> you want.
>> Store them in the WEB-INF/properties directory and Cocoon will read
>> all of
>> them on start up. You can then refer to the values of the properties by
>> using the common ${PROPERTY_NAME} syntax in your configuration file.
>> In addition Cocoon supports running modes. You define a running mode
>> when
>> you start Cocoon (default is "dev"). Now this name of the running
>> mode is
>> used to read additional property files on startup. Cocoon reads first
>> all
>> property files from "WEB-INF/properties" and then from
>> "WEB-INF/properties/${RUNNING_MODE}". For example if you have different
>> database connections during development and in production, just put
>> a properties file containing the connection information for development
>> in the "WEB-INF/properties/dev" directory and put another property file
>> with the production settings in "WEB-INF/properties/prod".
>> You can easily switch the running mode by setting the system property
>> "org.apache.cocoon.mode" on startup of Cocoon ,for example:
>> "-Dorg.apache.cocoon.mode=prod".
>> Note, that "dev" and "prod" are not predefined. So you can create a
>> "myenv" directory underneath the properties directory and set the
>> running mode to "myenv" etc.
>>
>>
>>
>
Re: [2.2] Configuration
Posted by Antonio Gallardo <ag...@agssa.net>.
Hi,
This stuff is already available in 2.1, right?
Best Regards,
Antonio Gallardo.
Carsten Ziegeler escribió:
> Reinhard Poetz wrote:
>
>> Carsten Ziegeler wrote:
>>
>>
>>> It was in some readme in the root directory; I guess it moved to
>>> somewhere else during the great refactoring?
>>>
>> hmm, can't find it in
>> http://svn.apache.org/repos/asf/cocoon/tags/trunk_before_flattening/ :-(
>>
>>
> It was in install.txt: here is the text I orginally committed - but I
> think others changed the text afterwards:
>
>
> Choosing the running mode
> -------------------------
> Cocoon comes with a smart configuration mechanism based on "running
> modes". The
> configuration of Cocoon is based on XML files for the various components. To
> customize these configuration files you can define properties to which you
> can refer to from within the configuration files.
> You can define as many property files and define your own properties as
> you want.
> Store them in the WEB-INF/properties directory and Cocoon will read all of
> them on start up. You can then refer to the values of the properties by
> using the common ${PROPERTY_NAME} syntax in your configuration file.
> In addition Cocoon supports running modes. You define a running mode when
> you start Cocoon (default is "dev"). Now this name of the running mode is
> used to read additional property files on startup. Cocoon reads first all
> property files from "WEB-INF/properties" and then from
> "WEB-INF/properties/${RUNNING_MODE}". For example if you have different
> database connections during development and in production, just put
> a properties file containing the connection information for development
> in the "WEB-INF/properties/dev" directory and put another property file
> with the production settings in "WEB-INF/properties/prod".
> You can easily switch the running mode by setting the system property
> "org.apache.cocoon.mode" on startup of Cocoon ,for example:
> "-Dorg.apache.cocoon.mode=prod".
> Note, that "dev" and "prod" are not predefined. So you can create a
> "myenv" directory underneath the properties directory and set the
> running mode to "myenv" etc.
>
>
>
Re: [2.2] Configuration
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> Carsten Ziegeler wrote:
>
>> It was in some readme in the root directory; I guess it moved to
>> somewhere else during the great refactoring?
>
> hmm, can't find it in
> http://svn.apache.org/repos/asf/cocoon/tags/trunk_before_flattening/ :-(
>
It was in install.txt: here is the text I orginally committed - but I
think others changed the text afterwards:
Choosing the running mode
-------------------------
Cocoon comes with a smart configuration mechanism based on "running
modes". The
configuration of Cocoon is based on XML files for the various components. To
customize these configuration files you can define properties to which you
can refer to from within the configuration files.
You can define as many property files and define your own properties as
you want.
Store them in the WEB-INF/properties directory and Cocoon will read all of
them on start up. You can then refer to the values of the properties by
using the common ${PROPERTY_NAME} syntax in your configuration file.
In addition Cocoon supports running modes. You define a running mode when
you start Cocoon (default is "dev"). Now this name of the running mode is
used to read additional property files on startup. Cocoon reads first all
property files from "WEB-INF/properties" and then from
"WEB-INF/properties/${RUNNING_MODE}". For example if you have different
database connections during development and in production, just put
a properties file containing the connection information for development
in the "WEB-INF/properties/dev" directory and put another property file
with the production settings in "WEB-INF/properties/prod".
You can easily switch the running mode by setting the system property
"org.apache.cocoon.mode" on startup of Cocoon ,for example:
"-Dorg.apache.cocoon.mode=prod".
Note, that "dev" and "prod" are not predefined. So you can create a
"myenv" directory underneath the properties directory and set the
running mode to "myenv" etc.
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [2.2] Configuration
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> It was in some readme in the root directory; I guess it moved to
> somewhere else during the great refactoring?
hmm, can't find it in
http://svn.apache.org/repos/asf/cocoon/tags/trunk_before_flattening/ :-(
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
Re: [2.2] Configuration
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz schrieb:
> Carsten Ziegeler wrote:
>
>> And we don't even need maven for this! Cocoon uses a running mode which can
>> be set as a system property. The definition for this is free, so we ship
>> Cocoon currently with the values "prod" and "dev". You can refer to
>> these values directly from within your xconf or your sitemap and
>> property replacement is done by Cocoon. So if you use
>> ${org.apache.cocoon.mode} instead of ${env} this should already work
>> without filtering and doesn't require a rebuild for switching!
>
> Carsten, can you refer to some documentation or mail that explains how this
> mechanism works? (I recall that you wrote something but don't know anymore where
> to find it.)
>
>
It was in some readme in the root directory; I guess it moved to
somewhere else during the great refactoring?
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [2.2] Configuration
Posted by Reinhard Poetz <re...@apache.org>.
Carsten Ziegeler wrote:
> And we don't even need maven for this! Cocoon uses a running mode which can
> be set as a system property. The definition for this is free, so we ship
> Cocoon currently with the values "prod" and "dev". You can refer to
> these values directly from within your xconf or your sitemap and
> property replacement is done by Cocoon. So if you use
> ${org.apache.cocoon.mode} instead of ${env} this should already work
> without filtering and doesn't require a rebuild for switching!
Carsten, can you refer to some documentation or mail that explains how this
mechanism works? (I recall that you wrote something but don't know anymore where
to find it.)
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Re: [2.2] Configuration
Posted by Carsten Ziegeler <cz...@apache.org>.
Jorg Heymans schrieb:
> Reinhard Poetz wrote:
>
>> Suppose you have two environments: development (dev) and production
>> (prod). If you create the web application, you might need different
>> .xconf (database connections, root sitemap, ...) values and different
>> properties.
>
> ...
>
>> I propose that we have a directory "src/main/webapp-profiles" that
>> contains all files for different profiles:
>>
>> src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
>> src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
>> src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
>> src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
>
> Just fyi, you can define placeholders a la ${my.db.url} in text files
> and have these replaced by maven during build time.
>
> So you could do
>
> <build>
> <filters>
> <filter>src/main/filters/${env}.properties</filter>
> </filters>
> <resources>
> <resource>
> ....
> <filtering>true</filtering>
> <includes>**/*.xconf</includes>
> <resource>
> <resources>
> </build>
>
> combined with this in settings.xml:
>
> <profile>
> <activation>
> ....
> <properties>
> <env>prod</env>
> </properties>
> </profile>
>
> Note that ${env} in the pom is resolved to the <env> property in the
> profile.
>
> That way you wouldn't have to duplicate your configuration files.
>
>
And we don't even need maven for this! Cocoon uses a running mode which can
be set as a system property. The definition for this is free, so we ship
Cocoon currently with the values "prod" and "dev". You can refer to
these values directly from within your xconf or your sitemap and
property replacement is done by Cocoon. So if you use
${org.apache.cocoon.mode} instead of ${env} this should already work
without filtering and doesn't require a rebuild for switching!
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: [2.2] Configuration
Posted by Reinhard Poetz <re...@apache.org>.
Giacomo Pati wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On Mon, 22 May 2006, Jorg Heymans wrote:
>
>> Date: Mon, 22 May 2006 20:32:39 +0200
>> From: Jorg Heymans <jh...@domek.be>
>> Reply-To: dev@cocoon.apache.org
>> To: dev@cocoon.apache.org
>> Subject: Re: [2.2] Configuration
>>
>>
>> Reinhard Poetz wrote:
>>
>>>
>>> Suppose you have two environments: development (dev) and production
>>> (prod). If you create the web application, you might need different
>>> .xconf (database connections, root sitemap, ...) values and different
>>> properties.
>>
>>
>> ...
>>
>>> I propose that we have a directory "src/main/webapp-profiles" that
>>> contains all files for different profiles:
>>>
>>> src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
>>> src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
>>> src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
>>> src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
>>
>>
>> Just fyi, you can define placeholders a la ${my.db.url} in text files
>> and have these replaced by maven during build time.
>>
>> So you could do
>>
>> <build>
>> <filters>
>> <filter>src/main/filters/${env}.properties</filter>
>> </filters>
>> <resources>
>> <resource>
>> ....
>> <filtering>true</filtering>
>> <includes>**/*.xconf</includes>
>> <resource>
>> <resources>
>> </build>
>>
>> combined with this in settings.xml:
>>
>> <profile>
>> <activation>
>> ....
>> <properties>
>> <env>prod</env>
>> </properties>
>> </profile>
>>
>> Note that ${env} in the pom is resolved to the <env> property in the
>> profile.
>>
>> That way you wouldn't have to duplicate your configuration files.
>
>
> +1 to this as that is IMHO the standard way maven2 works.
yes, that should be good enough - I was thinking too complicated ;-)
I will add this to cocoon-22-webapp-archetyp.
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Re: [2.2] Configuration
Posted by Giacomo Pati <gi...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Mon, 22 May 2006, Jorg Heymans wrote:
> Date: Mon, 22 May 2006 20:32:39 +0200
> From: Jorg Heymans <jh...@domek.be>
> Reply-To: dev@cocoon.apache.org
> To: dev@cocoon.apache.org
> Subject: Re: [2.2] Configuration
>
>
> Reinhard Poetz wrote:
>
>>
>> Suppose you have two environments: development (dev) and production
>> (prod). If you create the web application, you might need different
>> .xconf (database connections, root sitemap, ...) values and different
>> properties.
>
> ...
>
>> I propose that we have a directory "src/main/webapp-profiles" that
>> contains all files for different profiles:
>>
>> src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
>> src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
>> src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
>> src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
>
> Just fyi, you can define placeholders a la ${my.db.url} in text files
> and have these replaced by maven during build time.
>
> So you could do
>
> <build>
> <filters>
> <filter>src/main/filters/${env}.properties</filter>
> </filters>
> <resources>
> <resource>
> ....
> <filtering>true</filtering>
> <includes>**/*.xconf</includes>
> <resource>
> <resources>
> </build>
>
> combined with this in settings.xml:
>
> <profile>
> <activation>
> ....
> <properties>
> <env>prod</env>
> </properties>
> </profile>
>
> Note that ${env} in the pom is resolved to the <env> property in the
> profile.
>
> That way you wouldn't have to duplicate your configuration files.
+1 to this as that is IMHO the standard way maven2 works.
- --
Giacomo Pati
Otego AG, Switzerland - http://www.otego.com
Orixo, the XML business alliance - http://www.orixo.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQFEcrarLNdJvZjjVZARAl6/AJ9ZKybOA2No2vcUcQrihi2NnkB2SQCg4Er3
3q27VzVgBz9wntlS+b03vKQ=
=31fW
-----END PGP SIGNATURE-----
Re: [2.2] Configuration
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Jorg Heymans wrote:
> Reinhard Poetz wrote:
>
>> Suppose you have two environments: development (dev) and production
>> (prod). If you create the web application, you might need different
>> .xconf (database connections, root sitemap, ...) values and different
>> properties.
>
> ...
>
>> I propose that we have a directory "src/main/webapp-profiles" that
>> contains all files for different profiles:
>>
>> src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
>> src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
>> src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
>> src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
>
> Just fyi, you can define placeholders a la ${my.db.url} in text files
> and have these replaced by maven during build time.
which won't work for those who use eclipse as an IDE - the source files
will still contain ${my.db.url} instead of actual url. Every eclipse
rebuild will put unchanged files in target directory.
--
Leszek Gawron lgawron@mobilebox.pl
IT Manager MobileBox sp. z o.o.
+48 (61) 855 06 67 http://www.mobilebox.pl
mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65
Re: [2.2] Configuration
Posted by Jorg Heymans <jh...@domek.be>.
Reinhard Poetz wrote:
>
> Suppose you have two environments: development (dev) and production
> (prod). If you create the web application, you might need different
> .xconf (database connections, root sitemap, ...) values and different
> properties.
...
> I propose that we have a directory "src/main/webapp-profiles" that
> contains all files for different profiles:
>
> src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
> src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
> src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
> src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
Just fyi, you can define placeholders a la ${my.db.url} in text files
and have these replaced by maven during build time.
So you could do
<build>
<filters>
<filter>src/main/filters/${env}.properties</filter>
</filters>
<resources>
<resource>
....
<filtering>true</filtering>
<includes>**/*.xconf</includes>
<resource>
<resources>
</build>
combined with this in settings.xml:
<profile>
<activation>
....
<properties>
<env>prod</env>
</properties>
</profile>
Note that ${env} in the pom is resolved to the <env> property in the
profile.
That way you wouldn't have to duplicate your configuration files.
Regards
Jorg
Re: [2.2] Configuration
Posted by Reinhard Poetz <re...@apache.org>.
Reinhard Poetz wrote:
> Von: Carsten Ziegeler <cz...@apache.org>
>
>>Yes, true. What about extending the deployer (or creating another
>>plugin) which by default rewrites the web.xml and adds all required
>>wrappers (paranoid servlet etc.) and also moves the jars to a different
>>directory? With a plugin-configuration this can be turned off.
>>(We don't need this for b1)
>
>
> At the weekend I was thinking about this and using different locations for lib and classes and extending the existing functionality of the maven-war-plugin can be achieved by renaming them after the "original" methods have been called. That's easy :-)
>
> Having a configuration that can turn on/off the support for paranoid classloading is the way to go. The default value is, as proposed by Carsten, true and then the deployer checks whether all necessary configurations in web.xml are set correctly or if not set it adds them.
>
> I don't think that we have to (and should) provide any patching functionality to the deployer as people are in control of the content of WEB-INF and its subdirectories. If they add some file there which has the same name as a file in one of the blocks, it overrides the original version. The only thing that we should do is splitting up our configuration files in smaller chunks so that we get one configuration file for one component so that people get fine-grained control.
One additional thought:
Maven 2 has the concept of profiles. Profiles make it possible to customize the
build process and that's what we need to provide configurations for different
environments.
Suppose you have two environments: development (dev) and production (prod). If
you create the web application, you might need different .xconf (database
connections, root sitemap, ...) values and different properties.
In your src/main/webapp directory, you have for example
src/main/webapp/WEB-INF/xconf/cocoon-sitemap.xconf
src/main/webapp/WEB-INF/properties/core.properties
I propose that we have a directory "src/main/webapp-profiles" that contains all
files for different profiles:
src/main/webapp-profiles/dev/WEB-INF/xconf/cocoon-sitemap.xconf
src/main/webapp-profiles/prod/WEB-INF/conf/cocoon-sitemap.xconf
src/main/wenbapp-profiles/dev/WEB-INF/properties/core.properties
src/main/wenbapp-profiles/prod/WEB-INF/properties/core.properties
This way we can create environment specific web applications by calling
"mvn cocoon:deploy -P dev" or "mvn cocoon:deploy -P dev,prod"
As mentioned in my previous message, this make it necessary to split up
cocoon.core in small chunks (every component get's its own configuration file)
so that the override mechanism works smoothly.
WDYT?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de