Package org.jnode.plugin

Examples of org.jnode.plugin.PluginDescriptor


    public void refresh() {
        super.refresh();
        try {
            final PluginManager mgr = InitialNaming.lookup(PluginManager.NAME);
            final PluginDescriptor descr = mgr.getRegistry().getPluginDescriptor(name);
            if (descr != null) {
                addStringln("Name:");
                addStringln("\t" + descr.getId());
                addStringln("Provider:");
                addStringln("\t" + descr.getProviderName());
                addStringln("State :");

                try {
                    if (descr.getPlugin().isActive()) {
                        addStringln("\tactive");
                    } else {
                        addStringln("\tinactive");
                    }
                } catch (PluginException PE) {
                    System.err.println(PE);
                }

                addStringln("Prerequisites:");
                PluginPrerequisite[] allPreqs = descr.getPrerequisites();
                PluginPrerequisite current;
                for (int i = 0; i < allPreqs.length; i++) {
                    current = allPreqs[i];
                    addStringln("\t" + current.getPluginReference().getId() + "\t\t" +
                        current.getPluginReference().getVersion());
View Full Code Here


                String id = descr.getId();
                rows.add(id);
                List<?> fragments = ((PluginDescriptorModel) descr).fragments();
                if (fragments.size() > 0) {
                    for (Object o : fragments) {
                        PluginDescriptor pd = (PluginDescriptor) o;
                        rows.add(pd.getId() + "\b" + id);
                    }
                }
            }
            Collections.sort(rows);
            for (String row : rows) {
View Full Code Here

     * @throws BuildException
     */
    protected Plugin processPlugin(File descriptor, JarFiles jarFiles)
        throws BuildException {
        try {
            final PluginDescriptor descr = readDescriptor(descriptor);
            String fullPluginId = descr.getId() + "_" + descr.getVersion();

            if (!jarFiles.hasPluginJar(fullPluginId)) {
                System.out.println("WARNING: no Jar file found for plugin " + fullPluginId);
                return null;
            }
View Full Code Here

     * @see java.net.URLConnection#connect()
     */
    public void connect() throws IOException {
        try {
            final PluginManager pluginMgr = InitialNaming.lookup(PluginManager.NAME);
            final PluginDescriptor descr = pluginMgr.getRegistry().getPluginDescriptor(pluginId);
            if (descr == null) {
                throw new IOException("Plugin " + pluginId + " not found");
            }
            this.jarFile = ((PluginDescriptorModel) descr).getJarFile();
            if (this.jarFile == null) {
View Full Code Here

                systemSet.add(descr.getId());
            }
        }
        // Remove those plugin where some prerequisites do not exist
        for (Iterator<PluginDescriptor> i = all.values().iterator(); i.hasNext();) {
            final PluginDescriptor descr = (PluginDescriptor) i.next();
            if (!prerequisitesExist(descr, all)) {
                BootLogInstance.get().info("Skipping plugin " + descr.getId());
                all.remove(descr.getId());
                systemSet.remove(descr.getId());
                i = all.values().iterator();
            }
        }

        // Now create a sorted list
        final ArrayList<PluginDescriptor> list = new ArrayList<PluginDescriptor>();
        final HashSet<String> nameSet = new HashSet<String>();

        while (all.size() > 0) {
            int additions = 0;
            for (Iterator<PluginDescriptor> i = all.values().iterator(); i.hasNext();) {
                final PluginDescriptor descr = (PluginDescriptor) i.next();
                if (canAdd(descr, nameSet, systemSet)) {
                    list.add(descr);
                    nameSet.add(descr.getId());
                    all.remove(descr.getId());
                    systemSet.remove(descr.getId());
                    additions++;
                    i = all.values().iterator();
                }

            }
View Full Code Here

                public ClassLoader run() {
                    return getClass().getClassLoader();
                }
            });
        if (loader instanceof PluginClassLoader) {
            final PluginDescriptor descr = ((PluginClassLoader) loader).getDeclaringPluginDescriptor();
            descr.addListener(new PluginListener());
        }
    }
View Full Code Here

    }

    @Override
    protected void startPlugin() throws PluginException {
        try {
            PluginDescriptor descriptor = getDescriptor();

            KeyboardLayoutManager klmgr = new KeyboardLayoutManager(descriptor.getExtensionPoint("keyboard-layouts"));
            InitialNaming.bind(KeyboardLayoutManager.NAME, klmgr);

            MouseProtocolHandlerManager mphmgr =
                new MouseProtocolHandlerManager(descriptor.getExtensionPoint("mouse-protocol-handlers"));
            InitialNaming.bind(MouseProtocolHandlerManager.NAME, mphmgr);
        } catch (NamingException ex) {
            throw new PluginException(ex);
        }
    }
View Full Code Here

        }
        final int reqMax = requires.length;
        final PluginClassLoaderImpl[] preLoaders = new PluginClassLoaderImpl[reqMax];
        for (int i = 0; i < reqMax; i++) {
            final String reqId = requires[i].getPluginReference().getId();
            final PluginDescriptor reqDescr = registry.getPluginDescriptor(reqId);
            final ClassLoader cl = reqDescr.getPluginClassLoader();
            if (cl instanceof PluginClassLoaderImpl) {
                preLoaders[i] = (PluginClassLoaderImpl) cl;
            }
        }
        final VmClassLoader currentVmClassLoader = this.vmClassLoader;
View Full Code Here

            out.println(row);
        }
    }

    private void listPlugin(String id) throws PluginException {
        final PluginDescriptor descr = mgr.getRegistry().getPluginDescriptor(id);
        if (descr != null) {
            out.format(fmt_list,
                descr.getId(),
                descr.getPlugin().isActive() ? str_active : str_inactive,
                descr.getPlugin().getDescriptor().getVersion()
            );
            out.println();
        } else {
            out.format(fmt_no_plugin, id);
        }
View Full Code Here

        }
    }

    private void loadPluginData(Map<String, PluginData> descriptors,
                                File descrFile) {
        final PluginDescriptor descr = readDescriptor(descrFile);
        final String fullId = descr.getId() + "_" + descr.getVersion();

        if (descriptors.containsKey(fullId)) {
            final PluginData otherData = descriptors.get(fullId);
            throw new BuildException("Same id(" + fullId + ") for 2 plugins: "
                + otherData.getDescriptorFile() + ", " + descrFile);
        }

        // Create & store plugin data
        final PluginData data = new PluginData(descrFile, fullId);
        data.setDescriptor(descr);
        final String fname = PLUGINS_SUBDIR + "/" + descr.getId() + EXT;
        data.setHtmlFile(fname);

        descriptors.put(fullId, data);
    }
View Full Code Here

TOP

Related Classes of org.jnode.plugin.PluginDescriptor

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.