The official documentation is at: http://docs.alfresco.com
The AVM Deployment Target is a target which is registered with the repository based WCM Deployment Engine. By default its target name is 'avm' although of course this can be changed through configuration.
The AVM Deployment Target receives a deployment from an Alfresco WCM authoring environment and puts the content into an AVM store where it can be used to support a dynamic web site.
The AVM Deployment Target has the following properties that can be configured/
store naming pattern
The pattern to use for creating the live store name. By default %storeName%-live.'
The alfresco explorer authoring environment creates assets with the path /www/avm_webapps. So the ROOT folder is deployed to /www/avm_webapps/ROOT.
The rootPath property allows you to specify the root of your live store. So if you don't want /www/avm_webapps set it to '/'. If you want '/banana/custard/ROOT' set it to '/banana/custard'
Extending the AVM Deployment Target
The prepare callbacks (which are also implementations of the same FSDeploymentRunnable interface used in postCommit callbacks) are called by the File System Deployment Targets immediately after the complete set of deployment files have been transferred to the AVM Deployment Targets's temporary storage areas.
If exceptions are thrown by the callbacks then the deployment will fail and be rolled back. The exception will be propagated to the system calling the AVM Deployment Target and the exception should be logged on both Deployment Engine and calling system.
The callbacks occur within the deployment transaction so should minimise the time they take to run since there are resources waiting for deployment to complete.
There is a postCommit callback available which is called after each successful deployment. For example some users of alfresco use ftp to transfer files or send emails when deployment is complete.
If exceptions are thrown by the callbacks then the exceptions will be logged. But it is too late to do anything else.
There is a sample adapter that will call an operating system command, such as a batch script, or the callback can call a custom java class.
The callback(s) are configured in the 'target' properties of the deployment configuration. They are called in sequence.
Diagram to show the FSDeploymentRunnable class
FSDeployment runnable class.jpg
Users need to implement the 'FSDeploymentRunnable' interface.
Two implementations are provided.
- SampleRunnable : an example java class that demonstrates how to use this feature
- ProgramRunnable : execute a operating system command after deployment
Example showing how to configre a post commit callback for an AVM Deployment Target
Migration from earlier versions of Alfresco
Versions of alfresco prior to 3.2 use a deployment receiver called ASR which places content in a remote AVM repository, the same requirement as the AVM Deployment Target. However, although the goal is similar, the ASR and the AVM Deployment Target are implemented very differently.
Web Project Configuration
In the web project settings.
Need to remove configuration for ASRs and replace it with configuration for web deployment receivers. The target name for the AVM Deployment Target is 'avm'. And the RMI Registry Port for alfresco is 50500 unless your system administrator has configured Alfresco to use a different port.
Live store names
The ASR names the live stores the same as the staging store. This is fine in most cases except for where the ASR is used to deploy to the same machine that has the authoring instance in which case the ASR attempts to avoid a circular dependency (or overwriting the source) by appending the destination store name with '-live'.
In order to have consistency between deploying to a local instance and deploying to a remote instance, the AVM deployment target always names live stores with the '-live' prefix. However the pattern that is used for naming of the stores can be changed to whatever you want so it is possible to configure the equivalent of the ASR's store names by removing the prefix on your live runtime.
The property is storeNamePattern on avm-target.xml.
By default it is '%storeName%-live'. Change it to '%storeName%' to get rid of the -live part. But please note that if you do this you will no longer be able to deploy to the local server.