Package it.freedomotic.api

Examples of it.freedomotic.api.Plugin


        initComponents();
        populatePluginsList();
        //add listener to category selection changes
        cmbPlugin.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                Plugin item = (Plugin) cmbPlugin.getSelectedItem();
                btnDefault.setEnabled(false);
                getConfiguration(item);
            }
        });
View Full Code Here


    private void populatePluginsList() {
        cmbPlugin.removeAllItems();

        for (Client client : api.getClients("plugin")) {
            if (client instanceof Plugin) {
                Plugin plugin = (Plugin) client;
                cmbPlugin.addItem(plugin);
            }
        }
    }
View Full Code Here

        //Close the output stream
        out.close();
    }

    private void rollbackConfiguration() {
        Plugin item = (Plugin) cmbPlugin.getSelectedItem();
        txtArea.setText(predefined.get(item));
    }
View Full Code Here

        this.dispose();
    }//GEN-LAST:event_btnCancelActionPerformed

    private void btnSaveActionPerformed(java.awt.event.ActionEvent evt)    {//GEN-FIRST:event_btnSaveActionPerformed

        Plugin item = (Plugin) cmbPlugin.getSelectedItem();
        String name = item.getName();

        try {
            saveConfiguration(item.getFile(),
                    txtArea.getText());
            //stopping and unloading the plugin
            item.stop();
            clients.remove(item);
            //reload it with the new configuration
            System.out.println(item.getFile().getParentFile().toString());
            pluginsManager.loadSingleBoundle(item.getFile().getParentFile());

            //if not loaded sucessfully reset to old configuration
            if (clients.get(name) == null) {
                //reset to old working config and reload plugin
                rollbackConfiguration();
                saveConfiguration(item.getFile(),
                        txtArea.getText());
                pluginsManager.loadSingleBoundle(item.getFile().getParentFile());
                clients.get(name).start();
                JOptionPane.showMessageDialog(this,
                        I18n.msg("warn_reset_old_config"));
            } else {
                clients.get(name).start();
View Full Code Here

                client = mergePackageConfiguration(client, loader.getPath());
            } catch (IOException ex) {
                throw new PluginLoadingException("Missing PACKAGE info file " + ex.getMessage(), ex);
            }
            if (client instanceof Plugin) {
                Plugin p = (Plugin) client;
                p.loadPermissionsFromManifest();
                if (p.getConfiguration().getBooleanProperty("enable-i18n", false)) {
                    p.getApi().getI18n().registerPluginBundleDir(p);
                }
            }
            clientStorage.add(client);
        }
    }
View Full Code Here

                    for (String className : classNames) {
                        //remove the .class at the end of file
                        String name = className.substring(0, className.length() - 6);
                        Class clazz = BoundleLoaderFactory.getClass(pluginJar, name);
                        Class superclass = clazz.getSuperclass();
                        Plugin plugin;

                        if (superclass != null) { //null if class is Object
                            //we allow the dynamic loading only to ADDONS of this classes

                            if ((superclass.getName().equals("it.freedomotic.api.Actuator"))
View Full Code Here

        Client client = get(name);

        if ((client != null) && client instanceof Plugin) {
            //already installed
            //now check for version
            Plugin plugin = (Plugin) client;

            if (plugin.getVersion() == null) {
                return -1;
            }

            return getOldestVersion(plugin.getVersion(),
                    version);
        } else {
            //not installed
            return -1;
        }
View Full Code Here

     * @param description
     * @return
     */
    @Override
    public Plugin createPluginPlaceholder(final String simpleName, final String type, final String description) {
        final Plugin placeholder =
                new Plugin(simpleName) {
            @Override
            public String getDescription() {
                if (description == null) {
                    return "Plugin Unavailable. Error on loading";
                } else {
                    return description;
                }
            }

            @Override
            public String getName() {
                return "Cannot start " + simpleName;
            }

            @Override
            public String getType() {
                return type;
            }

            @Override
            public void start() {
            }

            @Override
            public void stop() {
            }

            @Override
            public boolean isRunning() {
                return false;
            }

            @Override
            public void showGui() {
            }

            @Override
            public void hideGui() {
            }
        };

        placeholder.setDescription(description);
        placeholder.configuration = new Config();

        return placeholder;
    }
View Full Code Here

    @Override
    public void onMessage(ObjectMessage message) {
        try {
            //here a plugin manifest is expected
            Config manifest = (Config) message.getObject();
            Plugin plugin = new Plugin(manifest.getProperty("name"),
                    manifest);
            clientStorage.add(plugin);
            LOG.info("Enqueued remote plugin " + plugin.getName());
        } catch (JMSException ex) {
            LOG.severe("Join Plugin receives a not valid plugin manifest");
        }
    }
View Full Code Here

    private void populateProtocol() {
        txtProtocol.addItem("unknown");


        for (Client client : api.getClients("plugin")) {
            Plugin plugin = (Plugin) client;
            String protocol = plugin.getConfiguration().getStringProperty("protocol.name", "");

            if (!protocol.isEmpty()) {
                txtProtocol.addItem(protocol);

                //set the current protocol value
View Full Code Here

TOP

Related Classes of it.freedomotic.api.Plugin

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.