All Downloads are FREE. Search and download functionalities are using the official Maven repository.

liquibase.analytics.AnalyticsFactory Maven / Gradle / Ivy

The newest version!
package liquibase.analytics;

import liquibase.Scope;
import liquibase.analytics.configuration.AnalyticsArgs;
import liquibase.plugin.AbstractPluginFactory;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class AnalyticsFactory extends AbstractPluginFactory {

    @Override
    protected Class getPluginClass() {
        return AnalyticsListener.class;
    }

    @Override
    protected int getPriority(AnalyticsListener obj, Object... args) {
        return obj.getPriority();
    }

    public void handleEvent(Event event) {
        try {
            if (AnalyticsArgs.isAnalyticsEnabled()) {
                getPlugin().handleEvent(event);
            }
        } catch (Exception e) {
            Scope.getCurrentScope().getLog(getClass()).log(AnalyticsArgs.LOG_LEVEL.getCurrentValue(), "Failed to handle analytics event", e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy