Package net.xeoh.plugins.base

Examples of net.xeoh.plugins.base.PluginInformation


            @Override
            public boolean selectPlugin(GazeHandlerFactory creator) {

                GazeEvaluatorImpl.this.logger.finer("Examining plugin factory " + creator);

                final PluginInformation pi = GazeEvaluatorImpl.this.pluginInformation;

                if (!creator.getEvaluatorType().isAssignableFrom(listener.getClass()))
                    return false;

                GazeEvaluatorImpl.this.logger.finer("Plugin looks promising");

                // Now check the requested versions
                for (OptionRequestVersion rqv : requestedVersions) {
                    // Check if we're dealing with the proper listener.
                    if (!rqv.getListener().isAssignableFrom(listener.getClass()))
                        continue;

                    GazeEvaluatorImpl.this.logger.finer("Found a version request. Checking authors ... ");

                    // Check author
                    if (rqv.getAuthor() != null) {
                        if (!pi.getInformation(Information.AUTHORS, creator).contains(rqv.getAuthor()))
                            return false;
                    }

                    GazeEvaluatorImpl.this.logger.finer("Checking implementaiton version ... ");

                    // Check version
                    if (rqv.getVersion() >= 0) {
                        final Collection<String> information = pi.getInformation(Information.VERSION, creator);
                        if (information.size() != 1) return false;

                        final int version = Integer.parseInt(information.iterator().next());

                        // We accept any newer version
                        if (version < rqv.getVersion()) return false;
                    }

                    GazeEvaluatorImpl.this.logger.finer("Checking capabilities ... ");

                    // Check capabilities
                    if (rqv.getCapabilities().length > 0) {
                        final Collection<String> information = pi.getInformation(Information.CAPABILITIES, creator);

                        // Must match all caps
                        if (!information.containsAll(Arrays.asList(rqv.getCapabilities())))
                            return false;
                    }
View Full Code Here


    /**
     *
     */
    @Test
    public void testGetPluginClassOfP() {
        final PluginInformation pi = this.pm.getPlugin(PluginInformation.class);
        final TestAnnotations ta = this.pm.getPlugin(TestAnnotations.class);

        Assert.assertNotNull(ta);
        Collection<String> information = pi.getInformation(Information.CAPABILITIES, ta);
        Assert.assertNotNull(information);
        Assert.assertTrue(information.size() > 0);
    }
View Full Code Here

        Assert.assertNotNull("Pluginmanager must be there", this.pm);

        this.pm.addPluginsFrom(new File("tests/plugins/").toURI(), new OptionReportAfter());

        final TestAnnotations p1 = this.pm.getPlugin(TestAnnotations.class);
        final PluginInformation p2 = this.pm.getPlugin(PluginInformation.class);

        $(p2.getInformation(Information.CLASSPATH_ORIGIN, p1)).string().print();
    }
View Full Code Here

    /**
     *
     */
    @Test
    public void testGetPluginClassOfP() {
        final PluginInformation pi = this.pm.getPlugin(PluginInformation.class);
        final TestAnnotations ta = this.pm.getPlugin(TestAnnotations.class);
    }
View Full Code Here

    @Test
    public void testPluginInformation() {
        Assert.assertNotNull(this.pm);

        final TestAnnotations ta = this.pm.getPlugin(TestAnnotations.class);
        final PluginInformation pi = this.pm.getPlugin(PluginInformation.class);

        Assert.assertNotNull("TestAnnotaions must be there!", ta);
        Assert.assertNotNull("Plugin Information must be there", pi);

        final Collection<String> caps = pi.getInformation(Information.CAPABILITIES, ta);
        final Collection<String> author = pi.getInformation(Information.AUTHORS, ta);
        final Collection<String> version = pi.getInformation(Information.VERSION, ta);
        final Collection<String> origin = pi.getInformation(Information.CLASSPATH_ORIGIN, ta);
       
        Assert.assertTrue("Caps must contain SUNSHINE", caps.contains("SUNSHINE"));
        Assert.assertTrue("Caps must contain RAIN", caps.contains("RAIN"));
        Assert.assertTrue("Author must contain AUTHOR OK", author.contains("AUTHOR OK"));
        Assert.assertTrue("Version must be 667", version.contains("667"));
View Full Code Here

    /**
     *
     */
    @Test
    public void testVersion() {
        PluginInformation pi = this.pm.getPlugin(PluginInformation.class);
        Collection<String> information = pi.getInformation(Information.VERSION, pm);
        $(information).print();
       
    }
View Full Code Here

        props.setProperty(PluginManager.class, "classpath.filter.default.pattern", "");

        PluginManager pm = PluginManagerFactory.createPluginManager(props);
        pm.addPluginsFrom(URI.create("classpath://*"));
       
        final PluginInformation pi = pm.getPlugin(PluginInformation.class);
        final InformationAuthors information = pi.getInformation(pi, InformationAuthors.class);
    }
View Full Code Here

        System.out.println("X");
        pm.addPluginsFrom(new URI("classpath://*"));
        pm.addPluginsFrom(new File("coolplugin.jar").toURI());
        System.out.println("Y");

        final PluginInformation pi = pm.getPlugin(PluginInformation.class);
        final PluginManagerUtil pmu = new PluginManagerUtil(pm);
        Collection<Plugin> plugins = pmu.getPlugins(Plugin.class);
        for (Plugin p : plugins) {
            Collection<String> information = pi.getInformation(Information.CLASSPATH_ORIGIN, p);
            for (String string : information) {
                System.out.println(p + ": " + string);
            }
        }

View Full Code Here

        List<File> list = $(".").file().dir().filter(".*jar$").print().list();
        for (File file : list) {
            pm.addPluginsFrom(file.toURI());
        }
       
        PluginInformation pi = pm.getPlugin(PluginInformation.class);
        PluginManagerUtil pmu = new PluginManagerUtil(pm);
        Collection<Plugin> plugins = pmu.getPlugins();
       
        for (Plugin plugin : plugins) {
            System.out.println(plugin + ": ");
            $(pi.getInformation(Information.CLASSPATH_ORIGIN, plugin)).print();
        }
    }
View Full Code Here

TOP

Related Classes of net.xeoh.plugins.base.PluginInformation

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.