mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
read provider implementations from classpath
This commit is contained in:
@@ -0,0 +1 @@
|
||||
sonia.scm.repository.client.spi.GitRepositoryClientFactoryProvider
|
||||
@@ -33,13 +33,18 @@ package sonia.scm.repository.client.api;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import sonia.scm.repository.client.spi.RepositoryClientFactoryProvider;
|
||||
import sonia.scm.util.ServiceUtil;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -48,6 +53,16 @@ import java.io.IOException;
|
||||
public final class RepositoryClientFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public RepositoryClientFactory()
|
||||
{
|
||||
this.providers =
|
||||
ServiceUtil.getServices(RepositoryClientFactoryProvider.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
@@ -109,6 +124,24 @@ public final class RepositoryClientFactory
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Iterable<String> getAvailableTypes()
|
||||
{
|
||||
List<String> types = Lists.newArrayList();
|
||||
|
||||
for (RepositoryClientFactoryProvider provider : providers)
|
||||
{
|
||||
types.add(provider.getType());
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user