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

com.powsybl.afs.storage.AbstractAppStorage Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2017, RTE (http://www.rte-france.com)
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */
package com.powsybl.afs.storage;

import com.powsybl.afs.storage.events.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author Chamseddine Benhamed {@literal }
 */
public abstract class AbstractAppStorage implements AppStorage {

    public static final String APPSTORAGE_NODE_TOPIC = "APPSTORAGE_NODE_TOPIC";
    public static final String APPSTORAGE_DEPENDENCY_TOPIC = "APPSTORAGE_DEPENDENCY_TOPIC";
    public static final String APPSTORAGE_TIMESERIES_TOPIC = "APPSTORAGE_TIMESERIES_TOPIC";

    protected EventsBus eventsBus;

    private final Logger logger = LoggerFactory.getLogger(AbstractAppStorage.class);

    protected void pushEvent(NodeEvent event, String topic) {
        if (eventsBus == null) {
            logger.warn("Event can't be pushed : No EventStore instance is available.");
            return;
        }
        eventsBus.pushEvent(event, topic);
    }

    @Override
    public EventsBus getEventsBus() {
        return eventsBus;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy