mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-16 18:26:16 +01:00
package refactoring
This commit is contained in:
@@ -47,15 +47,15 @@ import java.io.File;
|
||||
public class BaseDirectory
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
static final String DIRECTORY_PROPERTY = "scm-backend.home";
|
||||
|
||||
/** Field description */
|
||||
private static final String DIRECTORY_DEFAULT = ".scm-backend";
|
||||
|
||||
/** Field description */
|
||||
private static final String DIRECTORY_ENVIRONMENT = "SCMBACKEND_HOME";
|
||||
|
||||
/** Field description */
|
||||
static final String DIRECTORY_PROPERTY = "scm-backend.home";
|
||||
|
||||
/** Field description */
|
||||
private static BaseDirectory instance;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ package sonia.scm.plugin;
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.web.filter.HttpFilter;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -53,8 +54,11 @@ import javax.servlet.http.HttpServletResponse;
|
||||
public class RedirectFilter extends HttpFilter
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final String STARTPAGE = "/page/index.html";
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin;
|
||||
|
||||
/**
|
||||
@@ -34,5 +37,7 @@ package sonia.scm.plugin;
|
||||
*/
|
||||
public class Roles
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
public static final String ADMIN = "admin";
|
||||
}
|
||||
|
||||
@@ -41,15 +41,15 @@ import com.google.inject.servlet.ServletModule;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
|
||||
import sonia.scm.ConfigurationException;
|
||||
import sonia.scm.plugin.rest.PluginResource;
|
||||
import sonia.scm.plugin.rest.url.BitbucketUrlBuilder;
|
||||
import sonia.scm.plugin.rest.url.GithubUrlBuilder;
|
||||
import sonia.scm.plugin.rest.url.UrlBuilder;
|
||||
import sonia.scm.plugin.rest.url.UrlBuilderFactory;
|
||||
import sonia.scm.plugin.rest.api.PluginResource;
|
||||
import sonia.scm.plugin.scanner.DefaultPluginScannerFactory;
|
||||
import sonia.scm.plugin.scanner.PluginScannerFactory;
|
||||
import sonia.scm.plugin.scanner.PluginScannerScheduler;
|
||||
import sonia.scm.plugin.scanner.TimerPluginScannerScheduler;
|
||||
import sonia.scm.plugin.url.BitbucketUrlBuilder;
|
||||
import sonia.scm.plugin.url.GithubUrlBuilder;
|
||||
import sonia.scm.plugin.url.UrlBuilder;
|
||||
import sonia.scm.plugin.url.UrlBuilderFactory;
|
||||
import sonia.scm.web.proxy.ProxyConfigurationProvider;
|
||||
import sonia.scm.web.proxy.ProxyServlet;
|
||||
|
||||
|
||||
@@ -29,13 +29,14 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.admin;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.plugin.BackendConfiguration;
|
||||
import sonia.scm.plugin.rest.ViewableResource;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.api;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -84,9 +84,10 @@ public class DefaultPluginFilter implements PluginFilter
|
||||
{
|
||||
PluginCondition condition = plugin.getCondition();
|
||||
|
||||
return (snapshot ||!plugin.getVersion().toUpperCase().contains(
|
||||
VERSION_SNAPSHOT)) && ((condition != null) && condition.isSupported(
|
||||
version, os, arch) || (condition == null));
|
||||
return (snapshot
|
||||
||!plugin.getVersion().toUpperCase().contains(
|
||||
VERSION_SNAPSHOT)) && ((condition != null)
|
||||
&& condition.isSupported(version, os, arch) || (condition == null));
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.api;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -51,6 +51,7 @@ import sonia.scm.plugin.PluginBackendListener;
|
||||
import sonia.scm.plugin.PluginCenter;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.plugin.PluginVersion;
|
||||
import sonia.scm.plugin.rest.PluginInformationComparator;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -97,8 +98,7 @@ public class PluginResource implements PluginBackendListener
|
||||
*/
|
||||
@Inject
|
||||
public PluginResource(PluginBackend backend,
|
||||
BackendConfiguration configuration,
|
||||
CacheManager cacheManager)
|
||||
BackendConfiguration configuration, CacheManager cacheManager)
|
||||
{
|
||||
this.backend = backend;
|
||||
this.configuration = configuration;
|
||||
@@ -143,8 +143,7 @@ public class PluginResource implements PluginBackendListener
|
||||
@GET
|
||||
@Produces(MediaType.APPLICATION_XML)
|
||||
public Response getPlugins(@PathParam("version") String version,
|
||||
@QueryParam("os") String os,
|
||||
@QueryParam("arch") String arch,
|
||||
@QueryParam("os") String os, @QueryParam("arch") String arch,
|
||||
@DefaultValue("false")
|
||||
@QueryParam("snapshot") boolean snapshot)
|
||||
{
|
||||
@@ -29,13 +29,14 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.error;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.plugin.BackendConfiguration;
|
||||
import sonia.scm.plugin.rest.ViewableResource;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.page;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -48,8 +48,9 @@ import sonia.scm.plugin.PluginBackend;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.plugin.PluginInformationVersionComparator;
|
||||
import sonia.scm.plugin.PluginUtil;
|
||||
import sonia.scm.plugin.rest.url.UrlBuilder;
|
||||
import sonia.scm.plugin.rest.url.UrlBuilderFactory;
|
||||
import sonia.scm.plugin.rest.CachedViewableResource;
|
||||
import sonia.scm.plugin.url.UrlBuilder;
|
||||
import sonia.scm.plugin.url.UrlBuilderFactory;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -103,8 +104,8 @@ public class DetailResource extends CachedViewableResource
|
||||
*/
|
||||
@Inject
|
||||
public DetailResource(ServletContext context, PluginBackend backend,
|
||||
BackendConfiguration configuration,
|
||||
UrlBuilderFactory urlFactory, CacheManager cacheManager)
|
||||
BackendConfiguration configuration, UrlBuilderFactory urlFactory,
|
||||
CacheManager cacheManager)
|
||||
{
|
||||
super(context, backend, configuration, cacheManager, CACHE);
|
||||
this.backend = backend;
|
||||
@@ -125,8 +126,7 @@ public class DetailResource extends CachedViewableResource
|
||||
*/
|
||||
@GET
|
||||
public Viewable getPluginDetails(@PathParam("groupId") String groupId,
|
||||
@PathParam("artifactId") String artifactId,
|
||||
@DefaultValue("false")
|
||||
@PathParam("artifactId") String artifactId, @DefaultValue("false")
|
||||
@QueryParam("snapshot") boolean snapshot)
|
||||
{
|
||||
String cacheKey = createCacheKey(groupId, artifactId, snapshot);
|
||||
@@ -160,7 +160,7 @@ public class DetailResource extends CachedViewableResource
|
||||
|
||||
vars.put("latest", PluginUtil.prepareForView(latest));
|
||||
vars.put("versions", detailList);
|
||||
viewable = new Viewable("/detail", vars);
|
||||
viewable = new Viewable("/page/detail", vars);
|
||||
putToCache(cacheKey, viewable);
|
||||
}
|
||||
else if (logger.isDebugEnabled())
|
||||
@@ -29,13 +29,14 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.page;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import sonia.scm.plugin.BackendConfiguration;
|
||||
import sonia.scm.plugin.rest.ViewableResource;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -60,7 +61,7 @@ public class LoginResource extends ViewableResource
|
||||
{
|
||||
|
||||
/** Field description */
|
||||
private static final String PAGE_LOGIN = "/login";
|
||||
private static final String PAGE_LOGIN = "/page/login";
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.page;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -43,6 +43,8 @@ import sonia.scm.plugin.CategoryNameComaparator;
|
||||
import sonia.scm.plugin.PluginBackend;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.plugin.PluginUtil;
|
||||
import sonia.scm.plugin.rest.PluginInformationComparator;
|
||||
import sonia.scm.plugin.rest.ViewableResource;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
@@ -106,7 +108,7 @@ public class OverviewResource extends ViewableResource
|
||||
|
||||
vars.put("categories", categories);
|
||||
|
||||
return new Viewable("/index", vars);
|
||||
return new Viewable("/page/index", vars);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.page;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest;
|
||||
package sonia.scm.plugin.rest.page;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -39,6 +39,7 @@ import com.google.inject.Inject;
|
||||
|
||||
import org.imgscalr.Scalr;
|
||||
|
||||
import sonia.scm.plugin.BaseDirectory;
|
||||
import sonia.scm.plugin.PluginBackend;
|
||||
import sonia.scm.plugin.PluginInformation;
|
||||
import sonia.scm.plugin.PluginUtil;
|
||||
@@ -66,7 +67,6 @@ import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.WebApplicationException;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.Response.Status;
|
||||
import sonia.scm.plugin.BaseDirectory;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -125,11 +125,9 @@ public class ScreenshotResource
|
||||
*/
|
||||
@GET
|
||||
@Produces("image/jpeg")
|
||||
public Response getScreenshot(
|
||||
@PathParam("groupId") String groupId,
|
||||
public Response getScreenshot(@PathParam("groupId") String groupId,
|
||||
@PathParam("artifactId") String artifactId,
|
||||
@PathParam("number") int number,
|
||||
@PathParam("size") String size)
|
||||
@PathParam("number") int number, @PathParam("size") String size)
|
||||
throws IOException
|
||||
{
|
||||
PluginInformation plugin = PluginUtil.getLatestPluginVersion(backend,
|
||||
@@ -69,8 +69,7 @@ public class PluginScannerTimerTask extends TimerTask
|
||||
* @param scannerFactory
|
||||
*/
|
||||
public PluginScannerTimerTask(PluginBackend backend,
|
||||
BackendConfiguration configuration,
|
||||
PluginScannerFactory scannerFactory)
|
||||
BackendConfiguration configuration, PluginScannerFactory scannerFactory)
|
||||
{
|
||||
this.backend = backend;
|
||||
this.configuration = configuration;
|
||||
|
||||
@@ -74,8 +74,7 @@ public class TimerPluginScannerScheduler implements PluginScannerScheduler
|
||||
*/
|
||||
@Inject
|
||||
public TimerPluginScannerScheduler(PluginBackend backend,
|
||||
BackendConfiguration configuration,
|
||||
PluginScannerFactory scannerFactory)
|
||||
BackendConfiguration configuration, PluginScannerFactory scannerFactory)
|
||||
{
|
||||
this.backend = backend;
|
||||
this.configuration = configuration;
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest.url;
|
||||
package sonia.scm.plugin.url;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -92,8 +92,7 @@ public abstract class AbstractUrlBuilder implements UrlBuilder
|
||||
*/
|
||||
@Override
|
||||
public String createCompareUrl(PluginInformation latest,
|
||||
PluginInformation plugin,
|
||||
PluginInformation other)
|
||||
PluginInformation plugin, PluginInformation other)
|
||||
{
|
||||
return createCompareUrl(latest.getUrl(), plugin.getVersion(),
|
||||
other.getVersion());
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest.url;
|
||||
package sonia.scm.plugin.url;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest.url;
|
||||
package sonia.scm.plugin.url;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest.url;
|
||||
package sonia.scm.plugin.url;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -55,8 +55,7 @@ public interface UrlBuilder
|
||||
* @return
|
||||
*/
|
||||
public String createCompareUrl(PluginInformation latest,
|
||||
PluginInformation plugin,
|
||||
PluginInformation other);
|
||||
PluginInformation plugin, PluginInformation other);
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
|
||||
|
||||
package sonia.scm.plugin.rest.url;
|
||||
package sonia.scm.plugin.url;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<#include "template/header.html">
|
||||
<#include "../template/header.html">
|
||||
|
||||
<p>${latest.description}</p>
|
||||
|
||||
@@ -133,4 +133,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<#include "template/footer.html">
|
||||
<#include "../template/footer.html">
|
||||
@@ -1,4 +1,4 @@
|
||||
<#include "template/header.html">
|
||||
<#include "../template/header.html">
|
||||
|
||||
<div id="categories">
|
||||
<#list categories as category>
|
||||
@@ -25,4 +25,4 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<#include "template/footer.html">
|
||||
<#include "../template/footer.html">
|
||||
@@ -1,4 +1,4 @@
|
||||
<#include "template/header.html">
|
||||
<#include "../template/header.html">
|
||||
|
||||
<form method="POST" action="">
|
||||
|
||||
@@ -25,4 +25,4 @@
|
||||
|
||||
</form>
|
||||
|
||||
<#include "template/footer.html">
|
||||
<#include "../template/footer.html">
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.plugin.rest.url;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.plugin.url.BitbucketUrlBuilder;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
@@ -35,6 +35,7 @@ package sonia.scm.plugin.rest.url;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import sonia.scm.plugin.url.GithubUrlBuilder;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
Reference in New Issue
Block a user