/**
 * 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

@@ -952,16 +952,72 @@
 sinks;%0A%0A
+import com.telefonica.iot.cygnus.metrics.CygnusMetrics;%0A
 import j
@@ -1321,24 +1321,90 @@
 Events = 0;%0A
+    protected CygnusMetrics serviceMetrics = new CygnusMetrics();%0A
     %0A    /**
@@ -2470,16 +2470,427 @@
 ts%0A    %0A
+    /**%0A     * Gets serviceMetrics.%0A     * @return serviceMetrics%0A     */%0A    public CygnusMetrics getServiceMetrics() %7B%0A        return serviceMetrics;%0A    %7D // getServiceSubserviceMetrics%0A    %0A    /**%0A     * Sets serviceMetrics.%0A     * @param serviceMetrics%0A     */%0A    public void setServiceMetrics(CygnusMetrics serviceMetrics) %7B%0A        this.serviceMetrics = serviceMetrics;%0A    %7D // setServiceMetrics%0A    %0A
 %7D // Cyg

Add metrics