Create a New Module
Here are some suggestions on how to create a new module hosted at Magnolia:
- Create Concept: http://wiki.magnolia-cms.com/display/DEV/Concepts
- Create jira issue or project: http://jira.magnolia-cms.com
- Create the module archetype: Follow the steps in http://wiki.magnolia-cms.com/display/WIKI/Module+QuickStart
- Import new project to java IDE, if using eclipse follow steps in http://wiki.magnolia-cms.com/display/WIKI/ModuleAndEclipse
- Add the project to SVN
The archetype
After running the plug-in you get two files:
MyModuleHandler.java: This module will be used to handle new versions no use for it the first time you create a module but it will be useful if in the next versions you decide to add new nodes, menu items...
MyModule.java: It's the configuration bean of the new module, you can extend it as you like and it will be automatically loaded into a bean using the Content2Bean class. In case your configuration doesn't follow the Content2Bean specification you can load your bean manually by iterating yourself over the nodes or give a class to get the configuration loaded into it.
One thing worth mention is the class ModuleLifecycle that you can implement in the module class, it allows you to perform actions on startup and shutdown (and thus restart) of your module.
A primer on the new archetype
MPARCH-9@jira, MPARCH-10@jira
For "internal" modules (i.e those on our svn), I just (2008-08-28) started a new archetype. I'll try to update the existing ones soon, because the new version (2.0) is much more powerful.
Here's how one could use it:
mvn archetype:generate -DarchetypeCatalog=local
That's it! All other options are asked by the plugin itself. Sweet.
2.0-alpha-4 will hopefully include my fix for ARCHETYPE-200, and hopefully will let us also rename all those mymodule directories as well as the module descriptor ! (ARCHETYPE-191)
Supposedly, after creating archetypes, one should generate the catalog and then upload it:
{{mvn archetype:crawl -DcatalogFile=archetype-catalog.xml}}http://maven.apache.org/plugins/maven-archetype-plugin/specification/archetype-catalog.html
http://maven.apache.org/plugins/maven-archetype-plugin/crawl-mojo.html
Whenever i figure out how the catalogs are supposed to be published, one will probably just have to point to the correct catalog with -DarchetypeCatalog instead of using the local one.
Hosting a module on Magnolia's SVN
If you haven't done this before:
svn co --depth files http://svn.magnolia-cms.com/svn/community/modules/
This will checkout a few scripts which will come in handy if you need to edit all modules. It also has a script to add a module directory with the appropriate structure.
If you've checked this out before, update it!
To add the module itself:
./newmodule.sh my-module-name
Manual step for now: add svn:ignore !