You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2006/08/02 09:48:00 UTC
svn commit: r427926 -
/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java
Author: cziegeler
Date: Wed Aug 2 00:48:00 2006
New Revision: 427926
URL: http://svn.apache.org/viewvc?rev=427926&view=rev
Log:
Make settings available through global input module
Modified:
cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java
Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java?rev=427926&r1=427925&r2=427926&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/modules/input/SitemapVariableHolder.java Wed Aug 2 00:48:00 2006
@@ -23,11 +23,16 @@
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
import org.apache.avalon.framework.logger.AbstractLogEnabled;
import org.apache.avalon.framework.thread.ThreadSafe;
import org.apache.cocoon.components.ChainedConfiguration;
import org.apache.cocoon.components.SitemapConfigurable;
import org.apache.cocoon.components.SitemapConfigurationHolder;
+import org.apache.cocoon.util.Settings;
+import org.apache.cocoon.util.SettingsHelper;
/**
* This "component" is a trick to get global variables on a per
@@ -39,8 +44,7 @@
*/
public final class SitemapVariableHolder
extends AbstractLogEnabled
- implements Component, Configurable, SitemapConfigurable, ThreadSafe
-{
+ implements Component, Configurable, Contextualizable, SitemapConfigurable, ThreadSafe {
public static final String ROLE = SitemapVariableHolder.class.getName();
@@ -53,6 +57,15 @@
/** Manager for sitemap/sub sitemap configuration */
private SitemapConfigurationHolder holder;
+ private Context context;
+
+ /**
+ * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
+ */
+ public void contextualize(Context context) throws ContextException {
+ this.context = context;
+ }
+
/**
* Configures the database access helper.
*
@@ -65,8 +78,15 @@
* */
public void configure(Configuration conf)
throws ConfigurationException {
+ this.globalValues = new HashMap();
+ Settings settings = SettingsHelper.getSettings(this.context);
+ final Iterator iter = settings.getProperties().iterator();
+ while ( iter.hasNext() ) {
+ final String key = (String)iter.next();
+ final String value = settings.getProperty(key);
+ this.globalValues.put(key, value);
+ }
final Configuration[] parameters = conf.getChildren();
- this.globalValues = new HashMap(parameters.length);
for (int i = 0; i < parameters.length; i++) {
final String key = parameters[i].getName();
final String value = parameters[i].getValue();