<commit_before>/**
 * Copyright (c) 2013-2016, The SeedStack authors <http://seedstack.org>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.seedstack.business.internal.event;

import com.google.common.collect.*;
import io.nuun.kernel.api.plugin.InitState;
import io.nuun.kernel.api.plugin.context.InitContext;
import io.nuun.kernel.api.plugin.request.ClasspathScanRequest;
import io.nuun.kernel.core.AbstractPlugin;
import net.jodah.typetools.TypeResolver;
import org.apache.commons.configuration.Configuration;
import org.kametic.specifications.Specification;
import org.seedstack.business.Event;
import org.seedstack.business.EventHandler;
import org.seedstack.seed.core.spi.configuration.ConfigurationProvider;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static org.seedstack.seed.core.utils.BaseClassSpecifications.classIsAbstract;
import static org.seedstack.seed.core.utils.BaseClassSpecifications.classIsInterface;

/**
 * This plugin scans all EventHandler, then passes them to the EventModule.
 * It also determines the strategy to adopt for event: will they be sync or async ?
 *
 * @author <EMAIL>
 */
public class EventPlugin extends AbstractPlugin {

    public static final String PREFIX = "org.seedstack.business.event";
    private final Specification<Class<?>> eventHandlerSpecification = and(classImplements(EventHandler.class), not(classIsInterface()), not(classIsAbstract()));
    private final Specification<Class<?>> eventSpecification = and(classImplements(Event.class));

    private Multimap<Class<? extends Event>, Class<? extends EventHandler>> eventHandlersByEvent = ArrayListMultimap.create();

    private List<Class<? extends EventHandler>> eventHandlerClasses = new ArrayList<Class<? extends EventHandler>>();
    private boolean watchRepo;

    @Override
    public String name() {
        return "seed-business-event";<commit_msg>Add scan for ancestors that implements EventHandler<commit_after>/**
 * Copyright (c) 2013-2016, The SeedStack authors <http://seedstack.org>
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package org.seedstack.business.internal.event;

import com.google.common.collect.*;
import io.nuun.kernel.api.plugin.InitState;
import io.nuun.kernel.api.plugin.context.InitContext;
import io.nuun.kernel.api.plugin.request.ClasspathScanRequest;
import io.nuun.kernel.core.AbstractPlugin;
import net.jodah.typetools.TypeResolver;
import org.apache.commons.configuration.Configuration;
import org.kametic.specifications.Specification;
import org.seedstack.business.Event;
import org.seedstack.business.EventHandler;
import org.seedstack.seed.core.spi.configuration.ConfigurationProvider;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import static org.seedstack.seed.core.utils.BaseClassSpecifications.ancestorImplements;
import static org.seedstack.seed.core.utils.BaseClassSpecifications.classIsAbstract;
import static org.seedstack.seed.core.utils.BaseClassSpecifications.classIsInterface;

/**
 * This plugin scans all EventHandler, then passes them to the EventModule.
 * It also determines the strategy to adopt for event: will they be sync or async ?
 *
 * @author <EMAIL>
 */
public class EventPlugin extends AbstractPlugin {

    public static final String PREFIX = "org.seedstack.business.event";
    private final Specification<Class<?>> eventHandlerSpecification = and(ancestorImplements(EventHandler.class),not(classIsInterface()), not(classIsAbstract()));
    private final Specification<Class<?>> eventSpecification = and(classImplements(Event.class));

    private Multimap<Class<? extends Event>, Class<? extends EventHandler>> eventHandlersByEvent = ArrayListMultimap.create();

    private List<Class<? extends EventHandler>> eventHandlerClasses = new ArrayList<Class<? extends EventHandler>>();
    private boolean watchRepo;

    @Override
    public String name() {
        return "seed-business-event";
{'fraction_non_alphanumeric': 0.10414725069897483, 'fraction_numerical': 0.005591798695246971, 'mean_word_length': 5.3412112259970455, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4155874', 'n_tokens_mistral': 1195, 'n_tokens_neox': 1164, 'n_words': 319}