summaryrefslogtreecommitdiffstats
path: root/src/site/plugins_extensions.mkd
diff options
context:
space:
mode:
authorJames Moger <james.moger@gitblit.com>2014-04-12 12:26:17 -0400
committerJames Moger <james.moger@gitblit.com>2014-04-12 12:26:17 -0400
commitc5dfd60d174a9841e64e4097cecab5aea5c422d0 (patch)
tree4d5c1fb8a266fd9fec64f5ea88fa16adb37fe360 /src/site/plugins_extensions.mkd
parentba567069542e1f6769097ff78cd9612a9f08eb83 (diff)
downloadgitblit-c5dfd60d174a9841e64e4097cecab5aea5c422d0.tar.gz
gitblit-c5dfd60d174a9841e64e4097cecab5aea5c422d0.zip
Documentation
Diffstat (limited to 'src/site/plugins_extensions.mkd')
-rw-r--r--src/site/plugins_extensions.mkd115
1 files changed, 115 insertions, 0 deletions
diff --git a/src/site/plugins_extensions.mkd b/src/site/plugins_extensions.mkd
new file mode 100644
index 00000000..d7469ac6
--- /dev/null
+++ b/src/site/plugins_extensions.mkd
@@ -0,0 +1,115 @@
+## Extension Points
+
+Gitblit offers several extension points for enhancing and customizing it's runtime behavior.
+
+Each available extension point has a sample implementation in the [gitblit-cookbook-plugin (Maven project)](https://dev.gitblit.com/summary/gitblit-cookbook-plugin.git).
+
+### SSH Dispatch Command
+
+*SINCE 1.5.0*
+
+You can provide your own custom SSH commands by subclassing the *DispatchCommand* class.
+
+```java
+import ro.fortsoft.pf4j.Extension;
+
+import com.gitblit.models.UserModel;
+import com.gitblit.transport.ssh.commands.CommandMetaData;
+import com.gitblit.transport.ssh.commands.DispatchCommand;
+
+@Extension
+@CommandMetaData(name = "mycommands", description = "Sample SSH dispatcher")
+public class MyDispatcher extends DispatchCommand {
+
+ @Override
+ protected void setup(UserModel user) {
+ // commands in this dispatcher
+ register(user, CommandA.class);
+ register(user, CommandB.class);
+
+ // nested dispatchers
+ register(user, SubDispatcher1.class);
+ register(user, SubDispatcher2.class);
+ }
+}
+```
+
+### Pre- and Post- Receive Hook
+
+*SINCE 1.5.0*
+
+You can provide your own custom pre and/or post receive hooks by subclassing the *ReceiveHook* class.
+
+```java
+import com.gitblit.extensions.ReceiveHook;
+import java.util.Collection;
+import org.eclipse.jgit.transport.ReceiveCommand;
+import ro.fortsoft.pf4j.Extension;
+
+@Extension
+public class MyReceiveHook extends ReceiveHook {
+
+ @Override
+ public void onPreReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) {
+ }
+
+ @Override
+ public void onPostReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) {
+ }
+}
+
+```
+
+### Patchset Hook
+
+*SINCE 1.5.0*
+
+You can provide your own custom patchset hook by subclassing the *PatchsetHook* class.
+
+```java
+import com.gitblit.extensions.PatchsetHook;
+import com.gitblit.models.TicketModel;
+import ro.fortsoft.pf4j.Extension;
+
+@Extension
+public class MyPatchsetHook extends PatchsetHook {
+
+ @Override
+ public void onNewPatchset(TicketModel ticket) {
+ }
+
+ @Override
+ public void onUpdatePatchset(TicketModel ticket) {
+ }
+
+ @Override
+ public void onMergePatchset(TicketModel ticket) {
+ }
+}
+```
+
+### Ticket Hook
+
+*SINCE 1.5.0*
+
+You can provide your own custom ticket hook by subclassing the *TicketHook* class.
+
+```java
+import com.gitblit.extensions.TicketHook;
+import com.gitblit.models.TicketModel;
+import com.gitblit.models.TicketModel.Change;
+import ro.fortsoft.pf4j.Extension;
+
+@Extension
+public class MyTicketHook extends TicketHook {
+
+ @Override
+ public void onNewTicket(TicketModel ticket) {
+ }
+
+ @Override
+ public void onUpdateTicket(TicketModel ticket, Change change) {
+ }
+}
+```
+