<commit_before>/**
 * Copyright 2014-2017 Telefonica Investigación y Desarrollo, S.A.U
 *
 * This file is part of fiware-cygnus (FIWARE project).
 *
 * fiware-cygnus is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
 * General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * fiware-cygnus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Affero General Public License along with fiware-cygnus. If not, see
 * http://www.gnu.org/licenses/.
 *
 * For those usages not covered by the GNU Affero General Public License please contact with iot_support at tid dot es
 */
package com.telefonica.iot.cygnus.sinks;

import java.util.Date;
import org.apache.flume.sink.AbstractSink;

/**
 *
 * @author frb
 */
public abstract class CygnusSink extends AbstractSink {
    
    // statistics
    protected final long setupTime = new Date().getTime();
    protected long numProcessedEvents = 0;
    protected long numPersistedEvents = 0;
    
    /**
     * Gets the setup time.
     * @return The setup time (in miliseconds)
     */
    public long getSetupTime() {
        return setupTime;
    } // getSetupTime

    /**
     * Gets the number of processed events.
     * @return The number of processed events
     */
    public long getNumProcessedEvents() {
        return numProcessedEvents;
    } // getNumProcessedEvents

    /**
     * Gets the number of persisted events.
     * @return The number of persisted events.
     */
    public long getNumPersistedEvents() {
        return numPersistedEvents;
    } // getNumPersistedEvents
    
    /**
     * Sets the number of processed events.
     * @param n The number of processed events to be set
     */
    public void setNumProcessedEvents(long n) {
        numProcessedEvents = n;
    } // setNumProcessedEvents
    
    /**
     * Sets the number of persisted events.
     * @param n The number of persisted events to be set
     */
    public void setNumPersistedEvents(long n) {
        numPersistedEvents = n;
    } // setNumPersistedEvents
    
} // CygnusSink<commit_msg>[1339][cygnus-common][CygnusSink.java] Add metrics<commit_after>/**
 * Copyright 2014-2017 Telefonica Investigación y Desarrollo, S.A.U
 *
 * This file is part of fiware-cygnus (FIWARE project).
 *
 * fiware-cygnus is free software: you can redistribute it and/or modify it under the terms of the GNU Affero
 * General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your
 * option) any later version.
 * fiware-cygnus is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the
 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Affero General Public License along with fiware-cygnus. If not, see
 * http://www.gnu.org/licenses/.
 *
 * For those usages not covered by the GNU Affero General Public License please contact with iot_support at tid dot es
 */
package com.telefonica.iot.cygnus.sinks;

import com.telefonica.iot.cygnus.metrics.CygnusMetrics;
import java.util.Date;
import org.apache.flume.sink.AbstractSink;

/**
 *
 * @author frb
 */
public abstract class CygnusSink extends AbstractSink {
    
    // statistics
    protected final long setupTime = new Date().getTime();
    protected long numProcessedEvents = 0;
    protected long numPersistedEvents = 0;
    protected CygnusMetrics serviceMetrics = new CygnusMetrics();
    
    /**
     * Gets the setup time.
     * @return The setup time (in miliseconds)
     */
    public long getSetupTime() {
        return setupTime;
    } // getSetupTime

    /**
     * Gets the number of processed events.
     * @return The number of processed events
     */
    public long getNumProcessedEvents() {
        return numProcessedEvents;
    } // getNumProcessedEvents

    /**
     * Gets the number of persisted events.
     * @return The number of persisted events.
     */
    public long getNumPersistedEvents() {
        return numPersistedEvents;
    } // getNumPersistedEvents
    
    /**
     * Sets the number of processed events.
     * @param n The number of processed events to be set
     */
    public void setNumProcessedEvents(long n) {
        numProcessedEvents = n;
    } // setNumProcessedEvents
    
    /**
     * Sets the number of persisted events.
     * @param n The number of persisted events to be set
     */
    public void setNumPersistedEvents(long n) {
        numPersistedEvents = n;
    } // setNumPersistedEvents
    
    /**
     * Gets serviceMetrics.
     * @return serviceMetrics
     */
    public CygnusMetrics getServiceMetrics() {
        return serviceMetrics;
    } // getServiceSubserviceMetrics
    
    /**
     * Sets serviceMetrics.
     * @param serviceMetrics
     */
    public void setServiceMetrics(CygnusMetrics serviceMetrics) {
        this.serviceMetrics = serviceMetrics;
    } // setServiceMetrics
    
} // CygnusSink
{'fraction_non_alphanumeric': 0.07606263982102908, 'fraction_numerical': 0.004847129008202834, 'mean_word_length': 2.8076650106458483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7662501', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1459, 'n_words': 555}