Package net.xeoh.plugins.remotediscovery

Examples of net.xeoh.plugins.remotediscovery.DiscoveredPlugin


                // If the plugin in not exported, do nothing
                if (!exportInfo.isExported) continue;

                // If it is, construct required data.
                String hostAddress = (endpoint.address != null) ? endpoint.address.getHostAddress() : "127.0.0.1";
                DiscoveredPlugin discPlugin = constructPlugins(hostAddress, exportInfo.allExported, pingTime.get());
                this.checkCache.addToCache(plugin, endpoint, discPlugin);
                result.add(discPlugin);
            } catch (ClassCastException e) {
                // This should not be happen anymore....
                this.logger.warning(" Trying to convert a object from v2 to v3.");
View Full Code Here


    }

    final void doFilter(Collection<DiscoveredPlugin> plugins, DiscoverOption[] options) {
        final OptionUtils<DiscoverOption> ou = new OptionUtils<DiscoverOption>(options);

        DiscoveredPlugin best = plugins.iterator().next();

        if (ou.contains(OptionNearest.class)) {
            // Check all plugins
            for (DiscoveredPlugin p : plugins) {
                // If this one is closer, replace them
                if (p.getDistance() < best.getDistance()) {
                    best = p;
                }
            }

            // Remove all other plugins
            plugins.clear();
            plugins.add(best);
        }

        if (ou.contains(OptionYoungest.class)) {
            // Check all plugins
            for (DiscoveredPlugin p : plugins) {
                // If this one is closer, replace them
                if (p.getTimeSinceExport() < best.getTimeSinceExport()) {
                    best = p;
                }
            }

            // Remove all other plugins
            plugins.clear();
            plugins.add(best);
        }

        if (ou.contains(OptionOldest.class)) {
            // Check all plugins
            for (DiscoveredPlugin p : plugins) {
                // If this one is closer, replace them
                if (p.getTimeSinceExport() > best.getTimeSinceExport()) {
                    best = p;
                }
            }

            // Remove all other plugins
View Full Code Here

        if (result.size() == 0) return result;

        // Prepapare filter options ...
        final OptionUtils<DiscoverOption> ou = new OptionUtils<DiscoverOption>(options);

        DiscoveredPlugin best = result.iterator().next();

        if (ou.contains(OptionNearest.class)) {
            // Check all plugins
            for (final DiscoveredPlugin p : result) {
                // If this one is closer, replace them
                if (p.getDistance() < best.getDistance()) {
                    best = p;
                }
            }

            // Remove all other plugins
            result.clear();
            result.add(best);
        }

        if (ou.contains(OptionYoungest.class)) {
            // Check all plugins
            for (final DiscoveredPlugin p : result) {
                // If this one is closer, replace them
                if (p.getTimeSinceExport() < best.getTimeSinceExport()) {
                    best = p;
                }
            }

            // Remove all other plugins
            result.clear();
            result.add(best);
        }

        if (ou.contains(OptionOldest.class)) {
            // Check all plugins
            for (final DiscoveredPlugin p : result) {
                // If this one is closer, replace them
                if (p.getTimeSinceExport() > best.getTimeSinceExport()) {
                    best = p;
                }
            }

            // Remove all other plugins
View Full Code Here

        if (result.size() == 0) return result;

        // Prepapare filter options ...
        final OptionUtils<DiscoverOption> ou = new OptionUtils<DiscoverOption>(options);

        DiscoveredPlugin best = result.iterator().next();

        if (ou.contains(OptionNearest.class)) {
            // Check all plugins
            for (DiscoveredPlugin p : result) {
                // If this one is closer, replace them
                if (p.getDistance() < best.getDistance()) {
                    best = p;
                }
            }

            // Remove all other plugins
            result.clear();
            result.add(best);
        }

        if (ou.contains(OptionYoungest.class)) {
            // Check all plugins
            for (DiscoveredPlugin p : result) {
                // If this one is closer, replace them
                if (p.getTimeSinceExport() < best.getTimeSinceExport()) {
                    best = p;
                }
            }

            // Remove all other plugins
            result.clear();
            result.add(best);
        }

        if (ou.contains(OptionOldest.class)) {
            // Check all plugins
            for (DiscoveredPlugin p : result) {
                // If this one is closer, replace them
                if (p.getTimeSinceExport() > best.getTimeSinceExport()) {
                    best = p;
                }
            }

            // Remove all other plugins
View Full Code Here

TOP

Related Classes of net.xeoh.plugins.remotediscovery.DiscoveredPlugin

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.