commit | author | age
|
48fe87
|
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
M |
2 |
<html> |
|
3 |
<head> |
|
4 |
<!-- Begin Header -->
|
|
5 |
<title>Gitblit</title>
|
|
6 |
<meta charset="utf-8">
|
|
7 |
<meta name="ROBOTS" content="INDEX">
|
|
8 |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
9 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
10 |
|
|
11 |
<link rel="stylesheet" href="./bootstrap/css/bootstrap.css"> |
|
12 |
<link rel='shortcut icon' type='image/png' href='./gitblt-favicon.png' /> |
|
13 |
<link rel="stylesheet" href="./prettify/prettify.css" /> |
|
14 |
<!-- Google Plus Profile Page -->
|
|
15 |
<link rel="publisher" href="https://plus.google.com/114464678392593421684" />
|
|
16 |
<style type="text/css"> a.gpluspage { margin-top:3px;text-decoration: none; } </style> |
|
17 |
|
|
18 |
<!-- Google Plus One -->
|
|
19 |
<link rel="canonical" href="http://gitblit.com" />
|
|
20 |
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
|
|
21 |
<style type="text/css"> div.gplusone { margin-top:12px; } </style> |
|
22 |
|
|
23 |
<script src="./prettify/prettify.js"></script> |
|
24 |
<script src="./bootstrap/js/jquery.js"></script> |
|
25 |
<script src="./bootstrap/js/bootstrap.min.js"></script> |
|
26 |
</head> |
|
27 |
<body onload='prettyPrint()'> <!-- Navigation Bar -->
|
|
28 |
<div class="navbar navbar-fixed-top">
|
|
29 |
<div class="navbar-inner">
|
|
30 |
<div class="container">
|
|
31 |
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
|
32 |
<span class="icon-bar"></span>
|
|
33 |
<span class="icon-bar"></span>
|
|
34 |
<span class="icon-bar"></span>
|
|
35 |
</a>
|
|
36 |
<a class="brand" href="./"><img src="./gitblt_25_white.png" alt="Gitblit"></img></a>
|
|
37 |
<div class="nav-collapse">
|
|
38 |
<ul class="nav">
|
|
39 |
<li class='dropdown'> <!-- Menu --> |
|
40 |
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>about<b class='caret'></b></a> |
|
41 |
<ul class='dropdown-menu'> |
|
42 |
<li><a href='index.html'>overview</a></li> |
|
43 |
<li><a href='features.html'>features</a></li> |
|
44 |
<li><a href='screenshots.html'>screenshots</a></li> |
|
45 |
</ul></li> <!-- End Menu --> |
|
46 |
<li class='dropdown'> <!-- Menu --> |
|
47 |
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>documentation<b class='caret'></b></a> |
|
48 |
<ul class='dropdown-menu'> |
|
49 |
<li class='dropdown-submenu'> <!-- Submenu --> |
|
50 |
<a tabindex='-1' href='#'>Gitblit GO</a> |
|
51 |
<ul class='dropdown-menu'> |
|
52 |
<li><a href='setup_go.html'>setup GO</a></li> |
|
53 |
<li><a href='upgrade_go.html'>upgrade GO</a></li> |
|
54 |
</ul></li> <!-- End Submenu --> |
|
55 |
<li class='divider'></li> |
|
56 |
<li class='dropdown-submenu'> <!-- Submenu --> |
|
57 |
<a tabindex='-1' href='#'>Gitblit WAR</a> |
|
58 |
<ul class='dropdown-menu'> |
|
59 |
<li><a href='setup_war.html'>setup WAR</a></li> |
|
60 |
<li><a href='upgrade_war.html'>upgrade WAR</a></li> |
|
61 |
</ul></li> <!-- End Submenu --> |
|
62 |
<li class='divider'></li> |
|
63 |
<li class='dropdown-submenu'> <!-- Submenu --> |
|
64 |
<a tabindex='-1' href='#'>Server Configuration</a> |
|
65 |
<ul class='dropdown-menu'> |
|
66 |
<li><a href='administration.html'>administration</a></li> |
|
67 |
<li><a href='setup_authentication.html'>authentication</a></li> |
|
68 |
<li><a href='setup_hooks.html'>push hooks</a></li> |
|
69 |
<li><a href='setup_lucene.html'>lucene indexing</a></li> |
|
70 |
<li><a href='setup_proxy.html'>reverse proxies</a></li> |
|
71 |
<li><a href='setup_clientmenus.html'>client app menus</a></li> |
|
72 |
<li><a href='setup_bugtraq.html'>bugtraq</a></li> |
|
73 |
<li><a href='setup_mirrors.html'>mirrors</a></li> |
|
74 |
<li><a href='setup_scaling.html'>scaling</a></li> |
5287d2
|
75 |
<li><a href='setup_fail2ban.html'>fail2ban</a></li> |
48fe87
|
76 |
<li class='divider'></li> |
M |
77 |
<li><a href='setup_viewer.html'>Gitblit as a viewer</a></li> |
|
78 |
</ul></li> <!-- End Submenu --> |
|
79 |
<li class='divider'></li> |
|
80 |
<li class='dropdown-submenu'> <!-- Submenu --> |
|
81 |
<a tabindex='-1' href='#'>Client Usage</a> |
|
82 |
<ul class='dropdown-menu'> |
|
83 |
<li><a href='setup_transport_http.html'>using HTTP/HTTPS</a></li> |
|
84 |
<li><a href='setup_transport_ssh.html'>using SSH</a></li> |
|
85 |
<li><a href='eclipse_plugin.html'>using the Eclipse plugin</a></li> |
|
86 |
</ul></li> <!-- End Submenu --> |
|
87 |
<li class='divider'></li> |
|
88 |
<li class='dropdown-submenu'> <!-- Submenu --> |
|
89 |
<a tabindex='-1' href='#'>Tickets</a> |
|
90 |
<ul class='dropdown-menu'> |
|
91 |
<li><a href='tickets_overview.html'>overview</a></li> |
|
92 |
<li><a href='tickets_using.html'>using</a></li> |
|
93 |
<li><a href='tickets_barnum.html'>barnum</a></li> |
|
94 |
<li><a href='tickets_setup.html'>setup</a></li> |
|
95 |
<li><a href='tickets_replication.html'>replication & advanced administration</a></li> |
|
96 |
</ul></li> <!-- End Submenu --> |
|
97 |
<li class='divider'></li> |
|
98 |
<li class='dropdown-submenu'> <!-- Submenu --> |
|
99 |
<a tabindex='-1' href='#'>Plugins</a> |
|
100 |
<ul class='dropdown-menu'> |
|
101 |
<li><a href='plugins_overview.html'>overview</a></li> |
|
102 |
<li><a href='plugins_extensions.html'>extension points</a></li> |
|
103 |
</ul></li> <!-- End Submenu --> |
|
104 |
<li class='divider'></li> |
|
105 |
<li><a href='federation.html'>federation</a></li> |
|
106 |
<li class='divider'></li> |
|
107 |
<li><a href='properties.html'>settings</a></li> |
|
108 |
<li><a href='faq.html'>faq</a></li> |
|
109 |
<li class='divider'></li> |
|
110 |
<li><a href='design.html'>design</a></li> |
|
111 |
<li><a href='rpc.html'>rpc</a></li> |
|
112 |
</ul></li> <!-- End Menu --> |
|
113 |
<li class='dropdown'> <!-- Menu --> |
|
114 |
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>releases<b class='caret'></b></a> |
|
115 |
<ul class='dropdown-menu'> |
|
116 |
<li><a href='releasenotes.html'>release notes</a></li> |
|
117 |
<li><a href='releases.html'>release history</a></li> |
|
118 |
</ul></li> <!-- End Menu --> |
|
119 |
<li class='dropdown'> <!-- Menu --> |
|
120 |
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>downloads<b class='caret'></b></a> |
|
121 |
<ul class='dropdown-menu'> |
678348
|
122 |
<li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.zip'>Gitblit GO (Windows)</a></li> |
M |
123 |
<li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.tar.gz'>Gitblit GO (Linux/OSX)</a></li> |
|
124 |
<li><a href='http://dl.bintray.com/gitblit/releases/gitblit-1.7.1.war'>Gitblit WAR</a></li> |
48fe87
|
125 |
<li class='divider'></li> |
M |
126 |
<li><a href='https://registry.hub.docker.com/u/jmoger/gitblit/'>Gitblit GO (Docker)</a></li> |
|
127 |
<li class='divider'></li> |
|
128 |
<li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li> |
|
129 |
<li class='divider'></li> |
678348
|
130 |
<li><a href='http://dl.bintray.com/gitblit/releases/manager-1.7.1.zip'>Gitblit Manager</a></li> |
M |
131 |
<li><a href='http://dl.bintray.com/gitblit/releases/fedclient-1.7.1.zip'>Federation Client</a></li> |
48fe87
|
132 |
<li class='divider'></li> |
678348
|
133 |
<li><a href='http://dl.bintray.com/gitblit/releases/gbapi-1.7.1.zip'>API Library</a></li> |
48fe87
|
134 |
<li class='divider'></li> |
M |
135 |
<li><a href='https://bintray.com/gitblit/releases/gitblit'>Bintray (1.4.0+)</a></li> |
|
136 |
<li><a href='https://code.google.com/p/gitblit/downloads/list?can=1'>GoogleCode (pre-1.4.0)</a></li> |
|
137 |
<li class='divider'></li> |
|
138 |
<li><a href='http://gitblit.github.io/gitblit-maven'>Maven Repository</a></li> |
|
139 |
</ul></li> <!-- End Menu --> |
|
140 |
<li class='dropdown'> <!-- Menu --> |
|
141 |
<a class='dropdown-toggle' href='#' data-toggle='dropdown'>links<b class='caret'></b></a> |
|
142 |
<ul class='dropdown-menu'> |
|
143 |
<li><a href='https://dev.gitblit.com'>dev.gitblit.com (self-hosted)</a></li> |
|
144 |
<li class='divider'></li> |
|
145 |
<li><a href='http://plugins.gitblit.com'>Plugins Registry</a></li> |
|
146 |
<li class='divider'></li> |
|
147 |
<li><a href='https://github.com/gitblit/gitblit'>Github</a></li> |
5287d2
|
148 |
<li><a href='https://github.com/gitblit/gitblit'>Issues</a></li> |
48fe87
|
149 |
<li><a href='http://groups.google.com/group/gitblit'>Discussion</a></li> |
M |
150 |
<li><a href='https://twitter.com/gitblit'>Twitter</a></li> |
|
151 |
<li><a href='http://www.ohloh.net/p/gitblit'>Ohloh</a></li> |
584328
|
152 |
<li class='divider'></li> |
M |
153 |
<li><a href='https://vimeo.com/86164723'>Gitblit Tickets screencast</a></li> |
|
154 |
<li><a href='https://asciinema.org/a/9342'>Gitblit SSH and Plugin Management asciicast</a></li> |
|
155 |
<li><a href='http://episodes.gitminutes.com/2014/05/gitminutes-29-james-moger-on-gitblit.html'>GitMinutes #29: James Moger on Gitblit</a></li> |
48fe87
|
156 |
<li class='divider'></li> |
M |
157 |
<li><a href='https://twitter.com/JamesMoger'>@JamesMoger</a></li> |
|
158 |
</ul></li> <!-- End Menu --> |
|
159 |
<li class='divider-vertical'></li> |
|
160 |
<li><a href='https://plus.google.com/114464678392593421684?prsrc=3' class='gpluspage'><img src='https://ssl.gstatic.com/images/icons/gplus-16.png' width='16' height='16 style='order: 0;'/></a></li><li><div class='gplusone'><g:plusone size='small' href='http://gitblit.com'></g:plusone></div></li>
|
|
161 |
</ul>
|
|
162 |
</div><!--/.nav-collapse -->
|
|
163 |
</div>
|
|
164 |
</div>
|
|
165 |
</div><!-- end Navigation Bar --> |
|
166 |
<div class='container'> |
|
167 |
<!-- Begin Markdown --> |
|
168 |
<h2 class="section" id='H1'><a href="#H1" class="sectionlink"><i class="icon-share-alt"> </i></a>Extension Points</h2><p>Gitblit offers several extension points for enhancing and customizing it's runtime behavior.</p><p>Each available extension point has a sample implementation in the <a href="https://github.com/gitblit/gitblit-cookbook-plugin">gitblit-cookbook-plugin (Maven project)</a>.</p><p><strong>NOTE:</strong><br/>Gitblit does not yet offer a comprehensize dependency injection architecture. This will be addressed in a subsequent release. For now you may access all of Gitblit's core managers through a static singleton app context:</p><p><pre>import com.gitblit.extensions.GitblitPlugin; |
|
169 |
import com.gitblit.servlet.GitblitContext; |
|
170 |
import com.gitblit.manager.IRuntimeManager; |
|
171 |
import com.gitblit.manager.IUserManager; |
|
172 |
import com.gitblit.manager.IAuthenticationManager; |
|
173 |
import com.gitblit.manager.INotificationManager; |
|
174 |
import com.gitblit.manager.IRepositoryManager; |
|
175 |
import com.gitblit.manager.IProjectManager; |
|
176 |
import com.gitblit.manager.IFederationManager; |
|
177 |
import com.gitblit.manager.IPluginManager; |
|
178 |
import com.gitblit.manager.IGitblit; |
|
179 |
import ro.fortsoft.pf4j.Version; |
|
180 |
|
|
181 |
public class ExamplePlugin extends GitblitPlugin { |
|
182 |
|
|
183 |
@Override |
|
184 |
public void start() { |
|
185 |
IRuntimeManager runtime = GitblitContext.getManager(IRuntimeManager.class); |
|
186 |
IUserManager users = GitblitContext.getManager(IUserManager.class); |
|
187 |
IAuthenticationManager auth = GitblitContext.getManager(IAuthenticationManager.class); |
|
188 |
INotificationManager notifications = GitblitContext.getManager(INotificationManager.class); |
|
189 |
IRepositoryManager repos = GitblitContext.getManager(IRepositoryManager.class); |
|
190 |
IProjectManager projects = GitblitContext.getManager(IProjectManager.class); |
|
191 |
IFederationManager federation = GitblitContext.getManager(IFederationManager.class); |
|
192 |
IPluginManager plugins = GitblitContext.getManager(IPluginManager.class); |
|
193 |
IGitblit gitblit = GitblitContext.getManager(IGitblit.class); |
|
194 |
} |
|
195 |
|
|
196 |
@Override |
|
197 |
public void stop() { |
|
198 |
} |
|
199 |
|
|
200 |
@Override |
|
201 |
public void onInstall() { |
|
202 |
} |
|
203 |
|
|
204 |
@Override |
|
205 |
public void onUpgrade(Version oldVersion) { |
|
206 |
} |
|
207 |
|
|
208 |
@Override |
|
209 |
public void onUninstall() { |
|
210 |
} |
|
211 |
} |
|
212 |
|
|
213 |
/** |
|
214 |
* You can also create Webapp plugins that register pages. |
|
215 |
*/ |
|
216 |
public class ExampleWicketPlugin extends GitblitWicketPlugin { |
|
217 |
@Override |
|
218 |
public void start() { |
|
219 |
} |
|
220 |
|
|
221 |
@Override |
|
222 |
public void stop() { |
|
223 |
} |
|
224 |
|
|
225 |
@Override |
|
226 |
public void onInstall() { |
|
227 |
} |
|
228 |
|
|
229 |
@Override |
|
230 |
public void onUpgrade(Version oldVersion) { |
|
231 |
} |
|
232 |
|
|
233 |
@Override |
|
234 |
public void onUninstall() { |
|
235 |
} |
|
236 |
|
|
237 |
@Override |
|
238 |
protected void init(GitblitWicketApp app) { |
|
239 |
app.mount("/logo", LogoPage.class); |
|
240 |
app.mount("/hello", HelloWorldPage.class); |
|
241 |
} |
|
242 |
} |
|
243 |
</pre></p> |
|
244 |
<h3 class="section" id='H2'><a href="#H2" class="sectionlink"><i class="icon-share-alt"> </i></a>SSH Dispatch Command</h3><p><em>SINCE 1.5.0</em></p><p>You can provide your own custom SSH command hierarchies by subclassing the <em>DispatchCommand</em> class.</p><p><pre>import ro.fortsoft.pf4j.Extension; |
|
245 |
import org.kohsuke.args4j.Option; |
|
246 |
import org.slf4j.Logger; |
|
247 |
import org.slf4j.LoggerFactory; |
|
248 |
import com.gitblit.transport.ssh.commands.CommandMetaData; |
|
249 |
import com.gitblit.transport.ssh.commands.DispatchCommand; |
|
250 |
import com.gitblit.transport.ssh.commands.UsageExample; |
|
251 |
|
|
252 |
@Extension |
|
253 |
@CommandMetaData(name = "mycommands", description = "Sample SSH dispatcher") |
|
254 |
public class MyDispatcher extends DispatchCommand { |
|
255 |
|
|
256 |
@Override |
|
257 |
protected void setup() { |
|
258 |
// commands in this dispatcher |
|
259 |
register(CommandA.class); |
|
260 |
register(CommandB.class); |
|
261 |
|
|
262 |
// nested dispatchers |
|
263 |
register(SubDispatcher1.class); |
|
264 |
register(SubDispatcher2.class); |
|
265 |
} |
|
266 |
|
|
267 |
@CommandMetaData(name = "commanda", aliases = { "ca" }, description = "description of command a") |
|
268 |
@UsageExample(syntax = "${cmd} --myflag", description = "description of commanda with --myflag") |
|
269 |
public static class CommandA extends SshCommand { |
|
270 |
|
|
271 |
protected final Logger log = LoggerFactory.getLogger(getClass()); |
|
272 |
|
|
273 |
@Option(name = "--myflag", aliases = { "-m" }, usage = "enable myflag") |
|
274 |
boolean myflag; |
|
275 |
|
|
276 |
@Override |
|
277 |
public void run() throws Failure { |
|
278 |
if (myflag) { |
|
279 |
log.info("Run with --myflag"); |
|
280 |
} else { |
|
281 |
log.info("Run without --myflag"); |
|
282 |
} |
|
283 |
} |
|
284 |
} |
|
285 |
} |
|
286 |
</pre></p> |
|
287 |
<h3 class="section" id='H3'><a href="#H3" class="sectionlink"><i class="icon-share-alt"> </i></a>Pre- and Post- Receive Hook</h3><p><em>SINCE 1.5.0</em></p><p>You can provide your own custom pre and/or post receive hooks by subclassing the <em>ReceiveHook</em> class.</p><p><pre>import com.gitblit.extensions.ReceiveHook; |
|
288 |
import java.util.Collection; |
|
289 |
import org.eclipse.jgit.transport.ReceiveCommand; |
|
290 |
import ro.fortsoft.pf4j.Extension; |
|
291 |
|
|
292 |
@Extension |
|
293 |
public class MyReceiveHook extends ReceiveHook { |
|
294 |
|
|
295 |
@Override |
|
296 |
public void onPreReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) { |
|
297 |
} |
|
298 |
|
|
299 |
@Override |
|
300 |
public void onPostReceive(GitblitReceivePack receivePack, Collection<ReceiveCommand> commands) { |
|
301 |
} |
|
302 |
} |
|
303 |
|
|
304 |
</pre></p> |
|
305 |
<h3 class="section" id='H4'><a href="#H4" class="sectionlink"><i class="icon-share-alt"> </i></a>Patchset Hook</h3><p><em>SINCE 1.5.0</em></p><p>You can provide your own custom patchset hook by subclassing the <em>PatchsetHook</em> class.</p><p><pre>import com.gitblit.extensions.PatchsetHook; |
|
306 |
import com.gitblit.models.TicketModel; |
|
307 |
import ro.fortsoft.pf4j.Extension; |
|
308 |
|
|
309 |
@Extension |
|
310 |
public class MyPatchsetHook extends PatchsetHook { |
|
311 |
|
|
312 |
@Override |
|
313 |
public void onNewPatchset(TicketModel ticket) { |
|
314 |
} |
|
315 |
|
|
316 |
@Override |
|
317 |
public void onUpdatePatchset(TicketModel ticket) { |
|
318 |
} |
|
319 |
|
|
320 |
@Override |
|
321 |
public void onMergePatchset(TicketModel ticket) { |
|
322 |
} |
|
323 |
} |
|
324 |
</pre></p> |
|
325 |
<h3 class="section" id='H5'><a href="#H5" class="sectionlink"><i class="icon-share-alt"> </i></a>Ticket Hook</h3><p><em>SINCE 1.5.0</em></p><p>You can provide your own custom ticket hook by subclassing the <em>TicketHook</em> class.</p><p><pre>import com.gitblit.extensions.TicketHook; |
|
326 |
import com.gitblit.models.TicketModel; |
|
327 |
import com.gitblit.models.TicketModel.Change; |
|
328 |
import ro.fortsoft.pf4j.Extension; |
|
329 |
|
|
330 |
@Extension |
|
331 |
public class MyTicketHook extends TicketHook { |
|
332 |
|
|
333 |
@Override |
|
334 |
public void onNewTicket(TicketModel ticket) { |
|
335 |
} |
|
336 |
|
|
337 |
@Override |
|
338 |
public void onUpdateTicket(TicketModel ticket, Change change) { |
|
339 |
} |
|
340 |
} |
|
341 |
</pre></p> |
|
342 |
<h3 class="section" id='H6'><a href="#H6" class="sectionlink"><i class="icon-share-alt"> </i></a>Request Filter</h3><p><em>SINCE 1.6.0</em></p><p>You can provide your own custom request filter by subclassing the <em>HttpRequestFilter</em> class.</p><p><pre>import com.gitblit.extensions.HttpRequestFilter; |
|
343 |
import ro.fortsoft.pf4j.Extension; |
|
344 |
|
|
345 |
@Extension |
|
346 |
public class MyRequestFilter extends HttpRequestFilter { |
|
347 |
|
|
348 |
@Override |
|
349 |
public void doFilter(ServletRequest request, ServletResponse response, |
|
350 |
FilterChain chain) throws IOException, ServletException { |
|
351 |
} |
|
352 |
} |
|
353 |
</pre></p> |
|
354 |
<h3 class="section" id='H7'><a href="#H7" class="sectionlink"><i class="icon-share-alt"> </i></a>User Menu Items</h3><p><em>SINCE 1.6.0</em></p><p>You can provide your own user menu items by subclassing the <em>UserMenuExtension</em> class.</p><p><pre>import java.util.Arrays; |
|
355 |
import java.util.List; |
|
356 |
import ro.fortsoft.pf4j.Extension; |
|
357 |
import com.gitblit.extensions.UserMenuExtension; |
|
358 |
import com.gitblit.models.Menu.ExternalLinkMenuItem; |
|
359 |
import com.gitblit.models.Menu.MenuItem; |
|
360 |
import com.gitblit.models.UserModel; |
|
361 |
|
|
362 |
@Extension |
|
363 |
public class MyUserMenuContributor extends UserMenuExtension { |
|
364 |
|
|
365 |
@Override |
|
366 |
public List<MenuItem> getMenuItems(UserModel user) { |
|
367 |
MenuItem item = new ExternalLinkMenuItem("Github", String.format("https://github.com/%s", user.username)); |
|
368 |
return Arrays.asList(item); |
|
369 |
} |
|
370 |
} |
|
371 |
</pre></p> |
|
372 |
<h3 class="section" id='H8'><a href="#H8" class="sectionlink"><i class="icon-share-alt"> </i></a>Navigation Links</h3><p><em>SINCE 1.6.0</em></p><p>You can provide your own top-level navigation links by subclassing the <em>NavLinkExtension</em> class.</p><p><pre>import java.util.Arrays; |
|
373 |
import java.util.List; |
|
374 |
import ro.fortsoft.pf4j.Extension; |
|
375 |
import com.gitblit.extensions.NavLinkExtension; |
|
376 |
import com.gitblit.models.UserModel; |
|
377 |
|
|
378 |
@Extension |
|
379 |
public class MyNavLink extends NavLinkExtension { |
|
380 |
|
|
381 |
@Override |
|
382 |
public List<NavLink> getNavLinks(UserModel user) { |
|
383 |
NavLink link = new ExternalLinkMenuItem("Github", String.format("https://github.com/%s", user.username)); |
|
384 |
return Arrays.asList(link); |
|
385 |
} |
|
386 |
} |
|
387 |
</pre></p> |
|
388 |
<h3 class="section" id='H9'><a href="#H9" class="sectionlink"><i class="icon-share-alt"> </i></a>Server Lifecycle Listener</h3><p><em>SINCE 1.6.0</em></p><p>You can provide a lifecycle listener to be notified when Gitblit has completely started and just before Gitblit is gracefully terminated.</p><p><pre>import org.slf4j.Logger; |
|
389 |
import org.slf4j.LoggerFactory; |
|
390 |
import ro.fortsoft.pf4j.Extension; |
|
391 |
import com.gitblit.extensions.LifeCycleListener; |
|
392 |
|
|
393 |
@Extension |
|
394 |
public class MyLifeCycleListener extends LifeCycleListener { |
|
395 |
|
|
396 |
final Logger log = LoggerFactory.getLogger(getClass()); |
|
397 |
|
|
398 |
@Override |
|
399 |
public void onStartup() { |
|
400 |
log.info("Gitblit is Ready!!"); |
|
401 |
} |
|
402 |
|
|
403 |
@Override |
|
404 |
public void onShutdown() { |
|
405 |
log.info("Gitblit is Going Down!!"); |
|
406 |
} |
|
407 |
} |
|
408 |
</pre></p> |
|
409 |
<h3 class="section" id='H10'><a href="#H10" class="sectionlink"><i class="icon-share-alt"> </i></a>Repository Lifecycle Listener</h3><p><em>SINCE 1.6.0</em></p><p>You can provide a lifecycle listener to be notified when Gitblit has created or deleted a repository.</p><p><pre>import org.slf4j.Logger; |
|
410 |
import org.slf4j.LoggerFactory; |
|
411 |
import ro.fortsoft.pf4j.Extension; |
|
412 |
import com.gitblit.extensions.RepositoryLifeCycleListener; |
|
413 |
import com.gitblit.models.RepositoryModel; |
|
414 |
|
|
415 |
@Extension |
|
416 |
public class MyRepoLifeCycleListener extends RepositoryLifeCycleListener { |
|
417 |
|
|
418 |
final Logger log = LoggerFactory.getLogger(getClass()); |
|
419 |
|
|
420 |
@Override |
|
421 |
public void onCreation(RepositoryModel repo) { |
|
422 |
log.info("Gitblit created {}", repo); |
|
423 |
} |
|
424 |
|
|
425 |
@Override |
5287d2
|
426 |
public void onFork(RepositoryModel origin, RepositoryModel fork) { |
M |
427 |
log.info("{} forked to {}", origin, fork); |
|
428 |
} |
|
429 |
|
|
430 |
@Override |
|
431 |
public void onRename(String oldName, RepositoryModel repo) { |
|
432 |
log.info("{} renamed to {}", oldName, repo); |
|
433 |
} |
|
434 |
|
|
435 |
@Override |
48fe87
|
436 |
public void onDeletion(RepositoryModel repo) { |
M |
437 |
log.info("Gitblit deleted {}", repo); |
|
438 |
} |
|
439 |
} |
|
440 |
</pre></p> |
|
441 |
<h3 class="section" id='H11'><a href="#H11" class="sectionlink"><i class="icon-share-alt"> </i></a>User/Team Lifecycle Listener</h3><p><em>SINCE 1.6.0</em></p><p>You can provide a lifecycle listener to be notified when Gitblit has created or deleted a user or a team.</p><p><pre>import org.slf4j.Logger; |
|
442 |
import org.slf4j.LoggerFactory; |
|
443 |
import ro.fortsoft.pf4j.Extension; |
|
444 |
import com.gitblit.extensions.UserTeamLifeCycleListener; |
|
445 |
import com.gitblit.models.TeamModel; |
|
446 |
import com.gitblit.models.UserModel; |
|
447 |
|
|
448 |
@Extension |
|
449 |
public class MyUserTeamLifeCycleListener extends UserTeamLifeCycleListener { |
|
450 |
|
|
451 |
final Logger log = LoggerFactory.getLogger(getClass()); |
|
452 |
|
|
453 |
@Override |
|
454 |
public void onCreation(UserModel user) { |
|
455 |
log.info("Gitblit created user {}", user); |
|
456 |
} |
|
457 |
|
|
458 |
@Override |
|
459 |
public void onDeletion(UserModel user) { |
|
460 |
log.info("Gitblit deleted user {}", user); |
|
461 |
} |
|
462 |
|
|
463 |
@Override |
|
464 |
public void onCreation(TeamModel team) { |
|
465 |
log.info("Gitblit created team {}", team); |
|
466 |
} |
|
467 |
|
|
468 |
@Override |
|
469 |
public void onDeletion(TeamModel team) { |
|
470 |
log.info("Gitblit deleted team {}", team); |
|
471 |
} |
|
472 |
} |
|
473 |
</pre> |
|
474 |
<!-- End Markdown --> |
678348
|
475 |
<div ><ul class="pager"><li class="previous"><a href="plugins_overview.html">← overview</a></li> </ul></div><footer class="footer"><p class="pull-right">generated 2015-11-23</p>
|
48fe87
|
476 |
<p>The content of this page is licensed under the <a href="http://creativecommons.org/licenses/by/3.0">Creative Commons Attribution 3.0 License</a>.</p> |
M |
477 |
</footer> |
|
478 |
</div> |
|
479 |
<!-- Google Analytics -->
|
|
480 |
<script type="text/javascript">
|
|
481 |
var _gaq = _gaq || [];
|
|
482 |
_gaq.push(['_setAccount', 'UA-24377072-1']);
|
|
483 |
_gaq.push(['_trackPageview']);
|
|
484 |
|
|
485 |
(function() {
|
|
486 |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
487 |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
488 |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
489 |
})();
|
|
490 |
</script> |
|
491 |
|
|
492 |
</body> |
|
493 |
</html> |