You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by lg...@apache.org on 2006/11/03 14:55:59 UTC
svn commit: r470819 -
/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
Author: lgawron
Date: Fri Nov 3 05:55:58 2006
New Revision: 470819
URL: http://svn.apache.org/viewvc?view=rev&rev=470819
Log:
CocoonPropertyOverrideConfigurer.java needs unconditional access to Settins. Otherwise property placeholder loads properties from 'dev' profile and overrider from default 'prod'
Modified:
cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
Modified: cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java?view=diff&rev=470819&r1=470818&r2=470819
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java (original)
+++ cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java Fri Nov 3 05:55:58 2006
@@ -29,20 +29,25 @@
import org.springframework.core.io.ResourceLoader;
/**
- * Our version of the property override configurer which reads properties
- * from the Cocoon spring configuration directory.
- * A property should have the following format: {bean name}/{property name}={value}.
- *
- * @version $Id$
+ * Our version of the property override configurer which reads properties from
+ * the Cocoon spring configuration directory. A property should have the
+ * following format: {bean name}/{property name}={value}.
+ *
+ * @version $Id: CocoonPropertyOverrideConfigurer.java 470754 2006-11-03
+ * 10:47:52Z lgawron $
*/
public class CocoonPropertyOverrideConfigurer extends PropertyOverrideConfigurer {
- /** The location of the directory where the different property files are located. */
+ /**
+ * The location of the directory where the different property files are
+ * located.
+ */
protected String location = Constants.DEFAULT_SPRING_CONFIGURATION_LOCATION;
- /** The resource loader used to load the property files.
- * This loader is either resolving relative to the current sitemap or the
- * root of the context.
+ /**
+ * The resource loader used to load the property files. This loader is
+ * either resolving relative to the current sitemap or the root of the
+ * context.
*/
protected ResourceLoader resourceLoader = new DefaultResourceLoader();
@@ -53,7 +58,9 @@
/**
* Set the directory to search in.
- * @param object New value.
+ *
+ * @param object
+ * New value.
*/
public void setLocation(final String object) {
this.location = object;
@@ -66,31 +73,36 @@
/**
* Set the resource loader.
- * @param loader The new resource loader.
+ *
+ * @param loader
+ * The new resource loader.
*/
public void setResourceLoader(final ResourceLoader loader) {
this.resourceLoader = loader;
}
/**
- * Read all property files from the specified location and apply the changes.
+ * Read all property files from the specified location and apply the
+ * changes.
+ *
* @see org.springframework.beans.factory.config.PropertyResourceConfigurer#postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory)
*/
- public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
- throws BeansException {
- if ( this.logger.isDebugEnabled() ) {
+ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
+ if (this.logger.isDebugEnabled()) {
this.logger.debug("Processing bean factory: " + beanFactory);
}
- final String mode = (this.settings != null ? this.settings.getRunningMode() : SettingsDefaults.DEFAULT_RUNNING_MODE);
+ final String mode = this.settings.getRunningMode();
final Properties mergedProps = new Properties();
- ResourceUtils.readProperties("classpath*:/META-INF/cocoon/spring", mergedProps, this.resourceLoader, this.logger);
- ResourceUtils.readProperties("classpath*:/META-INF/cocoon/spring/" + mode, mergedProps, this.resourceLoader, this.logger);
+ ResourceUtils.readProperties("classpath*:META-INF/cocoon/properties", mergedProps, this.resourceLoader,
+ this.logger);
+ ResourceUtils.readProperties("classpath*:META-INF/cocoon/properties/" + mode, mergedProps,
+ this.resourceLoader, this.logger);
ResourceUtils.readProperties(this.location, mergedProps, this.resourceLoader, this.logger);
// read properties from running-mode dependent directory
ResourceUtils.readProperties(this.location + '/' + mode, mergedProps, this.resourceLoader, this.logger);
- if ( mergedProps.size() > 0 ) {
+ if (mergedProps.size() > 0) {
// Convert the merged properties, if necessary.
convertProperties(mergedProps);
Re: svn commit: r470819 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
Posted by Carsten Ziegeler <cz...@apache.org>.
Leszek Gawron wrote:
> OK, sorry for that. Old ctrl + shift + f habbit.
:)
> Should I revert the changes?
>
No, no - no need for that.
Carsten
--
Carsten Ziegeler - Chief Architect
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: svn commit: r470819 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
Posted by Leszek Gawron <lg...@mobilebox.pl>.
Carsten Ziegeler wrote:
> lgawron@apache.org wrote:
>> - final String mode = (this.settings != null ? this.settings.getRunningMode() : SettingsDefaults.DEFAULT_RUNNING_MODE);
>> + final String mode = this.settings.getRunningMode();
> Could you please revert this change? The idea behind the initial code is
> to have a fully functional bean even if the dependencies (like settings)
> are not available (for example for unit testing).
> If settings are set, both lines deliver the same result.
OK, the actual problem was settings were not set.
>
>
>> - if ( mergedProps.size() > 0 ) {
>> + if (mergedProps.size() > 0) {
> Could you please try and not reformat the code while changing it? Your
> recent commits contain a lot of code reformatting and a few code
> changes. It's very hard to review the commit mails this way. It's better
> to change the code with one commit and *if required* do only code
> formatting in another separata commit.
OK, sorry for that. Old ctrl + shift + f habbit. Should I revert the
changes?
--
Leszek Gawron CTO at MobileBox Ltd.
Re: svn commit: r470819 - /cocoon/trunk/core/cocoon-core/src/main/java/org/apache/cocoon/core/container/spring/CocoonPropertyOverrideConfigurer.java
Posted by Carsten Ziegeler <cz...@apache.org>.
lgawron@apache.org wrote:
> - final String mode = (this.settings != null ? this.settings.getRunningMode() : SettingsDefaults.DEFAULT_RUNNING_MODE);
> + final String mode = this.settings.getRunningMode();
Could you please revert this change? The idea behind the initial code is
to have a fully functional bean even if the dependencies (like settings)
are not available (for example for unit testing).
If settings are set, both lines deliver the same result.
> - if ( mergedProps.size() > 0 ) {
> + if (mergedProps.size() > 0) {
Could you please try and not reformat the code while changing it? Your
recent commits contain a lot of code reformatting and a few code
changes. It's very hard to review the commit mails this way. It's better
to change the code with one commit and *if required* do only code
formatting in another separata commit.
Thanks
Carsten
--
Carsten Ziegeler - Chief Architect
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/