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

net.aequologica.neo.shakuntala.EventWriterDagImpl Maven / Gradle / Ivy

There is a newer version: 0.6.7
Show newest version
package net.aequologica.neo.shakuntala;

import java.io.IOException;

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import net.aequologica.neo.shakuntala.dagr.DagComputer;

@Singleton
@Named(value = "dag")
public class EventWriterDagImpl extends AbstractEventWriter implements EventWriter {
    
    final static String DAG =  "dag";

    @Inject
    @Named("application.conf")
    private EventSpyConfig config;

    @Override
    public void init() throws IOException {
        super.init(); // must call super to set the shutdownHook

        if (config == null) {
            throw new RuntimeException();
        }

        if (!config.isActive(DAG)) {
            return;
        }

    }

    @Override
    public void write(final Event event) throws IOException {
        if (event == null) {
            return;
        }

        if (!config.isActive(DAG)) {
            return;
        }

        if (event.getKey() != null && event.getKey().equals(DAG)) {
            Object object = event.getObject();
            if (object instanceof DagComputer) {
                DagComputer dagComputer = (DagComputer)object;
                dagComputer.write(config.getDagURI(), config.getProxy());
            }
        }
    }


    @Override
    public void close() throws IOException {
        super.close();

        if (!config.isActive(DAG)) {
            return;
        }

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy