diff options
author | James Moger <james.moger@gitblit.com> | 2014-06-09 14:10:51 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-06-09 14:10:51 -0400 |
commit | ca4d98678c20e4033fdaca09ecbbf0f5952e0b84 (patch) | |
tree | 30b4700846978f90bf8b6d5820e3d5f68d05290d /src/site | |
parent | a8d9888516fe052d5879b293a91854e41365fd0c (diff) | |
download | gitblit-ca4d98678c20e4033fdaca09ecbbf0f5952e0b84.tar.gz gitblit-ca4d98678c20e4033fdaca09ecbbf0f5952e0b84.zip |
Add repository and user/team lifecycle listener extension points
Diffstat (limited to 'src/site')
-rw-r--r-- | src/site/plugins_extensions.mkd | 75 |
1 files changed, 73 insertions, 2 deletions
diff --git a/src/site/plugins_extensions.mkd b/src/site/plugins_extensions.mkd index 99b6400f..0e066438 100644 --- a/src/site/plugins_extensions.mkd +++ b/src/site/plugins_extensions.mkd @@ -286,7 +286,7 @@ public class MyNavLink extends NavLinkExtension { } ``` -### Lifecycle Listener +### Server Lifecycle Listener *SINCE 1.6.0* @@ -313,4 +313,75 @@ public class MyLifeCycleListener extends LifeCycleListener { log.info("Gitblit is Going Down!!"); } } -```
\ No newline at end of file +``` + +### Repository Lifecycle Listener + +*SINCE 1.6.0* + +You can provide a lifecycle listener to be notified when Gitblit has created or deleted a repository. + +```java +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import ro.fortsoft.pf4j.Extension; +import com.gitblit.extensions.RepositoryLifeCycleListener; +import com.gitblit.models.RepositoryModel; + +@Extension +public class MyRepoLifeCycleListener extends RepositoryLifeCycleListener { + + final Logger log = LoggerFactory.getLogger(getClass()); + + @Override + public void onCreation(RepositoryModel repo) { + log.info("Gitblit created {}", repo); + } + + @Override + public void onDeletion(RepositoryModel repo) { + log.info("Gitblit deleted {}", repo); + } +} +``` + +### User/Team Lifecycle Listener + +*SINCE 1.6.0* + +You can provide a lifecycle listener to be notified when Gitblit has created or deleted a user or a team. + +```java +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import ro.fortsoft.pf4j.Extension; +import com.gitblit.extensions.UserTeamLifeCycleListener; +import com.gitblit.models.TeamModel; +import com.gitblit.models.UserModel; + +@Extension +public class MyUserTeamLifeCycleListener extends UserTeamLifeCycleListener { + + final Logger log = LoggerFactory.getLogger(getClass()); + + @Override + public void onCreation(UserModel user) { + log.info("Gitblit created user {}", user); + } + + @Override + public void onDeletion(UserModel user) { + log.info("Gitblit deleted user {}", user); + } + + @Override + public void onCreation(TeamModel team) { + log.info("Gitblit created team {}", team); + } + + @Override + public void onDeletion(TeamModel team) { + log.info("Gitblit deleted team {}", team); + } +} +``` |