Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] KIP-891: Connect Multiversion Support (Transformation and Predicate Changes) #17742

Open
wants to merge 147 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 134 commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
49b37c7
Add multiversioning apis to isolation
snehashisp Aug 23, 2024
1b740cc
add method for header converter
snehashisp Aug 23, 2024
3aba36e
init commit
snehashisp Aug 31, 2024
c96a8d1
update validation logic for connector versions
snehashisp Sep 19, 2024
017df62
add getter for all plugins for a class
snehashisp Sep 19, 2024
0f1cdaf
Merge branch 'multiversioning' into mvn-validation
snehashisp Sep 19, 2024
855e77a
minor edits
snehashisp Sep 21, 2024
4744f4f
Allow super to load class but do a version check
snehashisp Sep 21, 2024
c708ade
Merge branch 'multiversioning' into mvn-validation
snehashisp Sep 21, 2024
8beac31
validate the version when loaded from parent correctly
snehashisp Sep 21, 2024
df16999
Merge branch 'multiversioning' into mvn-validation
snehashisp Sep 21, 2024
6fb6471
Tested connector multiple verions
snehashisp Sep 22, 2024
84ed0da
revert changes to filestream sink
snehashisp Sep 22, 2024
814ddb7
bug in loadclass, should use fullname
snehashisp Sep 22, 2024
7905708
Merge branch 'multiversioning' into mvn-validation
snehashisp Sep 22, 2024
7497ef7
add available version to exception and minor changes
snehashisp Sep 22, 2024
27aba58
Merge branch 'multiversioning' into mvn-validation
snehashisp Sep 22, 2024
b9c0ab5
validation supporting connector version
snehashisp Oct 1, 2024
d9cad93
fix lf to cr
snehashisp Oct 1, 2024
7df37cf
Add configs and recommendors
snehashisp Oct 1, 2024
cbbbc95
converter tested
snehashisp Oct 2, 2024
5282a3f
Add converter validatoins
snehashisp Oct 2, 2024
7ad8a32
Remove changes to json
snehashisp Oct 5, 2024
2cdf67c
Validation and recommendors for versioning transformations and predic…
snehashisp Oct 10, 2024
53068f8
update recommendation logic
snehashisp Oct 10, 2024
7676408
minor fixes
snehashisp Oct 28, 2024
2119a91
Add default version getter
snehashisp Oct 28, 2024
eb3e693
Merge branch 'multiversioning' into mvn-validation
snehashisp Oct 28, 2024
9d83a1c
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 28, 2024
dd150a5
add defaults
snehashisp Oct 28, 2024
79a7e02
Update default version
snehashisp Oct 28, 2024
f973fd0
add a null check
snehashisp Oct 29, 2024
cce53be
Merge branch 'multiversioning' into mvn-validation
snehashisp Oct 29, 2024
ec7892b
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 29, 2024
baea3cf
Update log and comment
snehashisp Oct 29, 2024
5238dd0
Merge branch 'multiversioning' into mvn-validation
snehashisp Oct 29, 2024
ae243dc
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 29, 2024
efbe73b
adress backwards compatiblity
snehashisp Oct 30, 2024
f228fbc
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 30, 2024
ddec0d8
Rename default version to latest version
snehashisp Oct 30, 2024
ab0c8d8
Merge branch 'multiversioning' into mvn-validation
snehashisp Oct 30, 2024
d5f765b
Add logic for getting defaults
snehashisp Oct 30, 2024
84fb4fe
fix worker converter fetching
snehashisp Oct 31, 2024
9ded1af
fix header converter version
snehashisp Oct 31, 2024
a385dd4
Merge branch 'multiversioning' into mvn-validation
snehashisp Oct 31, 2024
a490ac1
Remove existing default logic
snehashisp Oct 31, 2024
d929a02
remove unwanted imports
snehashisp Oct 31, 2024
edd1067
Remove unwanted imports
snehashisp Oct 31, 2024
8f79bc3
Update imports
snehashisp Oct 31, 2024
648691b
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 31, 2024
9604dfe
refactor default version getting logic
snehashisp Oct 31, 2024
a9fe400
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 31, 2024
74a0d8f
Use current classloader when version is not present
snehashisp Oct 31, 2024
7190808
Merge branch 'multiversioning' into mvn-validation
snehashisp Oct 31, 2024
c604c74
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Oct 31, 2024
680fffc
checkpoint
snehashisp Nov 9, 2024
bfa73e7
Remove transformation and predicate getters
snehashisp Nov 9, 2024
0cc0f8a
Merge branch 'multiversioning' into mvn-validation
snehashisp Nov 9, 2024
49f1522
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Nov 9, 2024
fbbb0b8
add rawtype annotation
snehashisp Nov 9, 2024
bd4b665
Merge branch 'multiversioning' into mvn-validation
snehashisp Nov 9, 2024
105e746
Merge branch 'multiversioning' into mvn-validation-transforms
snehashisp Nov 9, 2024
5d7a335
remove json changes
snehashisp Nov 10, 2024
69381f3
Add version configs to worker
snehashisp Nov 10, 2024
4edbe2a
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Nov 10, 2024
8c334b9
Add a static loader swap method
snehashisp Nov 13, 2024
4a8f0d2
Merge branch 'multiversioning' into mvn-validation
snehashisp Nov 13, 2024
2c7693a
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Nov 13, 2024
c51270c
add null checks
snehashisp Nov 15, 2024
8ac4d56
Minor updates to get connectors
snehashisp Nov 24, 2024
ff108b0
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Nov 24, 2024
27cb9b1
add comment for servie loading bug and rename some methods
snehashisp Nov 29, 2024
720d619
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Nov 29, 2024
1f04289
remove some unndeded code
snehashisp Nov 29, 2024
5fef3f4
Resolve comments on 1st review
snehashisp Dec 5, 2024
5e9f3c7
Remove extra code
snehashisp Dec 5, 2024
d796f22
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 5, 2024
b2b51c6
Add plugin version utils for parsing versions
snehashisp Dec 5, 2024
da2c5f5
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 5, 2024
f8e2837
Remove unused imports
snehashisp Dec 5, 2024
093e9ef
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 5, 2024
aff9ac1
Use PluginVersionUtils version range requirement
snehashisp Dec 5, 2024
56fd5af
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 5, 2024
1c35aa9
Should return loader
snehashisp Dec 5, 2024
9c1c50d
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 5, 2024
ca43739
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 5, 2024
8d64cfa
address first set of comments
snehashisp Dec 5, 2024
73ecfb1
Add a delegated newPlugin class
snehashisp Dec 5, 2024
037d9af
Update abstract herder converter plugin fetching
snehashisp Dec 5, 2024
229cfa9
Update pluginversion util
snehashisp Dec 5, 2024
155271b
fix incorrect classloader equality check
snehashisp Dec 5, 2024
1d41648
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 5, 2024
5efd761
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 5, 2024
8c88d4c
fix whitespace issue
snehashisp Dec 5, 2024
d6e3392
Update version loading logic and add return delegating loader
snehashisp Dec 5, 2024
f969159
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 5, 2024
b6e2226
Combine loader logic
snehashisp Dec 5, 2024
e05bf9e
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 5, 2024
7d995ee
Use instanced PluginVersionUtil
snehashisp Dec 5, 2024
1ac60e4
Update default fetching and recommendor logic
snehashisp Dec 6, 2024
821a7fe
Don't expose some plugins methods
snehashisp Dec 6, 2024
b3c28f7
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 6, 2024
6d1aed4
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 6, 2024
261e697
Update suffix for verison
snehashisp Dec 6, 2024
f52a8fc
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 6, 2024
5b41efe
add safe swap loader instead of static swaploader
snehashisp Dec 6, 2024
773d9b0
Merge branch 'multiversioning' into mvn-validation
snehashisp Dec 6, 2024
475514d
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 6, 2024
dbbc843
Merge branch 'trunk' of https://github.com/apache/kafka into mvn-vali…
snehashisp Dec 8, 2024
0e89ba4
Cleanup and changes post multiversioning merge
snehashisp Dec 8, 2024
17ceac2
fix checkstyle
snehashisp Dec 8, 2024
3e6c910
Update and Isolate getConnector logic
snehashisp Dec 8, 2024
47d4991
fix tests for herders
snehashisp Dec 8, 2024
b0aee4c
attempt to fix large diff in distributed herder
snehashisp Dec 8, 2024
e0c3b16
spotlessJavaFix
snehashisp Dec 9, 2024
9a8fc1b
updates based on comments
snehashisp Dec 9, 2024
7efacbf
remove plugins.recommendor, use header converter defaults
snehashisp Dec 9, 2024
b980c03
minor changes
snehashisp Dec 9, 2024
871ae0a
Do validations for invalid versions
snehashisp Dec 10, 2024
f7d964d
Update plugin loading logic
snehashisp Dec 10, 2024
cba6924
test fix and minor adjustments
snehashisp Dec 10, 2024
520681c
bug fixes
snehashisp Dec 11, 2024
dc4f686
revert unwanted changes
snehashisp Dec 11, 2024
18b8d16
add recommendor for invalid version, attempt to remove unwanted update
snehashisp Dec 11, 2024
978e84b
remove changes in connector config
snehashisp Dec 11, 2024
b29b373
more unwanted change removal
snehashisp Dec 11, 2024
a0f2bd0
fix test
snehashisp Dec 11, 2024
72d86aa
checkstyle fix and remove gitignore changes
snehashisp Dec 11, 2024
14cf633
remove unwanted changes
snehashisp Dec 11, 2024
357d461
newline in gitignore
snehashisp Dec 11, 2024
642221d
Merge branch 'mvn-validation' into mvn-validation-transforms
snehashisp Dec 12, 2024
0c57bf9
remove unwanted changes
snehashisp Dec 12, 2024
87fb31a
Merge branch 'trunk' of https://github.com/apache/kafka into mvn-vali…
snehashisp Dec 13, 2024
4d8ec98
Attempt to fix diff
snehashisp Dec 13, 2024
53a7c78
checkstyle fix
snehashisp Dec 13, 2024
58869c1
fix bug in plugin versionloading and some tests
snehashisp Dec 13, 2024
e1a3ce0
add back concrete class check
snehashisp Dec 13, 2024
2fcf63a
fix abstract herder test
snehashisp Dec 13, 2024
6e997e9
Validate plugin type while getting verison to avoid showing wrong def…
snehashisp Dec 15, 2024
8458124
bug fixes to version fetching
snehashisp Dec 15, 2024
8d59940
checkstyle fix
snehashisp Dec 15, 2024
e0fa30d
add back config exception
snehashisp Dec 17, 2024
f3e82ab
use version plugin loading exception in validation
snehashisp Dec 18, 2024
2cfbf62
fix newPlugin
snehashisp Dec 23, 2024
37560be
cached connectors should throw original exception
snehashisp Dec 25, 2024
ac394b0
reorder operations in validate
snehashisp Dec 26, 2024
b9204d6
Remove unused method
snehashisp Dec 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,8 @@ protected ConfigDef initialConfigDef() {
}

@Override
protected Stream<Map.Entry<String, ConfigDef.ConfigKey>> configDefsForClass(String typeConfig) {
return super.configDefsForClass(typeConfig)
protected Stream<Map.Entry<String, ConfigDef.ConfigKey>> configDefsForClass(String typeConfig, String versionConfig, Plugins plugins) {
return super.configDefsForClass(typeConfig, versionConfig, plugins)
.filter(entry -> {
// The implicit parameters mask any from the transformer with the same name
if (TransformationStage.PREDICATE_CONFIG.equals(entry.getKey())
Expand Down Expand Up @@ -447,7 +447,13 @@ protected void validateProps(String prefix) {
"but there is no config '" + prefixedPredicate + "' defining a predicate to be negated.");
}
}
}.enrich(newDef);

@Override
protected ConfigDef.Recommender versionRecommender(String typeConfig) {
return new PluginsRecommenders(plugins).transformationPluginRecommender(typeConfig);
}

}.enrich(newDef, plugins);

new EnrichablePlugin<Predicate<?>>("Predicate", PREDICATES_CONFIG, PREDICATES_GROUP,
(Class) Predicate.class, props, requireFullConfig) {
Expand All @@ -460,7 +466,14 @@ protected Set<PluginDesc<Predicate<?>>> plugins() {
protected ConfigDef config(Predicate<?> predicate) {
return predicate.config();
}
}.enrich(newDef);

@Override
protected ConfigDef.Recommender versionRecommender(String typeConfig) {
return new PluginsRecommenders(plugins).predicatePluginRecommender(typeConfig);
}

}.enrich(newDef, plugins);

return newDef;
}

Expand Down Expand Up @@ -530,7 +543,6 @@ private static void updateKeyDefault(ConfigDef configDef, String versionConfigKe
));
}

@SuppressWarnings("unchecked")
private static <T> String fetchPluginVersion(Plugins plugins, String connectorClass, String connectorVersion, String pluginName) {
if (pluginName == null) {
return null;
Expand Down Expand Up @@ -576,7 +588,7 @@ public EnrichablePlugin(
}

/** Add the configs for this alias to the given {@code ConfigDef}. */
void enrich(ConfigDef newDef) {
void enrich(ConfigDef newDef, Plugins plugins) {
Object aliases = ConfigDef.parseType(aliasConfig, props.get(aliasConfig), Type.LIST);
if (!(aliases instanceof List)) {
return;
Expand All @@ -594,12 +606,15 @@ void enrich(ConfigDef newDef) {
int orderInGroup = 0;

final String typeConfig = prefix + "type";
final String versionConfig = prefix + WorkerConfig.PLUGIN_VERSION_SUFFIX;

// Add the class configuration
final ConfigDef.Validator typeValidator = ConfigDef.LambdaValidator.with(
(String name, Object value) -> {
validateProps(prefix);
// The value will be null if the class couldn't be found; no point in performing follow-up validation
if (value != null) {
getConfigDefFromConfigProvidingClass(typeConfig, (Class<?>) value);
getConfigDefFromPlugin(typeConfig, ((Class<?>) value).getName(), null, plugins);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this validator needs to include the error when the version is incorrect, similar to the converters.

}
},
() -> "valid configs for " + alias + " " + aliasKind.toLowerCase(Locale.ENGLISH));
Expand All @@ -608,7 +623,25 @@ void enrich(ConfigDef newDef) {
baseClass.getSimpleName() + " type for " + alias,
Collections.emptyList(), new ClassRecommender());

final ConfigDef configDef = populateConfigDef(typeConfig);
// Add the version configuration
final ConfigDef.Validator versionValidator = (name, value) -> {
try {
PluginUtils.connectorVersionRequirement((String) value);
} catch (InvalidVersionSpecificationException e) {
throw new ConfigException(name, value, e.getMessage());
}
if (value != null) {
getConfigDefFromPlugin(typeConfig, props.get(typeConfig), (String) value, plugins);
}
};
String defaultVersion = fetchPluginVersion(plugins, props.get(ConnectorConfig.CONNECTOR_CLASS_CONFIG),
props.get(ConnectorConfig.CONNECTOR_VERSION), props.get(typeConfig));
newDef.define(versionConfig, Type.STRING, defaultVersion, versionValidator, Importance.HIGH,
"Version of the '" + alias + "' " + aliasKind.toLowerCase(Locale.ENGLISH) + ".", group, orderInGroup++, Width.LONG,
baseClass.getSimpleName() + " version for " + alias,
Collections.emptyList(), versionRecommender(typeConfig));

final ConfigDef configDef = populateConfigDef(typeConfig, versionConfig, plugins);
if (configDef == null) continue;
newDef.embed(prefix, group, orderInGroup, configDef);
}
Expand All @@ -622,10 +655,10 @@ protected void validateProps(String prefix) {
* Populates the ConfigDef according to the configs returned from {@code configs()} method of class
* named in the {@code ...type} parameter of the {@code props}.
*/
protected ConfigDef populateConfigDef(String typeConfig) {
protected ConfigDef populateConfigDef(String typeConfig, String versionConfig, Plugins plugins) {
final ConfigDef configDef = initialConfigDef();
try {
configDefsForClass(typeConfig)
configDefsForClass(typeConfig, versionConfig, plugins)
.forEach(entry -> configDef.define(entry.getValue()));
} catch (ConfigException e) {
if (requireFullConfig) {
Expand All @@ -641,9 +674,8 @@ protected ConfigDef populateConfigDef(String typeConfig) {
* Return a stream of configs provided by the {@code configs()} method of class
* named in the {@code ...type} parameter of the {@code props}.
*/
protected Stream<Map.Entry<String, ConfigDef.ConfigKey>> configDefsForClass(String typeConfig) {
final Class<?> cls = (Class<?>) ConfigDef.parseType(typeConfig, props.get(typeConfig), Type.CLASS);
return getConfigDefFromConfigProvidingClass(typeConfig, cls)
protected Stream<Map.Entry<String, ConfigDef.ConfigKey>> configDefsForClass(String typeConfig, String versionConfig, Plugins plugins) {
return getConfigDefFromPlugin(typeConfig, props.get(typeConfig), props.get(versionConfig), plugins)
.configKeys().entrySet().stream();
}

Expand All @@ -652,30 +684,33 @@ protected ConfigDef initialConfigDef() {
return new ConfigDef();
}

/**
* Return {@link ConfigDef} from {@code cls}, which is expected to be a non-null {@code Class<T>},
* by instantiating it and invoking {@link #config(T)}.
* @param key
* @param cls The subclass of the baseclass.
*/
ConfigDef getConfigDefFromConfigProvidingClass(String key, Class<?> cls) {
if (cls == null) {
@SuppressWarnings("unchecked")
ConfigDef getConfigDefFromPlugin(String key, String pluginClass, String version, Plugins plugins) {
if (pluginClass == null) {
throw new ConfigException(key, null, "Not a " + baseClass.getSimpleName());
}
Utils.ensureConcreteSubclass(baseClass, cls);

T pluginInstance;
String connectorClass = props.get(CONNECTOR_CLASS_CONFIG);
if (connectorClass == null) {
throw new ConfigException(key, pluginClass, "Cannot reference the connector class itself.");
}
String connectorVersion = props.get(CONNECTOR_VERSION);
T plugin;
try {
pluginInstance = Utils.newInstance(cls, baseClass);
VersionRange connectorVersionRange = PluginUtils.connectorVersionRequirement(connectorVersion);
VersionRange pluginVersion = PluginUtils.connectorVersionRequirement(version);
plugin = (T) plugins.newPlugin(pluginClass, pluginVersion, plugins.pluginLoader(connectorClass, connectorVersionRange));
} catch (InvalidVersionSpecificationException e) {
// this should be caught in the validation of the version string
return new ConfigDef();
} catch (Exception e) {
throw new ConfigException(key, String.valueOf(cls), "Error getting config definition from " + baseClass.getSimpleName() + ": " + e.getMessage());
throw new ConfigException(key, pluginClass, "Error getting config definition from " + baseClass.getSimpleName() + ": " + e.getMessage());
}
ConfigDef configDef = config(pluginInstance);
ConfigDef configDef = config(plugin);
if (null == configDef) {
throw new ConnectException(
String.format(
"%s.config() must return a ConfigDef that is not null.",
cls.getName()
plugin.getClass().getName()
)
);
}
Expand All @@ -695,6 +730,8 @@ ConfigDef getConfigDefFromConfigProvidingClass(String key, Class<?> cls) {
*/
protected abstract Set<PluginDesc<T>> plugins();

protected abstract ConfigDef.Recommender versionRecommender(String typeConfig);

/**
* Recommend bundled transformations or predicates.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,11 @@ public String latestVersion(String classOrAlias) {
}

public String pluginVersion(String classOrAlias, ClassLoader sourceLoader) {
if (!(sourceLoader instanceof PluginClassLoader)) {
return latestVersion(classOrAlias);
String version = null;
if (sourceLoader instanceof PluginClassLoader) {
version = delegatingLoader.versionInLocation(classOrAlias, ((PluginClassLoader) sourceLoader).location());
}
return delegatingLoader.versionInLocation(classOrAlias, ((PluginClassLoader) sourceLoader).location());
return version != null ? version : latestVersion(classOrAlias);
}

public DelegatingClassLoader delegatingLoader() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@

import org.apache.kafka.common.config.ConfigDef;
import org.apache.kafka.connect.runtime.ConnectorConfig;
import org.apache.kafka.connect.transforms.Transformation;
import org.apache.kafka.connect.transforms.predicates.Predicate;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -74,6 +77,14 @@
return headerConverterPluginVersionRecommender;
}

public TransformationPluginRecommender transformationPluginRecommender(String classOrAlias) {
return new TransformationPluginRecommender(classOrAlias);
}

public PredicatePluginRecommender predicatePluginRecommender(String classOrAlias) {
return new PredicatePluginRecommender(classOrAlias);
}

public class ConnectorPluginVersionRecommender implements ConfigDef.Recommender {

@SuppressWarnings({"unchecked", "rawtypes"})
Expand Down Expand Up @@ -195,4 +206,60 @@
.map(PluginDesc::version).distinct().collect(Collectors.toList());
}
}

// Recommender for transformation and predicate plugins
public abstract class SMTPluginRecommender<T> implements ConfigDef.Recommender {

abstract protected Function<String, Set<PluginDesc<T>>> plugins();

Check notice on line 213 in connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginsRecommenders.java

View workflow job for this annotation

GitHub Actions / build / Compile and Check Java

Checkstyle error

'protected' modifier out of order with the JLS suggestions.

protected final String classOrAliasConfig;

public SMTPluginRecommender(String classOrAliasConfig) {
this.classOrAliasConfig = classOrAliasConfig;
}

@Override
@SuppressWarnings({"rawtypes"})
public List<Object> validValues(String name, Map<String, Object> parsedConfig) {
if (plugins == null) {
return Collections.emptyList();
}
if (parsedConfig.get(classOrAliasConfig) == null) {
return Collections.emptyList();
}

Class classOrAlias = (Class) parsedConfig.get(classOrAliasConfig);
return plugins().apply(classOrAlias.getName())
.stream().map(PluginDesc::version).distinct().collect(Collectors.toList());
}

@Override
public boolean visible(String name, Map<String, Object> parsedConfig) {
return true;
}
}

public class TransformationPluginRecommender extends SMTPluginRecommender<Transformation<?>> {

public TransformationPluginRecommender(String classOrAliasConfig) {
super(classOrAliasConfig);
}

@Override
protected Function<String, Set<PluginDesc<Transformation<?>>>> plugins() {
return plugins::transformations;
}
}

public class PredicatePluginRecommender extends SMTPluginRecommender<Predicate<?>> {

public PredicatePluginRecommender(String classOrAliasConfig) {
super(classOrAliasConfig);
}

@Override
protected Function<String, Set<PluginDesc<Predicate<?>>>> plugins() {
return plugins::predicates;
}
}
}
Loading