Package net.xeoh.plugins.base.impl.registry

Examples of net.xeoh.plugins.base.impl.registry.PluginRegistry


                rval.add("jspf.build:" + build);
            }
            break;

        case CLASSPATH_ORIGIN:
            final PluginRegistry pluginRegistry = pmi.getPluginRegistry();
            final PluginMetaInformation metaInformation = pluginRegistry.getMetaInformationFor(plugin);
            if (metaInformation != null && metaInformation.classMeta != null && metaInformation.classMeta.pluginOrigin != null)
                    rval.add(metaInformation.classMeta.pluginOrigin.toString());
            break;

        default:
View Full Code Here


        this.logger.finest("Trying to load " + name + " as a plugin.");

        // Obtain some shared objects
        // final JARCache jarCache = this.pluginManager.getJARCache();
        final ClassPathManager classPathManager = this.pluginManager.getClassPathManager();
        final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
        final PluginConfigurationUtil pcu = new PluginConfigurationUtil(this.pluginManager.getPluginConfiguration());
        final Spawner spawner = this.pluginManager.getSpawner();

        // Obtain information
        // final JARInformation jarInformation = jarCache.getJARInformation(name);
        // final String file = jarCache.classTofile(name);

        try {
            // Get class of the candidate
            final Class<?> possiblePlugin = classPathManager.loadClass(location, name);

            // Don't load plugins already spawned.
            if (name.startsWith("net.xeoh.plugins.base") ||
                name.startsWith("net.xeoh.plugins.diagnosis.") ||
                name.startsWith("net.xeoh.plugins.informationbroker.")) return;
           
            // Get the plugin's annotation
            final PluginImplementation annotation = possiblePlugin.getAnnotation(PluginImplementation.class);

            // Nothing to load here if no annotation is present
            if (annotation == null) { return; }


           
            // Don't load classes already loaded from this location
            final PluginClassMetaInformation preexistingMeta = pluginRegistry.getMetaInformationFor((Class<? extends Plugin>) possiblePlugin);
            if (preexistingMeta != null) {
                this.logger.info("Skipping plugin " + possiblePlugin + " because we already have it ");
                return;
            }

           
            // Register class at registry
            final PluginClassMetaInformation metaInformation = new PluginClassMetaInformation();
            metaInformation.pluginClassStatus = PluginClassStatus.ACCEPTED;
            if (location != null) {
                metaInformation.pluginOrigin = location.getToplevelLocation();
            } else {
                metaInformation.pluginOrigin = new URI("classpath://UNDEFINED");
            }
            pluginRegistry.registerPluginClass((Class<? extends Plugin>) possiblePlugin, metaInformation);

            // Update the class information of the corresponding cache entry
            this.logger.finer("Updating cache information");

            // Avoid loading if annotation request it.
View Full Code Here

     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    protected void processPending() {

        // Obtain shared objects
        final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
        final Spawner spawner = this.pluginManager.getSpawner();

        // All classes we want to spawn
        final Collection<Class<? extends Plugin>> toSpawn = new ArrayList<Class<? extends Plugin>>();
        toSpawn.addAll(pluginRegistry.getPluginClassesWithStatus(PluginClassStatus.CONTAINS_UNRESOLVED_DEPENDENCIES));
        toSpawn.addAll(pluginRegistry.getPluginClassesWithStatus(PluginClassStatus.SPAWNABLE));

        // Check if there is work to do.
        if (toSpawn.size() == 0) return;

        boolean loopAgain;

        do {
            // Classes we want to spawn
            final Collection<Class<? extends Plugin>> spawned = new ArrayList<Class<? extends Plugin>>();

            // Reset hasLoaded flag
            loopAgain = false;

            // Check all known classes ...
            for (final Class c : toSpawn) {
                this.logger.fine("Trying to load pending " + c);

                final PluginClassMetaInformation metaInformation = pluginRegistry.getMetaInformationFor(c);

                // If the class is spawnable, spawn it ...
                if (metaInformation.pluginClassStatus == PluginClassStatus.SPAWNABLE) {
                    this.logger.fine("Class found as SPAWNABLE. Trying to spawn it now " + c);

View Full Code Here

        this.logger.finest("Trying to load " + name + " as a plugin.");

        // Obtain some shared objects
        // final JARCache jarCache = this.pluginManager.getJARCache();
        final ClassPathManager classPathManager = this.pluginManager.getClassPathManager();
        final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
        final PluginConfigurationUtil pcu = new PluginConfigurationUtil(this.pluginManager.getPluginConfiguration());
        final Spawner spawner = this.pluginManager.getSpawner();

        // Obtain information
        // final JARInformation jarInformation = jarCache.getJARInformation(name);
        // final String file = jarCache.classTofile(name);

        try {
            // Get class of the candidate
            final Class<?> possiblePlugin = classPathManager.loadClass(location, name);

            // Don't load plugins already spawned.
            if (name.startsWith("net.xeoh.plugins.base") ||
                name.startsWith("net.xeoh.plugins.diagnosis.") ||
                name.startsWith("net.xeoh.plugins.informationbroker.")) return;
           
            // Get the plugin's annotation
            final PluginImplementation annotation = possiblePlugin.getAnnotation(PluginImplementation.class);

            // Nothing to load here if no annotation is present
            if (annotation == null) { return; }


           
            // Don't load classes already loaded from this location
            final PluginClassMetaInformation preexistingMeta = pluginRegistry.getMetaInformationFor((Class<? extends Plugin>) possiblePlugin);
            if (preexistingMeta != null) {
                this.logger.info("Skipping plugin " + possiblePlugin + " because we already have it ");
                return;
            }

           
            // Register class at registry
            final PluginClassMetaInformation metaInformation = new PluginClassMetaInformation();
            metaInformation.pluginClassStatus = PluginClassStatus.ACCEPTED;
            if (location != null) {
                metaInformation.pluginOrigin = location.getToplevelLocation();
            } else {
                metaInformation.pluginOrigin = new URI("classpath://UNDEFINED");
            }
            pluginRegistry.registerPluginClass((Class<? extends Plugin>) possiblePlugin, metaInformation);

            // Update the class information of the corresponding cache entry
            this.logger.finer("Updating cache information");

            // Avoid loading if annotation request it.
View Full Code Here

     */
    @SuppressWarnings({ "unchecked", "rawtypes" })
    protected void processPending() {

        // Obtain shared objects
        final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
        final Spawner spawner = this.pluginManager.getSpawner();

        // All classes we want to spawn
        final Collection<Class<? extends Plugin>> toSpawn = new ArrayList<Class<? extends Plugin>>();
        toSpawn.addAll(pluginRegistry.getPluginClassesWithStatus(PluginClassStatus.CONTAINS_UNRESOLVED_DEPENDENCIES));
        toSpawn.addAll(pluginRegistry.getPluginClassesWithStatus(PluginClassStatus.SPAWNABLE));

        // Check if there is work to do.
        if (toSpawn.size() == 0) return;

        boolean loopAgain;

        do {
            // Classes we want to spawn
            final Collection<Class<? extends Plugin>> spawned = new ArrayList<Class<? extends Plugin>>();

            // Reset hasLoaded flag
            loopAgain = false;

            // Check all known classes ...
            for (final Class c : toSpawn) {
                this.logger.fine("Trying to load pending " + c);

                final PluginClassMetaInformation metaInformation = pluginRegistry.getMetaInformationFor(c);

                // If the class is spawnable, spawn it ...
                if (metaInformation.pluginClassStatus == PluginClassStatus.SPAWNABLE) {
                    this.logger.fine("Class found as SPAWNABLE. Trying to spawn it now " + c);

View Full Code Here

            rval.add(Integer.toString(version.version()));
            break;

        case CLASSPATH_ORIGIN:
            if (pluggable instanceof Plugin) {
                final PluginRegistry pluginRegistry = pmi.getPluginRegistry();
                final PluggableMetaInformation metaInformation = pluginRegistry.getMetaInformationFor((Plugin) pluggable);
                if (metaInformation != null && metaInformation.classMeta != null && metaInformation.classMeta.pluginOrigin != null)
                    rval.add(metaInformation.classMeta.pluginOrigin.toString());
            } else {
                this.logger.info("CLASSPATH_ORIGIN cannot be requested for Pluglets at the moment");
            }
View Full Code Here

        this.logger.finest("Trying to load " + name + " as a plugin.");

        // Obtain some shared objects
        //final JARCache jarCache = this.pluginManager.getJARCache();
        final ClassPathManager classPathManager = this.pluginManager.getClassPathManager();
        final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
        final PluginConfigurationUtil pcu = new PluginConfigurationUtil(this.pluginManager.getPluginConfiguration());
        final Spawner spawner = this.pluginManager.getSpawner();

        // Obtain information
        //final JARInformation jarInformation = jarCache.getJARInformation(name);
        //final String file = jarCache.classTofile(name);

        try {
            // Get class of the candidate
            final Class<?> possiblePlugin = classPathManager.loadClass(location, name);

            // Don't load plugins already spawned.
            if (name.startsWith("net.xeoh.plugins.base")) return;

            // Get the plugin's annotation
            final PluginImplementation annotation = possiblePlugin.getAnnotation(PluginImplementation.class);

            // Nothing to load here if no annotation is present
            if (annotation == null) { return; }

            // Don't load classes already loaded from this location
            final PluggableClassMetaInformation preexistingMeta = pluginRegistry.getMetaInformationFor((Class<? extends Plugin>) possiblePlugin);
            if (preexistingMeta != null) {
                System.err.println("SKIPPING BECAUSE DOUBLE");
                return;
            }

            // Register class at registry
            final PluggableClassMetaInformation metaInformation = new PluggableClassMetaInformation();
            metaInformation.pluginClassStatus = PluginClassStatus.ACCEPTED;
            if (location != null) {
                metaInformation.pluginOrigin = location.getLocation();
            } else {
                metaInformation.pluginOrigin = new URI("classpath://UNDEFINED");
            }
            pluginRegistry.registerPluginClass((Class<? extends Plugin>) possiblePlugin, metaInformation);

            // Update the class information of the corresponding cache entry
            this.logger.finer("Updating cache information");

            /*
 
View Full Code Here

     */
    @SuppressWarnings("unchecked")
    protected void processPending() {

        // Obtain shared objects
        final PluginRegistry pluginRegistry = this.pluginManager.getPluginRegistry();
        final Spawner spawner = this.pluginManager.getSpawner();

        // All classes we want to spawn
        final Collection<Class<? extends Plugin>> toSpawn = new ArrayList<Class<? extends Plugin>>();
        toSpawn.addAll(pluginRegistry.getPluginClassesWithStatus(PluginClassStatus.CONTAINS_UNRESOLVED_DEPENDENCIES));
        toSpawn.addAll(pluginRegistry.getPluginClassesWithStatus(PluginClassStatus.SPAWNABLE));

        // Check if there is work to do.
        if (toSpawn.size() == 0) return;

        boolean loopAgain;

        do {
            // Classes we want to spawn
            final Collection<Class<? extends Plugin>> spawned = new ArrayList<Class<? extends Plugin>>();

            // Reset hasLoaded flag
            loopAgain = false;

            // Check all known classes ...
            for (final Class c : toSpawn) {
                this.logger.fine("Trying to load pending " + c);

                final PluggableClassMetaInformation metaInformation = pluginRegistry.getMetaInformationFor(c);

                // If the class is spawnable, spawn it ...
                if (metaInformation.pluginClassStatus == PluginClassStatus.SPAWNABLE) {
                    this.logger.fine("Class found as SPAWNABLE. Trying to spawn it now " + c);

View Full Code Here

TOP

Related Classes of net.xeoh.plugins.base.impl.registry.PluginRegistry

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.