Plugin-API - Plugins

A plugin is a classpath element (JAR-file or directory with class files) which contains a plugin descriptor file and implements at least the IActivatorinterface (see below).

Plugin Locations

By default, SmartSVN searches for plugin JAR files in the <settings-dir>/plugins and the <install-dir>/plugins directories (this order). Using the Java system property smartsvn.pluginLocationsyou can change the search path, e.g. for debugging. Separate each location with the platform-specific File.pathSeparator, for example, a semicolon on Windows. To load all .jar files from a directory, use the location /myplugins/*.jar. To load a special JAR file, use the location /path/myplugin.jar. To load a plugin from a directory, e.g. during plugin development, use the location /path/myplugin/classes.

Other JAR-Files

A plugin can access all classes which are located in the SmartSVN class path, e.g. the openapi.jar, the svnkit.jar or the layout.jar. If your plugin needs further JAR files, place them in the 'common' directory. For the 'common' directory all contained JAR files will be loaded. (Note that this is different for the 'plugins' directory. Here only those JAR files will be loaded which actually contain a plugin.)

By default, SmartSVN can load additional JAR files from the <settings-dir>/plugins/common and the <install-dir>/plugins/common directories (this order). Using the Java system property smartsvn.pluginCommonLocationsyou can change the search path, e.g. for debugging. Separate each location with the platform-specific File.pathSeparator, for example, a semicolon on Windows. To load all .jar files from a directory, specify the directory /myplugins/mycommonlibs. To load a special JAR file, use the location /path/myjarfile.jar.

Plugin Descriptor File

Each plugin must have a file plugin.properties in the default package. It looks like:

identifier=com.syntevo.custom-properties
activatorClass=com.syntevo.plugin.customproperties.CustomPropertiesPlugin
minApiVersion=0.0.1
maxApiVersion=0.0.1

The required identifiervalue should be unique. If multiple plugins have the same identifier, only one of them will be loaded (it's not determined which one will be loaded).

The required activatorClassis the class name of the plugin's activator. The activator class must be public, implement the IActivatorinterface and have a public parameterless constructor. It will be instantiated by SmartSVN and the method initialize(SmartSvnServices)will be invoked at start-up.

You can define other properties like minApiVersion, maxApiVersion, minJreVersionand maxJreVersionto define to what API version (IActivator.VERSIONcontains the current version) the plugin is compatible and which Java version it requires. If, for example, just the minJreVersionis defined, the plugin will be loaded for the specified Java version and all newer versions.

The API

The Plugin-API consists primarily of interfaces and a couple utility classes. Interfaces which start with an I, e.g. IActivatorare designed to be implemented by plugin authors. All other interfaces define services provided by SmartSVN and are not designed to be implemented by the plugin author.

All possible extension points are provided indirectly by the SmartSvnServicesinterface which is passed to the IActivator.initializemethod as parameter. The only exception is the LoggerFactorywhich can be invoked from a static context like this is usually done for logging classes.