This repo contains examples to help understand how to develop a extension for Zimbra Server.
This examples are based on the following documentations:
- Zimbra 2010 Blog Post: Extending Zimbra with Server Extensions
- Blog de dieploegers: Creating Zimbra Server Extensions Quickstart
- Zimbra Github repo
The included Vagrant is ready start using this examples, but it you want to build a development environment on your own, this environment should comply with:
- Zimbra >= 8.6,
- Development tools installed,
- Java development tools installed,
ant
andmaven
tools instaled,
All the Docs assume that you are using the Vagrant VM, if you are not using it you have to take into account:
- The Webmail Port:
7080
is how the Vagrant VM is configured, sudo
: the examples usesudo
a lot, you may just run everything likeroot
- Clone the repo
- Startup the Vagrant machine
- Wait for Vagrant
- Change to the example and read the readme
All commands must be run on the Vagrant vm
$ vagrant ssh
build
, folder where the*.class
bytecode files are stored,conf
, folder of theExtension
configuration,dist
, folder where theExtension.jar
file is saved,src
, the source code of the extension,
On every example there is a ./conf/MANIFEST.MF
file, where the extension name is declared:
Zimbra-Extension-Class: com.zboxapp.HttpExtension
All the examples on this repo belongs to the com.zboxapp
package.
Inside every example there is a build.xml
file, which contains the magic to compile the extension. The basic content of this file is as follows:
<!-- Name of the Extension -->
<project name="HttpExtension" default="jar">
<!-- Define a couple of variables (property) -->
<property name="zimbra.root.dir" location="/opt/zimbra"></property>
<!-- Libraries need on compile time -->
<property name="common.jars.dir" location="${zimbra.root.dir}/lib/jars"></property>
<!-- Set the CLASS PATH: Java libs -->
<path id="class.path">
<!-- Add all the jars to the CLASS PATH -->
<fileset dir="${common.jars.dir}">
<include name="**/*.jar"></include>
</fileset>
</path>
<!-- Compile Taks -->
<target name="compile" description="Compiles the source code">
<path id="all.java.path">
<pathelement location="src"></pathelement>
</path>
<javac includeantruntime="false" destdir="build" debug="true" classpathref="class.path">
<src refid="all.java.path"></src>
</javac>
</target>
<!-- Create jar file task -->
<target name="jar" depends="compile" description="Creates the jar file">
<jar manifest="conf/MANIFEST.MF" destfile="dist/HttpExtension.jar" basedir="build"></jar>
</target>
</project>
- HttpExtension, shows how to add a new Endpoint on Zimbra server to process a http request.