[ 
https://issues.apache.org/jira/browse/SOLR-14977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17225506#comment-17225506
 ] 

Ilan Ginzburg commented on SOLR-14977:
--------------------------------------

[~ab], placement plugins configuration has (very) similar needs. The approach 
is to type safe the configs (currently supporting {{String}}, {{Boolean}}, 
{{Long}}, {{Double}}) by returning each config type from a separate strongly 
typed accessor (for example {{Long getLongConfig(String configName)}}).

This code could be renamed, moved, extended etc. to support more config types 
and serve other plugin types.

The interface isĀ 
[PlacementPluginConfig|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPluginConfig.java]
 and implementation 
[PlacementPluginConfigImpl|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/cluster/placement/impl/PlacementPluginConfigImpl.java].

As described in the class Javadoc of 
[PlacementPluginConfig|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/cluster/placement/PlacementPluginConfig.java],
 the configuration can be set doing:
{code:java}
curl -X POST -H 'Content-type:application/json' -d '{
  "set-placement-plugin": {
    "class": "factory.class.name$inner",
    "myfirstString": "a text value",
    "aLong": 50,
    "aDoubleConfig": 3.1415928,
    "shouldIStay": true
}' http://localhost:8983/api/cluster{code}
Which results in adding to {{/clusterprops.json}}:
{code:java}
"placement-plugin":{
    "class":"factory.class.name$inner",
    "myfirstString": "a text value",
    "aLong": 50,
    "aDoubleConfig": 3.1415928,
    "shouldIStay": true}
{code}

> Container plugins need a way to be configured
> ---------------------------------------------
>
>                 Key: SOLR-14977
>                 URL: https://issues.apache.org/jira/browse/SOLR-14977
>             Project: Solr
>          Issue Type: Improvement
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Plugin system
>            Reporter: Andrzej Bialecki
>            Priority: Major
>
> Container plugins are defined in {{/clusterprops.json:/plugin}} using a 
> simple {{PluginMeta}} bean. This is sufficient for implementations that don't 
> need any configuration except for the {{pathPrefix}} but insufficient for 
> anything else that needs more configuration parameters.
> An example would be a {{CollectionsRepairEventListener}} plugin proposed in 
> PR-1962, which needs parameters such as the list of collections, {{waitFor}}, 
> maximum operations allowed, etc. to properly function.
> This issue proposes to extend the {{PluginMeta}} bean to allow a 
> {{Map<String, Object>}} configuration parameters.
> There is an interface that we could potentially use ({{MapInitializedPlugin}} 
> but it works only with {{String}} values. This is not optimal because it 
> requires additional type-safety validation from the consumers. The existing 
> {{PluginInfo}} / {{PluginInfoInitialized}} interface is too complex for this 
> purpose.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to