Creates and initializes a RestManager based on configuration args in solrconfig.xml. RestManager provides basic storage support for managed resource data, such as to persist stopwords to ZooKeeper if running in SolrCloud mode.
()
| 3224 | * stopwords to ZooKeeper if running in SolrCloud mode. |
| 3225 | */ |
| 3226 | @SuppressWarnings({"unchecked", "rawtypes"}) |
| 3227 | protected RestManager initRestManager() throws SolrException { |
| 3228 | |
| 3229 | PluginInfo restManagerPluginInfo = getSolrConfig().getPluginInfo(RestManager.class.getName()); |
| 3230 | |
| 3231 | NamedList<String> initArgs = null; |
| 3232 | RestManager mgr = null; |
| 3233 | if (restManagerPluginInfo != null) { |
| 3234 | if (restManagerPluginInfo.className != null) { |
| 3235 | mgr = resourceLoader.newInstance(restManagerPluginInfo.className, RestManager.class); |
| 3236 | } |
| 3237 | |
| 3238 | if (restManagerPluginInfo.initArgs != null) { |
| 3239 | // TODO this is actually unsafe, the RMPI.initArgs can have objects too. |
| 3240 | initArgs = (NamedList<String>) (NamedList) restManagerPluginInfo.initArgs; |
| 3241 | } |
| 3242 | } |
| 3243 | |
| 3244 | if (mgr == null) mgr = new RestManager(); |
| 3245 | |
| 3246 | if (initArgs == null) initArgs = new NamedList<>(); |
| 3247 | |
| 3248 | String collection = getCoreDescriptor().getCollectionName(); |
| 3249 | StorageIO storageIO = ManagedResourceStorage.newStorageIO(collection, resourceLoader, initArgs); |
| 3250 | mgr.init(resourceLoader, initArgs, storageIO); |
| 3251 | |
| 3252 | return mgr; |
| 3253 | } |
| 3254 | |
| 3255 | public CoreDescriptor getCoreDescriptor() { |
| 3256 | return coreDescriptor; |
no test coverage detected