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

com.credibledoc.substitution.reporting.logback.StartupTriggeringPolicy Maven / Gradle / Ivy

Go to download

This library serves for reports creation. These reports can describe a structure and behavior of some application or system. See the https://github.com/credibledoc/credible-doc/tree/master/substitution/substitution-reporting page.

There is a newer version: 1.0.51
Show newest version
package com.credibledoc.substitution.reporting.logback;

import ch.qos.logback.core.rolling.TriggeringPolicyBase;

import java.io.File;

/**
 * The {@link TriggeringPolicyBase} that triggered on startup when the previous file is not empty.
 *
 * @param  this event not used in the trigger logic
 *
 * @author Kyrylo Semenko
 */
public class StartupTriggeringPolicy extends TriggeringPolicyBase {

    private boolean isTriggeringEvent = true;

    /**
     * Return 'true' when the application launched.
     * @param activeFile is used for the decision
     * @param event is not used
     * @return Return 'true' at first time. Then return 'false'.
     */
    public boolean isTriggeringEvent(final File activeFile, final E event) {
        if (isTriggeringEvent) {
            isTriggeringEvent = false;
            // Without this condition a zero - length file has been created next to the activeFile
            return activeFile.length() > 0;
        }
        return false;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy