public static JarPluginLoader loadSelfContained(
            final String selfContainedPluginName,
            final PluginClassLoaderFactory classLoaderFactory)
            throws InvalidJarPluginException {
        final Manifest manifest = SelfContainedJarFiles.getFirstManifest(selfContainedPluginName);
        final Attributes manifestAttributes = manifest.getMainAttributes();
        final int spiVersion = getPluginSpiVersionFromManifest(manifestAttributes);

        if (spiVersion == 0) {
            final String mainClassName = getPluginMainClassNameFromManifest(manifestAttributes);
            final Class mainClass = loadSelfContainedJarPluginMainClass(
                    selfContainedPluginName, mainClassName, classLoaderFactory);
            return new JarPluginLoader(manifestAttributes, mainClass);
        }

        throw new InvalidJarPluginException("Unknown SPI version of JAR plugin: " + spiVersion);
    }
JarPluginLoader loads a JAR-based Embulk plugin class.

It implements {@code AutoCloseable} so that it can load the contents lazily in the future.
It is recommended to try-with-resources to use this class.
embulk-core/src/main/java/org/embulk/plugin/jar/JarPluginLoader.java