Commits

Sebastian Sdorra committed 8362f97

read provider implementations from classpath

Comments (0)

Files changed (2)

scm-plugins/scm-git-plugin/src/test/resources/META-INF/services/sonia.scm.repository.client.spi.RepositoryClientFactoryProvider

+sonia.scm.repository.client.spi.GitRepositoryClientFactoryProvider

scm-test/src/main/java/sonia/scm/repository/client/api/RepositoryClientFactory.java

 
 //~--- 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
   /**
    * Constructs ...
    *
+   */
+  public RepositoryClientFactory()
+  {
+    this.providers =
+      ServiceUtil.getServices(RepositoryClientFactoryProvider.class);
+  }
+
+  /**
+   * Constructs ...
+   *
    *
    * @param provider
    *
    * Method description
    *
    *
+   * @return
+   */
+  public Iterable<String> getAvailableTypes()
+  {
+    List<String> types = Lists.newArrayList();
+
+    for (RepositoryClientFactoryProvider provider : providers)
+    {
+      types.add(provider.getType());
+    }
+
+    return types;
+  }
+
+  /**
+   * Method description
+   *
+   *
    * @param type
    *
    * @return