You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by do...@cocoon.apache.org on 2004/07/09 19:54:15 UTC
[Cocoon Wiki] Updated: SitemapPathModule
Date: 2004-07-09T10:54:14
Editor: JoergHeinicke <jo...@gmx.de>
Wiki: Cocoon Wiki
Page: SitemapPathModule
URL: http://wiki.apache.org/cocoon/SitemapPathModule
no comment
Change Log:
------------------------------------------------------------------------------
@@ -1,6 +1,6 @@
== !SitemapPathModule ==
-This [:inputmodule] determines the absolute path to a file-resource, relative to the current sitemap.
+This input module determines the absolute path to a file-resource, relative to the current sitemap.
For example, if the sitemap from which this module is used is located in {{{/here/is/my/sitemap.xmap}}}, the following results are returned:
||''' accessor '''|||| result
@@ -13,10 +13,10 @@
The !SitemapPathModule must be configured in {{{cocoon.xconf}}}:
-{{{
-<component-instance
- class="org.apache.cocoon.components.modules.input.SitemapPathModule"
- logger="core.modules.input" name="sitemap-path"/>
+{{{
+<component-instance
+ class="org.apache.cocoon.components.modules.input.SitemapPathModule"
+ logger="core.modules.input" name="sitemap-path"/>
}}}
The !SitemapPathModule is not in the Cocoon distribution.
@@ -24,45 +24,45 @@
The relevant part of the code is:
-{{{
-package org.apache.cocoon.components.modules.input;
-
-import java.util.*;
-import org.apache.avalon.framework.configuration.Configuration;
-import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.CocoonComponentManager;
-import org.apache.cocoon.components.modules.input.AbstractInputModule;
-import org.apache.cocoon.environment.ObjectModelHelper;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
-import org.apache.excalibur.source.impl.FileSource;
-
-public class SitemapPathModule extends AbstractInputModule implements ThreadSafe {
-
- public Object getAttribute(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- SourceResolver resolver = CocoonComponentManager.getCurrentEnvironment();
- FileSource source;
- try {
- source = (FileSource) resolver.resolveURI(name);
- return source.getFile().getCanonicalPath();
- } catch (Exception e) {
- throw new ConfigurationException(e.toString());
- }
- }
-
- public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- return (new java.util.ArrayList()).iterator();
- }
-
- public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
- throws ConfigurationException {
- List values = new LinkedList();
- values.add( this.getAttribute(name, modeConf, objectModel) );
- return values.toArray();
- }
-
-}
+{{{
+package org.apache.cocoon.components.modules.input;
+
+import java.util.*;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.components.CocoonComponentManager;
+import org.apache.cocoon.components.modules.input.AbstractInputModule;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.impl.FileSource;
+
+public class SitemapPathModule extends AbstractInputModule implements ThreadSafe {
+
+ public Object getAttribute(String name, Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ SourceResolver resolver = CocoonComponentManager.getCurrentEnvironment();
+ FileSource source;
+ try {
+ source = (FileSource) resolver.resolveURI(name);
+ return source.getFile().getCanonicalPath();
+ } catch (Exception e) {
+ throw new ConfigurationException(e.toString());
+ }
+ }
+
+ public Iterator getAttributeNames(Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ return (new java.util.ArrayList()).iterator();
+ }
+
+ public Object[] getAttributeValues(String name, Configuration modeConf, Map objectModel)
+ throws ConfigurationException {
+ List values = new LinkedList();
+ values.add( this.getAttribute(name, modeConf, objectModel) );
+ return values.toArray();
+ }
+
+}
}}}