[
https://issues.apache.org/jira/browse/SOLR-14977?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17225848#comment-17225848
]
Noble Paul edited comment on SOLR-14977 at 11/7/20, 5:08 AM:
-------------------------------------------------------------
Let's have a simple interface as follows (change the name as you wish).
This will help us do a type-safe initialization of any plugin.
{code:java}
public interface ConfigurablePlugin<T> {
public void initConfig(T initVals);
}
{code}
for instance the {{PlacementPluginConfig}} can have only the following
attributes
{code:java}
{
"myfirstString": "a text value",
"aLong": 50,
"aDoubleConfig": 3.1415928,
"shouldIStay": true}
{code}
It does not have to care about the attributes in {{PluginMeta}} if it does not
need it
BTW I would prefer not to have something ugly like
[this|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/cluster/placement/impl/PlacementPluginConfigImpl.java]
Lets have something as follows
{code:java}
public class PlacementPluginConfig {
@JsonProperty
public String myfirstString;
@JsonProperty
public Long aLong;
@JsonProperty
public Double aDoubleConfig;
@JsonProperty
public Boolean shouldIStay";
}
{code}
was (Author: noble.paul):
Let's have a simple interface as follows (change the name as you wish).
This will help us do a type-safe initialization of any plugin.
{code:java}
public interface SimplePlugin<T> {
public void initPlugin(T initVals);
}
{code}
for instance the {{PlacementPluginConfig}} can have only the following
attributes
{code:java}
{
"myfirstString": "a text value",
"aLong": 50,
"aDoubleConfig": 3.1415928,
"shouldIStay": true}
{code}
It does not have to care about the attributes in {{PluginMeta}} if it does not
need it
BTW I would prefer not to have something ugly like
[this|https://github.com/apache/lucene-solr/blob/master/solr/core/src/java/org/apache/solr/cluster/placement/impl/PlacementPluginConfigImpl.java]
Lets have something as follows
{code:java}
public class PlacementPluginConfig {
@JsonProperty
public String myfirstString;
@JsonProperty
public Long aLong;
@JsonProperty
public Double aDoubleConfig;
@JsonProperty
public Boolean shouldIStay";
}
{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
> Attachments: SOLR-14977.patch
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> 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: [email protected]
For additional commands, e-mail: [email protected]