Package org.elasticsearch.plugins

Examples of org.elasticsearch.plugins.Plugin


    private CrateLoader(Settings settings) {
        ServiceLoader<CrateComponent> crateComponents = ServiceLoader.load(CrateComponent.class);
        plugins = new ArrayList<>();
        MapBuilder<Plugin, List<OnModuleReference>> onModuleReferences = MapBuilder.newMapBuilder();
        for (CrateComponent crateComponent : crateComponents) {
            Plugin plugin = crateComponent.createPlugin(settings);
            plugins.add(plugin);
            List<OnModuleReference> list = Lists.newArrayList();
            for (Method method : plugin.getClass().getDeclaredMethods()) {
                if (!method.getName().equals("onModule")) {
                    continue;
                }
                if (method.getParameterTypes().length == 0 || method.getParameterTypes().length > 1) {
                    logger.warn("Plugin: {} implementing onModule with no parameters or more than one parameter", plugin.name());
                    continue;
                }
                Class moduleClass = method.getParameterTypes()[0];
                if (!Module.class.isAssignableFrom(moduleClass)) {
                    logger.warn("Plugin: {} implementing onModule by the type is not of Module type {}", plugin.name(), moduleClass);
                    continue;
                }
                method.setAccessible(true);
                //noinspection unchecked
                list.add(new OnModuleReference(moduleClass, method));
View Full Code Here

TOP

Related Classes of org.elasticsearch.plugins.Plugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.