Dispatcher quickstart
Intended Audience
People who are helping to develop the Dispatcher.
Purpose
This document will get you started. We will Dispatcher-enable an existing site and show how to add/remove ready-made contacts. Then we will discuss how add your own new contracts.
This document encourages developers to get involved with fine-tuning and testing the dispatcher. Please help to enhance the current core contracts so that people do not need to re-invent the wheel.
Prerequisites
- Using Forrest trunk of SVN (i.e. head of development).
- Followed the installation instructions below.
- You have an existing forrest site and want to try the new Dispatcher. Otherwise create a 'forrest seed-sample' site.
Steps
Installing a mozilla browser and the Forrestbar helps a lot with developing, but is not necessary.
Get ready
- Do 'svn update' on forrest/trunk
- Do the 'cd main; build clean; build' (necessary because the Dispatcher is changing rapidly and uses some Java)
Dispatcher-enable the existing site
- Add the new plugins to forrest.properties ... ,org.apache.forrest.plugin.internal.dispatcher,org.apache.forrest.themes.core,org.apache.forrest.plugin.output.inputModule
- localhost:8888/index.html ... fantastic. See the pelt view.
Use another theme
- Add <property name="dispatcher.theme" value="common"/> to your forrest.properties.xml
- Re-start 'forrest run'
- localhost:8888/index.html ... See the new view.
Create our own structurer by copy-and-customise
Copy the default structurer for the pelt theme and make local changes.
- Copy THEMER_PLUGIN/themes/pelt.fv into your project at ${themer.project.dir}/pelt.fv
- Copy THEMER_PLUGIN/themes/pelt/panels/pelt-html.panel.xml into your project at ${themer.project.dir}/pelt/panels/pelt-html.panel.xml
- Re-start 'forrest run'
- localhost:8888/index.html ... See the same view, now structured by us.
From here on there is no need to re-start 'forrest run'. Just edit the structurer and see the effect.
Remove a default contract
- Remove the top breadcrumb trail. Edit your pelt-html.panel.xml and find the "branding-breadcrumbs" contract and comment it out.
Add a default contract
Forrest provides many default contracts. If you are using the Forrestbar then choose "Devs => ls.contracts". Otherwise visit localhost:8888/ls.contracts.html
- See the usage detail for your chosen contract via the above mentioned list. e.g. "siteinfo-current-time"
-
Insert it at the appropriate point in your structurer. Note that it
will need to go inside the appropriate CSS hook, e.g.
... <forrest:hook name="footer"> <forrest:contract name="siteinfo-current-time"/> ...
Notice that you did not need to copy any other code to your project space. Forrest finds the default contract in its core (the themes.core plugin).
You will find some commonly used contracts in place but commented out in both the common and the pelt structurer files. Feel free to uncomment them to activate them, move them around into other hooks or create new hooks for them.
Add a new project contract
Project-based contracts are defined in theme-specific and output-format-specific directory structure, e.g. ${themer.project.dir}/THEME_NAME/OUTPUT_FORMAT/
Project-based contracts common to all themes go in ${themer.project.dir}/common/OUTPUT_FORMAT/
To get started quickly (it is not a project-based contract but a demo), copy one of the default contracts. e.g. copy siteinfo-current-time.ft to become siteinfo-doodad.ft ...
- Copy THEMER_PLUGIN/themes/common/html/siteinfo-current-time.ft into your project at ${themer.project.dir}/common/html/siteinfo-doodad.ft (create the new directory folders first).
- Edit it to suit. Replace all occurrences of "siteinfo-current-time" with "siteinfo-doodad" and make your other changes (e.g. the text and the javascript function).
- Declare your new contract in your structurer as done above for adding a default contract.
See a list of your project-based contracts and their usage notes via Forrestbar "Devs => ls.contracts.project". Otherwise visit localhost:8888/ls.contracts.project.html
Decide how to manage your contracts
Further Reading
Congratulations you are now able to work with the Dispatcher. From here we recommend to read the following How-Tos:
Feedback
Please provide feedback about this document via the mailing lists.