From 84f406bfd20ec2076cf7616e7f396ad480513bc4 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Mon, 10 Mar 2014 01:50:49 +0100 Subject: Add plugins/extension infrastructure Plugins are stored in `${baseFolder}/plugins` and are loaded during startup by the PluginManager. A plugin defines it's metadata in META-INF/MANIFEST.MF: Plugin-Class: com.gitblit.plugins.cookbook.CookbookPlugin Plugin-Dependencies: foo, bar Plugin-Id: gitblit-plugin Plugin-Provider: John Doe Plugin-Version: 1.0 Plugins can define extension points that can be implemented by other plugins and they can depend on other plugins: Plugin-Dependencies: foo, bar During the load phase, a directed acyclic graph is built and the loading order of the dependency chain is reversed using a topological sort; parent followed by children. The parent plugin classloader is the combined classloader of all parent plugins. Change-Id: I738821fa2bff02a5dbe339a944cc7e3c4dd8e299 --- src/main/distrib/data/gitblit.properties | 8 ++++ src/main/java/WEB-INF/web.xml | 3 +- src/main/java/com/gitblit/DaggerModule.java | 13 ++++- src/main/java/com/gitblit/FederationClient.java | 2 +- src/main/java/com/gitblit/GitBlit.java | 7 ++- src/main/java/com/gitblit/dagger/DaggerFilter.java | 2 +- .../java/com/gitblit/manager/GitblitManager.java | 18 ++++++- src/main/java/com/gitblit/manager/IGitblit.java | 3 +- .../java/com/gitblit/manager/IPluginManager.java | 39 +++++++++++++++ .../java/com/gitblit/manager/PluginManager.java | 56 ++++++++++++++++++++++ .../java/com/gitblit/servlet/GitblitContext.java | 2 + .../com/gitblit/servlet/SyndicationFilter.java | 1 + 12 files changed, 144 insertions(+), 10 deletions(-) create mode 100644 src/main/java/com/gitblit/manager/IPluginManager.java create mode 100644 src/main/java/com/gitblit/manager/PluginManager.java (limited to 'src') diff --git a/src/main/distrib/data/gitblit.properties b/src/main/distrib/data/gitblit.properties index 64a52f5c..762344b4 100644 --- a/src/main/distrib/data/gitblit.properties +++ b/src/main/distrib/data/gitblit.properties @@ -1844,3 +1844,11 @@ server.requireClientCertificates = false # SINCE 0.5.0 # RESTART REQUIRED server.shutdownPort = 8081 + +# Base folder for plugins. +# This folder may contain Gitblit plugins +# +# SINCE 1.6.0 +# RESTART REQUIRED +# BASEFOLDER +plugins.folder = ${baseFolder}/plugins diff --git a/src/main/java/WEB-INF/web.xml b/src/main/java/WEB-INF/web.xml index 1451ec63..77456d47 100644 --- a/src/main/java/WEB-INF/web.xml +++ b/src/main/java/WEB-INF/web.xml @@ -199,7 +199,6 @@ /robots.txt -