diff options
Diffstat (limited to 'src/site/plugins_extensions.mkd')
-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); + } +} +``` |