More advanced module techniques
If you managed to create your own module, you are ready to start using Coefficient as a basis for online collaboration. This section summarizes some of the advanced techniques you will need for more complex modules.
Coefficient modules without database access aren't useful. Luckily, Coefficient handles much of the mundane database operations for developers with the help of a tool called Hibernate. Hibernate is a popular object-relation tool; see Resources for more information.
To add a new class or table, you must create a Hibernate data class by adding XDoclet tags. The class is registered with the Coefficient runtime by inserting a static block to your module. Coefficient will handle all table creation and updates automatically at runtime, meaning you never touch any SQL. Refer to the existing modules for database examples.
Coefficient modules can also be used as project modules, meaning they can be added to projects as tools. The Discussion module is a good example of a project module. To develop a project module, you need to add it to the
/za/org/coefficient/projects namespace (the Wiki example is in the
/za/org/coefficient/navigation namespace) and extend
BaseProjectModule. When developing project modules, you must be aware of the current project, which is available from the
CoefficientContext object. Refer to the existing Coefficient modules for reference implementations.
The last type of module is a Theme module. Themes are used to determine the look and feel of Coefficient. You can alter the look to correspond to the specific needs of your organization by creating a module that extends the Theme class and adds itself to the
/za/org/coefficient/themes namespace. By altering various templates, you will be able to fine-tune the user interface. Refer to PlainWhiteTheme for an example.
Last but not least, is the Coefficient security model. Use the
getCurrentUser() method from
CoefficientContext to test if the current user is logged in and which user is executing the request. You can also override the module's
canExecute() method to check a module's authorization.
Many developers will get involved in online collaboration software during their careers. These developers will either develop collaboration features for their clients, or use collaboration software during the software development lifecycle.
Coefficient is a strong base for online collaboration and is almost immediately useful to a wide range of users. You can easily extend Coefficient to meet any of your organization's collaboration requirements.
Learn more about this topic
- Download the source code that accompanies this article
- Coefficient homepage
- XDoclet homepage
- Velocity homepage
- "Take the Fast Track to Text Generation," Leon Messerschmidt (JavaWorld, July 2001)
- Start Up the Velocity Template Engine," Geir Magnusson Jr. (JavaWorld, December 2001)
- Hibernate homepage
- For more articles on Java tools, browse the Development Tools section nof JavaWorld's Topical Index