Package net.xeoh.plugins.base.options.getplugin

Examples of net.xeoh.plugins.base.options.getplugin.OptionCapabilities


        // Check our options. In case we have a plugin selector, only use the selector
        if (ou.contains(OptionPluginSelector.class)) {
            pluginSelector = ou.get(OptionPluginSelector.class).getSelector();
        } else {
            // Capabilites we require
            final String capabilites[] = ou.get(OptionCapabilities.class, new OptionCapabilities()).getCapabilities();

            // Get caps as list
            final Collection<String> caps = Arrays.asList(capabilites);

            // Create our own selector
View Full Code Here


                // In the default case do an auto-detection ...
                final Class<? extends Plugin> typeOfField = (Class<? extends Plugin>) field.getType();

                this.logger.fine("Injecting plugin by autodetection (" + typeOfField.getName() + ") into " + spawnedPlugin.getClass().getName());

                field.set(spawnedPlugin, this.pluginManagerImpl.getPlugin(typeOfField, new OptionCapabilities(capabilities)));
            }
        }

        // And setter methods as well (aka Scala hack)
        for (Method method : methods) {

            final InjectPlugin ipannotation = method.getAnnotation(InjectPlugin.class);

            if (ipannotation != null) {

                // Obtain capabilities
                final String[] capabilities = ipannotation.requiredCapabilities();

                // Handle the plugin-parameter part
                // In the default case do an auto-detection ...
                final Class<? extends Plugin> typeOfMethod = (Class<? extends Plugin>) method.getParameterTypes()[0];

                this.logger.fine("Injecting plugin by autodetection (" + typeOfMethod.getName() + ") into " + spawnedPlugin.getClass().getName());

                try {
                    method.invoke(spawnedPlugin, this.pluginManagerImpl.getPlugin(typeOfMethod, new OptionCapabilities(capabilities)));
                } catch (IllegalArgumentException e) {
                    this.logger.warning("Unable to inject plugin " + typeOfMethod + " into method " + method);
                    e.printStackTrace();
                } catch (InvocationTargetException e) {
                    this.logger.warning("Unable to inject plugin " + typeOfMethod + " into method " + method);
View Full Code Here

                        if (d.isOptional) {
                            this.logger.finest("Skipping dependency as optional " + d.pluginClass);
                            continue;
                        }

                        if (this.pluginManager.getPlugin(d.pluginClass, new OptionCapabilities(d.capabilites)) == null) {
                            resolvedAll = false;
                        }

                    }
View Full Code Here

TOP

Related Classes of net.xeoh.plugins.base.options.getplugin.OptionCapabilities

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.