There are three ways of extending Alfresco:
- Put the code in the webapp folder (alfresco/tomcat/webapps/alfresco)
- Put the code in the alfresco repository
- Create an AMP file and add it to alfresco.war
There are different benefits and drawbacks to each method:
Put the code in the webapp folder
It’s an easy way to quickly test the changes one have made, but the moment the war-file is reloaded by tomcat, the added files and changes are lost.
Put the code in the alfresco repository
When logging into Alfresco Explorer as Admin, one get access to the Data Dictionary space located within Company Home. The data dictionary contains code used by Alfresco users like email and Freemarker templates which notifies users of an invitation to a space, RSS feeds, searches, scripts, web scripts and space templates. The data dictionary space can be used to create our own custom actions on documents, spaces etc.
This option is an easy way for most users to create their own actions and test them out without restarting Alfresco, but can be a bit of a hassle when one need to change the script, upload it and test it out.
Create an AMP (Alfresco Module Package) file and add it to alfresco.war
This is the recommended way for creating modules in Alfresco. Creating a package makes the deployment of modules easy, but when tomcat notices the alfresco war-file has changed then Alfresco is reloaded and all users are kicked out of their session. The bad part is that it usually takes about a minute to reload alfresco on a development machine. One minute for every change… well, it does hurt sometimes.
Another thing that hurts.. when writing this there are no way of uninstalling an amp. The way of uninstalling a module is to revert to the alfresco.war file that was saved as backup before installing the amp. So, if one installs other modules afterwards, then one have to revert to the backup war-file, then install all the other modules again…. Ridiculous! AND – after removing a module from alfresco, one get a nice warning text in the log about Alfresco not being able to find the module. I really hope Alfresco will add uninstall functionality in the near future to its Module Management Tool that installs the amps.
The good/bad part (you decide) is that once the amp is deployed, alfresco has reloaded and installed the module, one can edit the deployed files and alfresco *should* (add some grain of salt here) recognize changes made without any restart/reload. But then suddenly we are back into option number one.