Search in sources :

Example 1 with IdClassType

use of com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType in project jqa-core-framework by buschmais.

the class RulePluginRepositoryImpl method initialize.

@Override
public void initialize() {
    for (JqassistantPlugin plugin : plugins) {
        IdClassListType ruleParsers = plugin.getRuleParser();
        if (ruleParsers != null) {
            for (IdClassType pluginType : ruleParsers.getClazz()) {
                RuleParserPlugin ruleParserPlugin = createInstance(pluginType.getValue());
                try {
                    ruleParserPlugin.initialize();
                } catch (RuleException e) {
                    throw new PluginRepositoryException("Cannot initialize plugin " + ruleParserPlugin, e);
                }
                ruleParserPlugins.add(ruleParserPlugin);
            }
        }
    }
}
Also used : IdClassType(org.jqassistant.schema.plugin.v1.IdClassType) PluginRepositoryException(com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException) RuleParserPlugin(com.buschmais.jqassistant.core.rule.api.reader.RuleParserPlugin) JqassistantPlugin(org.jqassistant.schema.plugin.v1.JqassistantPlugin) IdClassListType(org.jqassistant.schema.plugin.v1.IdClassListType) RuleException(com.buschmais.jqassistant.core.rule.api.model.RuleException)

Example 2 with IdClassType

use of com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType in project jqa-core-framework by buschmais.

the class AnalyzerPluginRepositoryImpl method initializeReportPlugins.

private void initializeReportPlugins(IdClassListType reportTypes) {
    if (reportTypes != null) {
        for (IdClassType classType : reportTypes.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);
            }
        }
    }
}
Also used : IdClassType(org.jqassistant.schema.plugin.v1.IdClassType) PluginRepositoryException(com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException) ReportPlugin(com.buschmais.jqassistant.core.report.api.ReportPlugin) ReportException(com.buschmais.jqassistant.core.report.api.ReportException)

Example 3 with IdClassType

use of com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType in project jqa-core-framework by buschmais.

the class ScannerPluginRepositoryImpl method getScannerPlugins.

private void getScannerPlugins(List<JqassistantPlugin> plugins) {
    for (JqassistantPlugin plugin : plugins) {
        IdClassListType scannerTypes = plugin.getScanner();
        if (scannerTypes != null) {
            for (IdClassType classType : scannerTypes.getClazz()) {
                ScannerPlugin<?, ?> scannerPlugin = createInstance(classType.getValue());
                if (scannerPlugin != null) {
                    scannerPlugin.initialize();
                    String id = classType.getId();
                    if (id == null) {
                        id = scannerPlugin.getClass().getSimpleName();
                    }
                    scannerPlugins.put(id, scannerPlugin);
                }
            }
        }
    }
}
Also used : IdClassType(org.jqassistant.schema.plugin.v1.IdClassType) JqassistantPlugin(org.jqassistant.schema.plugin.v1.JqassistantPlugin) IdClassListType(org.jqassistant.schema.plugin.v1.IdClassListType)

Example 4 with IdClassType

use of com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType 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)

Example 5 with IdClassType

use of com.buschmais.jqassistant.core.plugin.schema.v1.IdClassType in project jqa-core-framework by buschmais.

the class AnalyzerPluginRepositoryImpl method initializeRuleInterpreterPlugins.

private void initializeRuleInterpreterPlugins(JqassistantPlugin plugin) {
    IdClassListType ruleInterpreters = plugin.getRuleInterpreter();
    if (ruleInterpreters != null) {
        for (IdClassType pluginType : ruleInterpreters.getClazz()) {
            RuleInterpreterPlugin ruleInterpreterPlugin = createInstance(pluginType.getValue());
            ruleInterpreterPlugin.initialize();
            for (String language : ruleInterpreterPlugin.getLanguages()) {
                Collection<RuleInterpreterPlugin> plugins = ruleInterpreterPlugins.get(language.toLowerCase());
                if (plugins == null) {
                    plugins = new ArrayList<>();
                    ruleInterpreterPlugins.put(language.toLowerCase(), plugins);
                }
                plugins.add(ruleInterpreterPlugin);
            }
        }
    }
}
Also used : IdClassType(org.jqassistant.schema.plugin.v1.IdClassType) IdClassListType(org.jqassistant.schema.plugin.v1.IdClassListType) RuleInterpreterPlugin(com.buschmais.jqassistant.core.analysis.api.RuleInterpreterPlugin)

Aggregations

IdClassType (org.jqassistant.schema.plugin.v1.IdClassType)4 PluginRepositoryException (com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException)3 IdClassListType (org.jqassistant.schema.plugin.v1.IdClassListType)3 ReportException (com.buschmais.jqassistant.core.report.api.ReportException)2 ReportPlugin (com.buschmais.jqassistant.core.report.api.ReportPlugin)2 JqassistantPlugin (org.jqassistant.schema.plugin.v1.JqassistantPlugin)2 RuleInterpreterPlugin (com.buschmais.jqassistant.core.analysis.api.RuleInterpreterPlugin)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 RuleException (com.buschmais.jqassistant.core.rule.api.model.RuleException)1 RuleParserPlugin (com.buschmais.jqassistant.core.rule.api.reader.RuleParserPlugin)1 HashMap (java.util.HashMap)1