Package org.jtalks.jcommune.plugin.api.core

Examples of org.jtalks.jcommune.plugin.api.core.Plugin


     */
    private ModelAndView getModel(PluginConfiguration configuration) {
        Map<String, String> labels = new HashMap<>();
        List<Plugin> plugins = pluginLoader.getPlugins(new NameFilter(configuration.getName()));
        if (!plugins.isEmpty()) {
            Plugin plugin = plugins.get(0);
            if (plugin != null) {
                labels = translatePropertiesLabels(configuration.getProperties(), plugin);
            }
        }
        return new ModelAndView("plugin/pluginConfiguration")
View Full Code Here


        when(pluginConfigurationDao.get(Long.valueOf(pluginId))).thenReturn(pluginConfiguration);
        List<Plugin> pluginList = new ArrayList<>();
        pluginList.add(plugin);
        when(pluginLoader.getPlugins()).thenReturn(pluginList);

        Plugin result = pluginService.getPluginById(pluginId);
        assertEquals(result, plugin);
    }
View Full Code Here

    @PreAuthorize("hasPermission(#forumComponentId, 'COMPONENT', 'GeneralPermission.ADMIN')")
    public void updateConfiguration(PluginConfiguration pluginConfiguration,
                                    long forumComponentId) throws NotFoundException, UnexpectedErrorException {
        String name = pluginConfiguration.getName();
        List<Plugin> pluginsList = pLuginLoader.getPlugins();
        Plugin willBeConfigured = findPluginByName(pluginsList, name);
        if (willBeConfigured == null) {
            throw new NotFoundException("Plugin " + name + " is not loaded");
        }
        willBeConfigured.configure(pluginConfiguration);
        try {
            saveNewPluginConfiguration(pluginConfiguration);
        } catch (RuntimeException ex) {
            throw new UnexpectedErrorException(ex);
        }
View Full Code Here

    }

    @Override
    public Plugin getPluginById(String pluginId, PluginFilter... filters) throws NotFoundException {
        PluginConfiguration conf = getDao().get(Long.valueOf(pluginId));
        Plugin plugin = findPluginByName(pLuginLoader.getPlugins(filters), conf.getName());
        if (plugin == null) {
            throw new NotFoundException("Plugin with Id '" + pluginId + "' not found.");
        }
        return plugin;
    }
View Full Code Here

        }
        return plugin;
    }

    private Plugin findPluginByName(List<Plugin> searchSource, String pluginName) {
        Plugin foundPlugin = null;
        for (Plugin plugin : searchSource) {
            if (StringUtils.equals(pluginName, plugin.getName())) {
                foundPlugin = plugin;
            }
        }
View Full Code Here

    @RequestMapping(value = "/plugin/{pluginId}/{action}")
    public void pluginAction(@PathVariable String pluginId, @PathVariable String action,
                             HttpServletRequest request, HttpServletResponse response) {
        try {
            Plugin plugin = pluginService.getPluginById(pluginId, new TypeFilter(ExtendedPlugin.class));
            ((ExtendedPlugin) plugin).doAction(pluginId, action, request, response);
        } catch (org.jtalks.common.service.exceptions.NotFoundException ex) {
            LOGGER.error("Can't perform action {}: plugin with id {} not found", action, pluginId);
        }
    }
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.plugin.api.core.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.