Search in sources :

Example 1 with PluginRepositoryException

use of com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException in project jqa-core-framework by buschmais.

the class ReportPluginRepositoryImpl method getReportPlugins.

private Map<String, ReportPlugin> getReportPlugins(List<JqassistantPlugin> plugins) throws PluginRepositoryException {
    Map<String, ReportPlugin> reportPlugins = new HashMap<>();
    for (JqassistantPlugin plugin : plugins) {
        ReportType reportType = plugin.getReport();
        if (reportType != null) {
            for (IdClassType classType : reportType.getClazz()) {
                ReportPlugin reportPlugin = createInstance(classType.getValue());
                if (reportPlugin != null) {
                    try {
                        reportPlugin.initialize();
                    } catch (ReportException e) {
                        throw new PluginRepositoryException("Cannot initialize report plugin " + reportPlugin, e);
                    }
                    String id = classType.getId();
                    if (id == null) {
                        id = reportPlugin.getClass().getSimpleName();
                    }
                    reportPlugins.put(id, reportPlugin);
                }
            }
        }
    }
    return reportPlugins;
}
Also used : IdClassType(com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType) PluginRepositoryException(com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException) ReportPlugin(com.buschmais.jqassistant.core.report.api.ReportPlugin) HashMap(java.util.HashMap) JqassistantPlugin(com.buschmais.jqassistant.core.plugin.schema.v1.JqassistantPlugin) ReportException(com.buschmais.jqassistant.core.report.api.ReportException) ReportType(com.buschmais.jqassistant.core.plugin.schema.v1.ReportType)

Aggregations

PluginRepositoryException (com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException)1 IdClassType (com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType)1 JqassistantPlugin (com.buschmais.jqassistant.core.plugin.schema.v1.JqassistantPlugin)1 ReportType (com.buschmais.jqassistant.core.plugin.schema.v1.ReportType)1 ReportException (com.buschmais.jqassistant.core.report.api.ReportException)1 ReportPlugin (com.buschmais.jqassistant.core.report.api.ReportPlugin)1 HashMap (java.util.HashMap)1