SitemenuModule
The sitemenu input module is an easy to set up abstraction for binding customizable parameter values to an url. It's main goal is to replace the difficult to setup, maintain and error prone reverse-sitemenu locationmap's.
The main concept of the sitemenu is to provide the customer a way to manage the url's of his website. This means the customer is able to a) decide what the url looks like and b) connect values to that specific url (like template value or a source location in the repository) that will be used inside the application through an input module. This means that, given a correct url, the site application will be able to resolve all data it needs to aggregate content and render it the way it's supposed to, while using a uniform matcher.
The sitemenu input module looks for elements starting with the local-name 'level', containing a child node named 'name', and builds an internal url matching tree using the text-value of the name element, connecting all other non-level child elements as getter values. So for example
<level0> <name>foo</name> <datasource>/content/foo</datasource> <template>show-foo</template> <levelx> <name>bar</name> <datasource>/content/bar</datasource> <template>show-bar</template> </levelx> </level0>
will have two 'internal' matchers, /foo and /foo/bar. In a uniform matcher
<map:match pattern="**"> <map:generate src="cocoon://getContent{sitemenu:datasource}"/> <map:transform src="site://transformers/templates/{sitemenu:template}.xsl"/> <map:serialize type="xhtml"/> </map:match>
it will behave as follows:
URL: /foo
generate src=cocoon://getContent*/content/foo* transform src=site://transformers/templates/*show-foo*.xsl
URL: /foo/bar
generate src=cocoon://getContent*/content/bar* transform src=site://transformers/templates/*show-bar*.xsl
Apart from the obligatory 'name' element, you can add any element you like as a child node of a level-element, as long as it only contains a text value.
When using multiple sitemenus (for example dutch and english site structures) you can provide a prefix-string that is added to all the url's in the sitemenu (this prefix can also contain slashes)
By default, the SitemenuModule uses the internal Cocoon SitemapURI for looking up the corresponding level element. If you want to use the browser's requestURI, set the property useSitemapURI to false.
The input module is configured as follows:
modules-sitemenu.xconf
<component-instance name="sitemenu" class="nl.hippo.cocoon.components.modules.input.SitemenuModule" logger="core.modules.sitemenu" useSitemapURI="true"> <cacheable>true</cacheable> <reloadable>true</reloadable> <file src="repository://content/project/nl/construction/sitemenu.xml" prefix="nl"/> <file src="repository://content/project/en/construction/sitemenu.xml" prefix="en"/> </component-instance>
If you want to use multiple sitemenu's you can specify them each seperatly as above, or use one cocoon pipeline that merges all sitemenu's into on file but then you will have to wrap your sitemenu with custom <level><name> elements in order to ensure no name collisions!
To keep track of any changes in the sitemenu, the key-value mappings are cached in a EventAwareTransientStore.
slide-jms-event-listener.xconf
<?xml version="1.0"?> <xconf xpath="/cocoon" unless="component[HIPPO:@role='nl.hippo.cocoon.caching.SlideJMSEventListener']" replace-properties="true"> <component class="nl.hippo.cocoon.caching.SlideJMSEventListener" role="nl.hippo.cocoon.caching.SlideJMSEventListener" logger="core.jms"> <parameter name="connection" value="${jms.connection}"/> <parameter name="topic" value="${jms.topic}"/> <parameter name="eventcache-role" value="org.apache.cocoon.caching.EventAwareManager"/> </component> </xconf>