liquibase.analytics.AnalyticsFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of liquibase-core Show documentation
Show all versions of liquibase-core Show documentation
Liquibase is a tool for managing and executing database changes.
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);
}
}
}