All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.io.polywrap.plugin.PluginPackage.kt Maven / Gradle / Ivy

There is a newer version: 0.10.4
Show newest version
package io.polywrap.plugin

import io.polywrap.core.WrapPackage
import io.polywrap.core.Wrapper
import io.polywrap.core.wrap.WrapManifest

/**
 * Implementation of the [WrapPackage] interface for Plugin Wrap packages.
 *
 * @param TConfig The type of the plugin configuration
 * @property pluginModule The [PluginModule] instance used to create the plugin wrapper
 * @property manifest The [WrapManifest] instance for the plugin
 */
data class PluginPackage(
    private val pluginModule: PluginModule,
    private val manifest: WrapManifest
) : WrapPackage {

    private val wrapper: Wrapper by lazy { PluginWrapper(pluginModule) }

    /**
     * Produce an instance of the WrapPackage's WRAP manifest
     *
     * @return A [WrapManifest] instance
     */
    override fun getManifest(): Result = Result.success(manifest)

    /**
     * Produce an instance of the package's Plugin Wrapper
     *
     * @return A [PluginWrapper] instance
     */
    override fun createWrapper(): Wrapper = wrapper

    /**
     * Not Implemented. Throws a NotImplementedError.
     */
    override fun getFile(path: String): Result {
        throw NotImplementedError()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy