From f76fee63ed9cb3a30d3c0c092d860b1cb93a481b Mon Sep 17 00:00:00 2001
From: Gerard Smyth <gerard.smyth@gmail.com>
Date: Thu, 08 May 2014 13:09:30 -0400
Subject: [PATCH] Updated the SyndicationServlet to provide an additional option to return details of the tags in the repository instead of the commits. This uses a new 'ot' request parameter to indicate the object type of the content to return, which can be ither TAG or COMMIT. If this is not provided, then COMMIT is assumed to maintain backwards compatability. If tags are returned, then the paging parameters, 'l' and 'pg' are still supported, but searching options are currently ignored.
---
src/main/java/com/gitblit/transport/ssh/commands/RootDispatcher.java | 40 +++++++++++++++++++++-------------------
1 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/main/java/com/gitblit/transport/ssh/commands/RootDispatcher.java b/src/main/java/com/gitblit/transport/ssh/commands/RootDispatcher.java
index 38fbd2c..0bf6d51 100644
--- a/src/main/java/com/gitblit/transport/ssh/commands/RootDispatcher.java
+++ b/src/main/java/com/gitblit/transport/ssh/commands/RootDispatcher.java
@@ -17,45 +17,47 @@
import java.util.List;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import ro.fortsoft.pf4j.PluginWrapper;
import com.gitblit.manager.IGitblit;
-import com.gitblit.models.UserModel;
import com.gitblit.transport.ssh.SshDaemonClient;
import com.gitblit.transport.ssh.git.GitDispatcher;
-import com.gitblit.transport.ssh.gitblit.GitblitDispatcher;
+import com.gitblit.transport.ssh.keys.KeysDispatcher;
/**
* The root dispatcher is the dispatch command that handles registering all
* other commands.
*
*/
-public class RootDispatcher extends DispatchCommand {
+@CommandMetaData(name = "")
+class RootDispatcher extends DispatchCommand {
+
+ private Logger log = LoggerFactory.getLogger(getClass());
public RootDispatcher(IGitblit gitblit, SshDaemonClient client, String cmdLine) {
super();
setContext(new SshCommandContext(gitblit, client, cmdLine));
- final UserModel user = client.getUser();
- registerDispatcher(user, GitblitDispatcher.class);
- registerDispatcher(user, GitDispatcher.class);
+ register(VersionCommand.class);
+ register(GitDispatcher.class);
+ register(KeysDispatcher.class);
+ register(PluginDispatcher.class);
- List<SshCommand> exts = gitblit.getExtensions(SshCommand.class);
- for (SshCommand sshCommand : exts) {
- PluginDispatchCommand pluginCmd = new PluginDispatchCommand();
- PluginWrapper wrapper = gitblit.whichPlugin(sshCommand.getClass());
- pluginCmd.registerCommand(user, sshCommand.getClass());
- // TODO(davido): add dispatcher registration per plugin name
- //registerDispatcher(wrapper.getDescriptor().getPluginId(), pluginCmd);
+ List<DispatchCommand> exts = gitblit.getExtensions(DispatchCommand.class);
+ for (DispatchCommand ext : exts) {
+ Class<? extends DispatchCommand> extClass = ext.getClass();
+ PluginWrapper wrapper = gitblit.whichPlugin(extClass);
+ String plugin = wrapper.getDescriptor().getPluginId();
+ CommandMetaData meta = extClass.getAnnotation(CommandMetaData.class);
+ log.debug("Dispatcher {} is loaded from plugin {}", meta.name(), plugin);
+ register(ext);
}
}
@Override
- protected final void registerCommands(UserModel user) {
- }
-
- @Override
- protected final void registerCommand(UserModel user, Class<? extends BaseCommand> cmd) {
- throw new RuntimeException("The root dispatcher does not accept commands, only dispatchers!");
+ protected final void setup() {
}
}
\ No newline at end of file
--
Gitblit v1.9.1