forked from apache/solr
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactoring to avoid modifying existing method modifiers
- Loading branch information
Showing
5 changed files
with
69 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
solr/core/src/java/org/apache/solr/core/SolrCoreProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package org.apache.solr.core; | ||
|
||
import java.nio.file.Paths; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
import org.apache.solr.common.params.CoreAdminParams; | ||
|
||
public class SolrCoreProxy extends SolrCore { | ||
public SolrCoreProxy(CoreContainer coreContainer, CoreDescriptor cd, ConfigSet configSet) { | ||
super(coreContainer, cd, configSet, true); | ||
} | ||
|
||
public static SolrCoreProxy createAndRegisterProxy( | ||
CoreContainer coreContainer, | ||
String syntheticCollectionName, | ||
String configSetName, | ||
String todo) { | ||
Map<String, String> coreProps = new HashMap<>(); | ||
coreProps.put(CoreAdminParams.CORE_NODE_NAME, coreContainer.getHostName()); | ||
coreProps.put(CoreAdminParams.COLLECTION, syntheticCollectionName); | ||
|
||
CoreDescriptor syntheticCoreDescriptor = | ||
new CoreDescriptor( | ||
syntheticCollectionName, | ||
// todo, | ||
Paths.get(coreContainer.getSolrHome() + "/" + syntheticCollectionName), | ||
// Paths.get(coreContainer.getSolrHome() + "/" + todo), | ||
coreProps, | ||
coreContainer.getContainerProperties(), | ||
coreContainer.getZkController()); | ||
|
||
ConfigSet coreConfig = | ||
coreContainer.getConfigSetService().loadConfigSet(syntheticCoreDescriptor, configSetName); | ||
syntheticCoreDescriptor.setConfigSetTrusted(coreConfig.isTrusted()); | ||
SolrCoreProxy syntheticCore = | ||
new SolrCoreProxy(coreContainer, syntheticCoreDescriptor, coreConfig); | ||
coreContainer.registerCore(syntheticCoreDescriptor, syntheticCore, false, false); | ||
|
||
return syntheticCore; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters