Sha256: 9251cc883487434632067964b52f2cbfab0d59b06999bb13e951f08430fac9a4

Contents?: true

Size: 1.3 KB

Versions: 4

Compression:

Stored size: 1.3 KB

Contents

package org.embulk.tester;

import java.util.ArrayList;
import java.util.List;

import org.embulk.config.ConfigSource;
import org.embulk.plugin.InjectedPluginSource;
import org.embulk.spi.Extension;

import com.google.common.collect.ImmutableList;
import com.google.inject.Binder;
import com.google.inject.Module;


public class TestExtension implements Extension
{
    private static class PluginDefinition
    {
        public final Class<?> iface;
        public final String name;
        public final Class<?> impl;

        public PluginDefinition(Class<?> iface, String name, Class<?> impl)
        {
            this.iface = iface;
            this.name = name;
            this.impl = impl;
        }
    }

    private static List<PluginDefinition> plugins = new ArrayList<>();

    public static void addPlugin(Class<?> iface, String name, Class<?> impl)
    {
        plugins.add(new PluginDefinition(iface, name, impl));
    }

	@Override
	public List<Module> getModules(ConfigSource configsource) {
		Module module = new Module() {

			@Override
			public void configure(Binder binder) {
                for (PluginDefinition plugin : plugins) {
                    InjectedPluginSource.registerPluginTo(binder, plugin.iface, plugin.name, plugin.impl);
                }
			}
		};
		return ImmutableList.of(module);
	}

}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-parser-apache-custom-log-0.4.1 src/test/java/org/embulk/tester/TestExtension.java
embulk-parser-apache-custom-log-0.4.0 src/test/java/org/embulk/tester/TestExtension.java
embulk-parser-apache-custom-log-0.3.0 src/test/java/org/embulk/tester/TestExtension.java
embulk-parser-apache-custom-log-0.2.0 src/test/java/org/embulk/tester/TestExtension.java