ZimletWritingTip

From Zimbra :: Wiki

Jump to: navigation, search

Contents

Update(Use Zimbra Desktop for Zimlet Development)

Zimbra Desktop is a quicker & better alternative for Zimlet development. Please see  Zimlet Development via Zimbra Desktop for more tips and hacks.

Use _dev directory to cut down Zimlet development cycle

Typical software development involves the cycle fix -> build -> test -> fix ... It can be particularly cumbersome because Zimlets need to be deployed to the system in order to be tested. You might fix a typo in the xml, then need to deploy, possibly restart tomcat, then reload the browser to see the change.

There is a Zimlet dev directory to address this issue. It is a special location /opt/zimbra/tomcat/webapps/service/zimlet/_dev directory (replace /opt/zimbra/tomcat with your own Tomcat install directory). The Zimlets stored in the dev directory is read each time it's needed. For example, you can test the Hello World Zimlet by doing the following

 $ mkdir -p /opt/zimbra/tomcat/webapps/service/zimlet/_dev/com_zimbra_hello
 $ cp com_zimbra_hello.xml /opt/zimbra/tomcat/webapps/service/zimlet/_dev/com_zimbra_hello

ZCS 5.x Note: Since Tomcat has been replaced with Jetty, the directories are at /opt/zimbra/mailboxd/webapps/service...... instead of /opt/zimbra/tomcat... (Thanks tdesorbaix)

ZCS 6.x Note: There is now a dedicated directory for deployed zimlets. The _dev directory location has now moved to /opt/zimbra/zimlets_deployed.


Then simply reload the browser to load the new Zimlet in dev directory. Now you don't need to go through formal Zimlet lifecycle management of deploying and undeploying in order to test your new Zimlets. Each time you edit the contents in _dev directory, just reload the browser. When you are ready to deploy to the all the users, you can then create a zip bundle and deploy on the machines.

This feature is not supposed to be used on the production machines. Because the Zimlets in dev directory is read often it creates a lot of disk activity. Use dev directory only on your development box. Do not create dev directory on the production machines.

For even faster creation / testing this can be done on the Zimbra Desktop as well

The Zimbra Desktop is almost a complete clone of the Zimbra server. While there are no admin pages to add zimlets or command line tools to do so, the _dev feature works there as well in the /zdesktop/jetty/webapps/service/zimlet/ directory create a _dev directory and place your dev zimlets there as described above.

It is not recommended to use this as a substitute for real deployment testing. However, it is very convenient for development on a laptop while riding on a train or if uploading to the Zimbra server is inconvenient.

Javascript Debugger

Firefox has a browser extension named Firebug which is phenomenal.

Verified Against: unknown Date Created: 3/13/2006
Article ID: http://wiki.zimbra.com/index.php?title=ZimletWritingTip Date Modified: 01/23/2012


Personal tools