Skip to content

Commit

Permalink
[MINDEXER-205] Align them (#334)
Browse files Browse the repository at this point in the history
Make them both static helpers, as they have no logic.

---

https://issues.apache.org/jira/browse/MINDEXER-205
  • Loading branch information
cstamas authored Oct 26, 2023
1 parent db83775 commit 1343cb5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
/**
* The remote repository search backend factory.
*/
public class RemoteRepositorySearchBackendFactory {
public final class RemoteRepositorySearchBackendFactory {
public static final String BACKEND_ID = "search-rr";

public static final String CENTRAL_REPOSITORY_ID = "central";
Expand All @@ -38,6 +38,8 @@ public class RemoteRepositorySearchBackendFactory {

public static final String RAO_RELEASES_URI = "https://repository.apache.org/content/repositories/releases/";

private RemoteRepositorySearchBackendFactory() {}

/**
* Creates "default" RR search backend against Maven Central suitable for most use cases.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,26 @@
/**
* The SMO search backend factory.
*/
public class SmoSearchBackendFactory {
public final class SmoSearchBackendFactory {
public static final String DEFAULT_BACKEND_ID = "central-smo";

public static final String DEFAULT_REPOSITORY_ID = "central";

public static final String DEFAULT_SMO_URI = "https://search.maven.org/solrsearch/select";

private SmoSearchBackendFactory() {}

/**
* Creates "default" SMO search backend suitable for most use cases.
*/
public SmoSearchBackend createDefault() {
public static SmoSearchBackend createDefault() {
return create(DEFAULT_BACKEND_ID, DEFAULT_REPOSITORY_ID, DEFAULT_SMO_URI, new Java11HttpClientTransport());
}

/**
* Creates SMO search backend using provided parameters.
*/
public SmoSearchBackend create(String backendId, String repositoryId, String smoUri, Transport transport) {
public static SmoSearchBackend create(String backendId, String repositoryId, String smoUri, Transport transport) {
return new SmoSearchBackendImpl(backendId, repositoryId, smoUri, transport);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

@Ignore("This is not a test, is more a showcase")
public class SmoSearchBackendImplTest {
private final SmoSearchBackend backend = new SmoSearchBackendFactory().createDefault();
private final SmoSearchBackend backend = SmoSearchBackendFactory.createDefault();

private void dumpSingle(AtomicInteger counter, List<Record> page) {
for (Record record : page) {
Expand Down

0 comments on commit 1343cb5

Please sign in to comment.