Search in sources :

Example 1 with AvailabilityTask

use of org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask in project ddf by codice.

the class WfsSource method setupAvailabilityPoll.

private void setupAvailabilityPoll() {
    LOGGER.debug("Setting Availability poll task for {} minute(s) on Source {}", pollInterval, getId());
    WfsSourceAvailabilityCommand command = new WfsSourceAvailabilityCommand();
    long interval = TimeUnit.MINUTES.toMillis(pollInterval);
    if (availabilityPollFuture == null || availabilityPollFuture.isCancelled()) {
        if (availabilityTask == null) {
            availabilityTask = new AvailabilityTask(interval, command, getId());
        } else {
            availabilityTask.setInterval(interval);
        }
        // Run the availability check immediately prior to scheduling it in a thread.
        // This is necessary to allow the catalog framework to have the correct
        // availability when the source is bound
        availabilityTask.run();
        // Run the availability check every 1 second. The actually call to
        // the remote server will only occur if the pollInterval has
        // elapsed.
        availabilityPollFuture = scheduler.scheduleWithFixedDelay(availabilityTask, AvailabilityTask.NO_DELAY, AvailabilityTask.ONE_SECOND, TimeUnit.SECONDS);
    }
}
Also used : AvailabilityTask(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask)

Example 2 with AvailabilityTask

use of org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask in project alliance by codice.

the class NsiliSource method setupAvailabilityPoll.

public void setupAvailabilityPoll() {
    LOGGER.debug("Setting Availability poll task for {} minute(s) on Source {}", getPollInterval(), getId());
    Stanag4559AvailabilityCommand command = new Stanag4559AvailabilityCommand();
    long interval = TimeUnit.MINUTES.toMillis(getPollInterval());
    if (availabilityPollFuture == null || availabilityPollFuture.isCancelled()) {
        if (availabilityTask == null) {
            availabilityTask = new AvailabilityTask(interval, command, getId());
        } else {
            availabilityTask.setInterval(interval);
        }
        // Run the availability check immediately prior to scheduling it in a thread.
        // This is necessary to allow the catalog framework to have the correct
        // availability when the source is bound
        availabilityTask.run();
        // Schedule the availability check every 1 second. The actually call to
        // the remote server will only occur if the pollInterval has
        // elapsed.
        availabilityPollFuture = scheduler.scheduleWithFixedDelay(availabilityTask, AvailabilityTask.NO_DELAY, AvailabilityTask.ONE_SECOND, TimeUnit.SECONDS);
    } else {
        LOGGER.debug("No changes being made on the poller.");
    }
}
Also used : AvailabilityTask(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask)

Example 3 with AvailabilityTask

use of org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask in project ddf by codice.

the class AbstractCswSource method setupAvailabilityPoll.

protected void setupAvailabilityPoll() {
    LOGGER.debug("Setting Availability poll task for {} minute(s) on Source {}", cswSourceConfiguration.getPollIntervalMinutes(), cswSourceConfiguration.getId());
    long interval = TimeUnit.MINUTES.toMillis(cswSourceConfiguration.getPollIntervalMinutes());
    if (availabilityPollFuture == null || availabilityPollFuture.isCancelled()) {
        if (availabilityTask == null) {
            availabilityTask = new AvailabilityTask(interval, getAvailabilityCommand(), cswSourceConfiguration.getId());
        } else {
            // Any run of the polling operation should trigger the task to run
            availabilityTask.updateLastAvailableTimestamp(0L);
            availabilityTask.setInterval(interval);
        }
        // Run the availability check immediately prior to scheduling it in a thread.
        // This is necessary to allow the catalog framework to have the correct
        // availability when the source is bound
        availabilityTask.run();
        // Schedule the availability check every 1 second. The actually call to
        // the remote server will only occur if the pollInterval has
        // elapsed.
        availabilityPollFuture = scheduler.scheduleWithFixedDelay(availabilityTask, AvailabilityTask.NO_DELAY, AvailabilityTask.ONE_SECOND, TimeUnit.SECONDS);
    } else {
        LOGGER.debug("No changes being made on the poller.");
    }
}
Also used : AvailabilityTask(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask)

Example 4 with AvailabilityTask

use of org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask in project ddf by codice.

the class WfsSource method setupAvailabilityPoll.

private void setupAvailabilityPoll() {
    LOGGER.debug("Setting Availability poll task for {} minute(s) on Source {}", pollInterval, getId());
    WfsSourceAvailabilityCommand command = new WfsSourceAvailabilityCommand();
    long interval = TimeUnit.MINUTES.toMillis(pollInterval);
    if (availabilityPollFuture == null || availabilityPollFuture.isCancelled()) {
        if (availabilityTask == null) {
            availabilityTask = new AvailabilityTask(interval, command, getId());
        } else {
            availabilityTask.setInterval(interval);
        }
        // Run the availability check immediately prior to scheduling it in a thread.
        // This is necessary to allow the catalog framework to have the correct
        // availability when the source is bound
        availabilityTask.run();
        // Run the availability check every 1 second. The actually call to
        // the remote server will only occur if the pollInterval has
        // elapsed.
        availabilityPollFuture = scheduler.scheduleWithFixedDelay(availabilityTask, AvailabilityTask.NO_DELAY, AvailabilityTask.ONE_SECOND, TimeUnit.SECONDS);
    }
}
Also used : AvailabilityTask(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask)

Example 5 with AvailabilityTask

use of org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask in project ddf by codice.

the class WfsSource method setupAvailabilityPoll.

private void setupAvailabilityPoll() {
    LOGGER.debug("Setting Availability poll task for {} minute(s) on Source {}", pollInterval, getId());
    WfsSourceAvailabilityCommand command = new WfsSourceAvailabilityCommand();
    long interval = TimeUnit.MINUTES.toMillis(pollInterval);
    if (availabilityPollFuture == null || availabilityPollFuture.isCancelled()) {
        if (availabilityTask == null) {
            availabilityTask = new AvailabilityTask(interval, command, getId());
        } else {
            availabilityTask.setInterval(interval);
        }
        // Run the availability check immediately prior to scheduling it in a thread.
        // This is necessary to allow the catalog framework to have the correct
        // availability when the source is bound
        availabilityTask.run();
        // Run the availability check every 1 second. The actually call to
        // the remote server will only occur if the pollInterval has
        // elapsed.
        availabilityPollFuture = scheduler.scheduleWithFixedDelay(availabilityTask, AvailabilityTask.NO_DELAY, AvailabilityTask.ONE_SECOND, TimeUnit.SECONDS);
    }
}
Also used : AvailabilityTask(org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask)

Aggregations

AvailabilityTask (org.codice.ddf.spatial.ogc.catalog.common.AvailabilityTask)5