private boolean checkPreconditions(ServletContext servletContext, InitialContext ic) {
        GlobalConfiguration globalConfiguration = LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class);
        if (!globalConfiguration.getShouldRun()) {
            Scope.getCurrentScope().getLog(getClass()).info(LogType.LOG, "Liquibase did not run on " + hostName
                    + " because "+ LiquibaseConfiguration.getInstance().describeValueLookupLogic(globalConfiguration.getProperty(GlobalConfiguration.SHOULD_RUN))
                            + " was set to false");
            return false;
        }

        String machineIncludes = (String) servletValueContainer.getValue(LIQUIBASE_HOST_INCLUDES);
        String machineExcludes = (String) servletValueContainer.getValue(LIQUIBASE_HOST_EXCLUDES);

        boolean shouldRun = false;
        if ((machineIncludes == null) && (machineExcludes == null)) {
            shouldRun = true;
        } else if (machineIncludes != null) {
            for (String machine : machineIncludes.split(",")) {
                machine = machine.trim();
                if (hostName.equalsIgnoreCase(machine)) {
                    shouldRun = true;
                }
            }
        } else if (machineExcludes != null) {
            shouldRun = true;
            for (String machine : machineExcludes.split(",")) {
                machine = machine.trim();
                if (hostName.equalsIgnoreCase(machine)) {
                    shouldRun = false;
                }
            }
        }

        if (globalConfiguration.getShouldRun() && globalConfiguration.getProperty(GlobalConfiguration.SHOULD_RUN).getWasOverridden()) {
            shouldRun = true;
            servletContext.log("ignoring " + LIQUIBASE_HOST_INCLUDES + " and "
                    + LIQUIBASE_HOST_EXCLUDES + ", since " + LiquibaseConfiguration.getInstance().describeValueLookupLogic(globalConfiguration.getProperty(GlobalConfiguration.SHOULD_RUN))
                    + "=true");
        }
        if (!shouldRun) {
            servletContext.log("LiquibaseServletListener did not run due to "
                    + LIQUIBASE_HOST_INCLUDES + " and/or " + LIQUIBASE_HOST_EXCLUDES + "");
            return false;
        }
        return true;
    }
private boolean checkPreconditions(ServletContext servletContext, InitialContext ic) {
        GlobalConfiguration globalConfiguration = LiquibaseConfiguration.getInstance().getConfiguration(GlobalConfiguration.class);
        if (!globalConfiguration.getShouldRun()) {
            Scope.getCurrentScope().getLog(getClass()).info(LogType.LOG, "Liquibase did not run on " + hostName
                    + " because "+ LiquibaseConfiguration.getInstance().describeValueLookupLogic(globalConfiguration.getProperty(GlobalConfiguration.SHOULD_RUN))
                            + " was set to false");
            return false;
        }

        String machineIncludes = (String) servletValueContainer.getValue(LIQUIBASE_HOST_INCLUDES);
        String machineExcludes = (String) servletValueContainer.getValue(LIQUIBASE_HOST_EXCLUDES);

        boolean shouldRun = false;
        if ((machineIncludes == null) && (machineExcludes == null)) {
            shouldRun = true;
        } else if (machineIncludes != null) {
            for (String machine : machineIncludes.split(",")) {
                machine = machine.trim();
                if (hostName.equalsIgnoreCase(machine)) {
                    shouldRun = true;
                }
            }
        } else if (machineExcludes != null) {
            shouldRun = true;
            for (String machine : machineExcludes.split(",")) {
                machine = machine.trim();
                if (hostName.equalsIgnoreCase(machine)) {
                    shouldRun = false;
                }
            }
        }

        if (globalConfiguration.getShouldRun() && globalConfiguration.getProperty(GlobalConfiguration.SHOULD_RUN).getWasOverridden()) {
            shouldRun = true;
            servletContext.log("ignoring " + LIQUIBASE_HOST_INCLUDES + " and "
                    + LIQUIBASE_HOST_EXCLUDES + ", since " + LiquibaseConfiguration.getInstance().describeValueLookupLogic(globalConfiguration.getProperty(GlobalConfiguration.SHOULD_RUN))
                    + "=true");
        }
        if (!shouldRun) {
            servletContext.log("LiquibaseServletListener did not run due to "
                    + LIQUIBASE_HOST_INCLUDES + " and/or " + LIQUIBASE_HOST_EXCLUDES + "");
            return false;
        }
        return true;
    }
private boolean checkPreconditions ( ServletContext servletContext , InitialContext ic ) { GlobalConfiguration globalConfiguration = LiquibaseConfiguration . getInstance ( ) . getConfiguration ( GlobalConfiguration . class ) ; if ( ! globalConfiguration . getShouldRun ( ) ) { Scope . getCurrentScope ( ) . getLog ( getClass ( ) ) . info ( LogType . LOG , "Liquibase did not run on " + hostName + " because " + LiquibaseConfiguration . getInstance ( ) . describeValueLookupLogic ( globalConfiguration . getProperty ( GlobalConfiguration . SHOULD_RUN ) ) + " was set to false" ) ; return false ; } String machineIncludes = ( String ) servletValueContainer . getValue ( LIQUIBASE_HOST_INCLUDES ) ; String machineExcludes = ( String ) servletValueContainer . getValue ( LIQUIBASE_HOST_EXCLUDES ) ; boolean shouldRun = false ; if ( ( machineIncludes == null ) && ( machineExcludes == null ) ) { shouldRun = true ; } else if ( machineIncludes != null ) { for ( String machine : machineIncludes . split ( "," ) ) { machine = machine . trim ( ) ; if ( hostName . equalsIgnoreCase ( machine ) ) { shouldRun = true ; } } } else if ( machineExcludes != null ) { shouldRun = true ; for ( String machine : machineExcludes . split ( "," ) ) { machine = machine . trim ( ) ; if ( hostName . equalsIgnoreCase ( machine ) ) { shouldRun = false ; } } } if ( globalConfiguration . getShouldRun ( ) && globalConfiguration . getProperty ( GlobalConfiguration . SHOULD_RUN ) . getWasOverridden ( ) ) { shouldRun = true ; servletContext . log ( "ignoring " + LIQUIBASE_HOST_INCLUDES + " and " + LIQUIBASE_HOST_EXCLUDES + ", since " + LiquibaseConfiguration . getInstance ( ) . describeValueLookupLogic ( globalConfiguration . getProperty ( GlobalConfiguration . SHOULD_RUN ) ) + "=true" ) ; } if ( ! shouldRun ) { servletContext . log ( "LiquibaseServletListener did not run due to " + LIQUIBASE_HOST_INCLUDES + " and/or " + LIQUIBASE_HOST_EXCLUDES + "" ) ; return false ; } return true ; }
Checks if the update is supposed to be executed. That depends on several conditions:
<ol>
<li>if liquibase.shouldRun is <code>false</code> the update will not be executed.</li>
<li>if {@value LiquibaseServletListener#LIQUIBASE_HOST_INCLUDES} contains the current hostname, the the update will be executed.</li>
<li>if {@value LiquibaseServletListener#LIQUIBASE_HOST_EXCLUDES} contains the current hostname, the the update will not be executed.</li>
</ol>
Checks if the update is supposed to be executed . That depends on several conditions : <ol > <li > if liquibase . shouldRun is <code > false< / code > the update will not be executed . < / li > <li > if {