By Anton [email protected]
Effective websites development using Magnolia CMS
Agenda
• Introduction• Increasing the effectiveness of websites
development1. Preview template changes instantly2. Optimize ModuleVersionHandlers3. Use OCM libraries for writing business logic
code
About Devexperts
We create
professional financial software
for Brokerage and Exchanges
since 2002
About Devexperts
Headquarters
197110, 10/1 Barochnaya st.
Saint Petersburg, Russia
+7 812 438 16 26
www.devexperts.comDevexperts Japan
〒 169-0075東京都新宿区高田馬場 1-33-15-402
+81 3 6233 7460
Project architecture
Jackrabbit
Magnolia CMS3 websites
HTML pages for other apps
Applicationservers
Cloudservices
3rd party services
Desktop
application
Project environment
• Weekly releases• 2-3 intermediate builds per week• Aggressive schedule• Up to 5 developers working on the same
Magnolia project module
Project is in closed beta-testing stage
Project environment
Subversio
n
Integratio
n
platform
QA
platform
Production
platform
1. Preview template changes instantly
Problems
• Editing of website templates is slow
• Changes made in Magnolia CMS need to be synchronized with module source files
• Magnolia CMS restart is required to pick up changes made in module source files
Solution: dx-sync-module
• Synchronizes external files with Magnolia CMS resources instantly– JavaScript– CSS– DMS files– JSP and Freemarker templates– Groovy scripts and classes
dx-sync-module approach
Version
control
Project files under
version control
Magnolia CMS
Up and running
Changes in source files are instantly propagated to Magnolia CMS
dx-sync-module demo
dx-sync-module: benefits
• Instant preview of changes in source files• Reduced number of actions when working
with AdminCentral• Decreased number of Magnolia CMS
restarts– Using Groovy may decrease number of
restarts further• Developed for large project, helps with
small projects
2. Optimize ModuleVersionHandlers
Problems
• 2 execution flows: one for install and one for update
• Easy to forget to update module version handler when a file or XML resource is changed
• Version handlers become very large for intensively developing module
A new approach toModuleVersionHandlers
Idea: forget about deltas
Describe module configuration as it should beConfiguration is ‘synchronized’, not ‘updated’
DxModuleVersionHandler
• Describe updating strategy for each resource• Strategies supported:
– Keep up to date– Install once– Remove
• A part of dx-sync-module
DxModuleVersionHandlermodule files
• Describe how files are updated in ModuleVersionHandler class
DxModuleVersionHandlerXML resources
• Put XML resources to the correct place
DxModuleVersionHandler
Takes care of:• Exported XML files• Resources (CSS, JavaScript)• Templates (Freemarker, JSP)• Groovy (classes and scripts)• Module servlets• Module files
Just put a file to the right place and it will be updated next time Magnolia CMS starts
DxModuleVersionHandler: benefits
• The same configuration mechanism is used for both install and update
• Less code• Significantly reduced number of bugs
Increases developers efficiency
dx-sync-module - links
• Documentationhttp://code.devexperts.com/display/DXMGNL/dx-sync-module
• JIRA http://jira.magnolia-cms.com/browse/DXSYNC
• Maven http://nexus.magnolia-cms.com/content/repositories/magnolia.forge.releases/
• Questions, suggestions and [email protected]
3. Use OCM libraries for writing business logic code
Use OCM for business logic code
Before OCM
Use OCM for business logic code
After OCM
Object Content Mapping libraries
• Magnolia CMS Content2Bean mechanism– Read only
• Jackrabbit OCM– http://jackrabbit.apache.org/object-content-mapping.html
• Magnolia Jackrabbit OCM Integration– http://
www.fastforward.ch/web/ff/dokumentation/entwickler/magnolia-module-ocm.html
• Devexperts Jackrabbit OCM integration for Magnolia– http://code.devexperts.com/display/DXMGNL/dx-magnolia-ocm
dx-magnolia-ocm
• Doesn’t depend on Magnolia– May be used to read Magnolia Jackrabbit
database from other applications• Type safe• Library, not a module• Configuration via annotations
– Keep all information at the same place
dx-magnolia-ocm - links
• Documentationhttp://code.devexperts.com/display/DXMGNL/dx-magnolia-ocm
• JIRA and Mavencoming very soon
• Questions, suggestions and [email protected]
Questions?