Package org.b3log.latke.plugin

Examples of org.b3log.latke.plugin.AbstractPlugin


        try {
            // Reads plugin status from datastore and clear plugin datastore
            for (final JSONObject oldPluginDesc : persistedPlugins) {
                final String descId = oldPluginDesc.getString(Keys.OBJECT_ID);
                final AbstractPlugin plugin = get(plugins, descId);

                pluginRepository.remove(descId);

                if (null != plugin) {
                    final String status = oldPluginDesc.getString(Plugin.PLUGIN_STATUS);
                    final String setting = oldPluginDesc.optString(Plugin.PLUGIN_SETTING);

                    plugin.setStatus(PluginStatus.valueOf(status));
                    try {
                        if (StringUtils.isNotBlank(setting)) {
                            plugin.setSetting(new JSONObject(setting));
                        }
                    } catch (final JSONException e) {
                        LOGGER.log(Level.WARN, "the formatter of the old config failed to convert to json", e);
                    }
                }
            }

            // Adds these plugins into datastore
            for (final AbstractPlugin plugin : plugins) {
                final JSONObject pluginDesc = plugin.toJSONObject();

                pluginRepository.add(pluginDesc);

                LOGGER.log(Level.TRACE, "Refreshed plugin[{0}]", pluginDesc);
            }
View Full Code Here


        try {
            // Reads plugin status from datastore and clear plugin datastore
            for (final JSONObject oldPluginDesc : persistedPlugins) {
                final String descId = oldPluginDesc.getString(Keys.OBJECT_ID);
                final AbstractPlugin plugin = get(plugins, descId);

                PLUGIN_REPOS.remove(descId);

                if (null != plugin) {
                    final String status =
                            oldPluginDesc.getString(Plugin.PLUGIN_STATUS);
                    plugin.setStatus(PluginStatus.valueOf(status));
                }
            }

            // Adds these plugins into datastore
            for (final AbstractPlugin plugin : plugins) {
                final JSONObject pluginDesc = plugin.toJSONObject();
                PLUGIN_REPOS.add(pluginDesc);

                LOGGER.log(Level.FINEST, "Refreshed plugin[{0}]", pluginDesc);
            }
View Full Code Here

        PLUGIN_REPOS.setCacheEnabled(false);

        // Reads plugin status from datastore and clear plugin datastore
        for (final JSONObject oldPluginDesc : persistedPlugins) {
            final String descId = oldPluginDesc.getString(Keys.OBJECT_ID);
            final AbstractPlugin plugin = get(plugins, descId);

            PLUGIN_REPOS.remove(descId);

            if (null != plugin) {
                final String status =
                        oldPluginDesc.getString(Plugin.PLUGIN_STATUS);
                plugin.setStatus(PluginStatus.valueOf(status));
            }
        }

        // Adds these plugins into datastore
        for (final AbstractPlugin plugin : plugins) {
            final JSONObject pluginDesc = plugin.toJSONObject();
            PLUGIN_REPOS.addAsync(pluginDesc);
           
            LOGGER.log(Level.FINEST, "Refreshed plugin[{0}]", pluginDesc);
        }
       
View Full Code Here

TOP

Related Classes of org.b3log.latke.plugin.AbstractPlugin

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.