Search in sources :

Example 1 with IdClassListType

use of org.jqassistant.schema.plugin.v1.IdClassListType 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 IdClassListType

use of org.jqassistant.schema.plugin.v1.IdClassListType 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 IdClassListType

use of org.jqassistant.schema.plugin.v1.IdClassListType 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 IdClassListType

use of org.jqassistant.schema.plugin.v1.IdClassListType in project jqa-core-framework by buschmais.

the class AnalyzerPluginRepositoryImpl method initialize.

@Override
public void initialize() {
    for (JqassistantPlugin plugin : plugins) {
        IdClassListType reportTypes = plugin.getReport();
        initializeReportPlugins(reportTypes);
        initializeRuleInterpreterPlugins(plugin);
    }
}
Also used : JqassistantPlugin(org.jqassistant.schema.plugin.v1.JqassistantPlugin) IdClassListType(org.jqassistant.schema.plugin.v1.IdClassListType)

Example 5 with IdClassListType

use of org.jqassistant.schema.plugin.v1.IdClassListType 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

IdClassListType (org.jqassistant.schema.plugin.v1.IdClassListType)4 IdClassType (org.jqassistant.schema.plugin.v1.IdClassType)4 JqassistantPlugin (org.jqassistant.schema.plugin.v1.JqassistantPlugin)3 PluginRepositoryException (com.buschmais.jqassistant.core.plugin.api.PluginRepositoryException)2 RuleInterpreterPlugin (com.buschmais.jqassistant.core.analysis.api.RuleInterpreterPlugin)1 ReportException (com.buschmais.jqassistant.core.report.api.ReportException)1 ReportPlugin (com.buschmais.jqassistant.core.report.api.ReportPlugin)1 RuleException (com.buschmais.jqassistant.core.rule.api.model.RuleException)1 RuleParserPlugin (com.buschmais.jqassistant.core.rule.api.reader.RuleParserPlugin)1