Skip to content

Commit 5fb6ccb

Browse files
mnonnenmachersschuberth
authored andcommitted
chore!: Remove the old plugin API
Remove the now unused classes of the old plugin API. Move the `getLoaderFor` helper function is moved to the `PluginFactory` which is now the only caller. Signed-off-by: Martin Nonnenmacher <[email protected]>
1 parent 1f854fb commit 5fb6ccb

File tree

4 files changed

+14
-87
lines changed

4 files changed

+14
-87
lines changed

model/src/main/kotlin/config/AdvisorConfiguration.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ package org.ossreviewtoolkit.model.config
2222
import com.fasterxml.jackson.annotation.JsonInclude
2323

2424
import org.ossreviewtoolkit.plugins.api.PluginConfig
25-
import org.ossreviewtoolkit.utils.common.Plugin
25+
import org.ossreviewtoolkit.plugins.api.PluginDescriptor
2626

2727
/**
2828
* The base configuration model of the advisor.
@@ -35,7 +35,7 @@ data class AdvisorConfiguration(
3535
val skipExcluded: Boolean = false,
3636

3737
/**
38-
* A map with [configuration][PluginConfig] for advice providers using the [provider type][Plugin.type] as key.
38+
* A map with [configuration][PluginConfig] for advice providers using the [plugin id][PluginDescriptor.id] as key.
3939
*/
4040
val config: Map<String, PluginConfig>? = null
4141
)

model/src/main/kotlin/config/ProviderPluginConfiguration.kt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,22 @@ package org.ossreviewtoolkit.model.config
2121

2222
import com.fasterxml.jackson.annotation.JsonIgnore
2323

24-
import org.ossreviewtoolkit.utils.common.ConfigurablePluginFactory
24+
import org.ossreviewtoolkit.plugins.api.PluginDescriptor
25+
import org.ossreviewtoolkit.plugins.api.PluginFactory
2526
import org.ossreviewtoolkit.utils.common.Options
26-
import org.ossreviewtoolkit.utils.common.Plugin
2727

2828
/**
29-
* The configuration of provider [plugins][ConfigurablePluginFactory]. This class is used when multiple instances of the
29+
* The configuration of provider [plugins][PluginFactory]. This class is used when multiple instances of the
3030
* same type of plugin should be configurable, like it is for example possible for package curation providers.
3131
* Therefore, each configured plugin gets a unique [id] in addition to the plugin [type] to be able to distinguish
3232
* different configurations for the same plugin type.
3333
*/
3434
data class ProviderPluginConfiguration(
3535
/**
36-
* The [type][Plugin.type] of the provider.
36+
* The [id][PluginDescriptor.id] of the provider plugin.
3737
*/
38+
// TODO: Solve name conflict as this property refers to the plugin id, but this class already has an id property
39+
// which could be confusing.
3840
val type: String,
3941

4042
/**

plugins/api/src/main/kotlin/PluginFactory.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
package org.ossreviewtoolkit.plugins.api
2121

22-
import org.ossreviewtoolkit.utils.common.getLoaderFor
22+
import java.util.ServiceLoader
2323

2424
/**
2525
* A factory interface for creating plugins of type [PLUGIN]. The different plugin endpoints ORT provides must inherit
@@ -56,3 +56,8 @@ interface PluginFactory<out PLUGIN : Plugin> {
5656
interface Plugin {
5757
val descriptor: PluginDescriptor
5858
}
59+
60+
/**
61+
* Return a [ServiceLoader] that is capable of loading services of type [T].
62+
*/
63+
inline fun <reified T : Any> getLoaderFor(): ServiceLoader<T> = ServiceLoader.load(T::class.java)

utils/common/src/main/kotlin/PluginManager.kt

Lines changed: 0 additions & 80 deletions
This file was deleted.

0 commit comments

Comments
 (0)