mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-15 17:56:17 +01:00
add repository handler informations to support resource
This commit is contained in:
@@ -33,6 +33,7 @@ package sonia.scm.api.rest.resources;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
|
|
||||||
@@ -49,6 +50,8 @@ import sonia.scm.web.security.WebSecurityContext;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -56,6 +59,9 @@ import javax.ws.rs.GET;
|
|||||||
import javax.ws.rs.Path;
|
import javax.ws.rs.Path;
|
||||||
import javax.ws.rs.Produces;
|
import javax.ws.rs.Produces;
|
||||||
import javax.ws.rs.core.MediaType;
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import sonia.scm.Type;
|
||||||
|
import sonia.scm.repository.RepositoryHandler;
|
||||||
|
import sonia.scm.repository.RepositoryManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -87,7 +93,7 @@ public class SupportResource
|
|||||||
SCMContextProvider context,
|
SCMContextProvider context,
|
||||||
TemplateHandler templateHandler,
|
TemplateHandler templateHandler,
|
||||||
ScmConfiguration configuration,
|
ScmConfiguration configuration,
|
||||||
PluginManager pluginManager, StoreFactory storeFactory)
|
PluginManager pluginManager, StoreFactory storeFactory, RepositoryManager repositoryManager )
|
||||||
{
|
{
|
||||||
this.securityContext = securityContext;
|
this.securityContext = securityContext;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
@@ -95,8 +101,11 @@ public class SupportResource
|
|||||||
this.configuration = configuration;
|
this.configuration = configuration;
|
||||||
this.pluginManager = pluginManager;
|
this.pluginManager = pluginManager;
|
||||||
this.storeFactoryClass = storeFactory.getClass();
|
this.storeFactoryClass = storeFactory.getClass();
|
||||||
|
this.repositoryManager = repositoryManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private RepositoryManager repositoryManager;
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,6 +129,7 @@ public class SupportResource
|
|||||||
env.put("pluginManager", pluginManager);
|
env.put("pluginManager", pluginManager);
|
||||||
env.put("runtime", new RuntimeInformation());
|
env.put("runtime", new RuntimeInformation());
|
||||||
env.put("system", new SystemInformation());
|
env.put("system", new SystemInformation());
|
||||||
|
env.put("repositoryHandlers", getRepositoryHandlers());
|
||||||
|
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
|
|
||||||
@@ -128,6 +138,18 @@ public class SupportResource
|
|||||||
return writer.toString();
|
return writer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<RepositoryHandler> getRepositoryHandlers()
|
||||||
|
{
|
||||||
|
List<RepositoryHandler> handlers = Lists.newArrayList();
|
||||||
|
|
||||||
|
for ( Type type : repositoryManager.getConfiguredTypes() )
|
||||||
|
{
|
||||||
|
handlers.add( repositoryManager.getHandler(type.getName()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
|
||||||
//~--- inner classes --------------------------------------------------------
|
//~--- inner classes --------------------------------------------------------
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -136,5 +136,13 @@
|
|||||||
<li>Java: ${system.java}</li>
|
<li>Java: ${system.java}</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<h2>Repository Handlers</h2>
|
||||||
|
|
||||||
|
<ul>
|
||||||
|
<#list repositoryHandlers as handler>
|
||||||
|
<li>${handler.type.displayName}/${handler.type.name} (${handler.versionInformation})</li>
|
||||||
|
</#list>
|
||||||
|
</ul>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user