001/*
002 * (C) Copyright 2006-2009 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Nuxeo - initial API and implementation
018 *
019 * $Id$
020 */
021package org.nuxeo.runtime.management.counters;
022
023/**
024 * Service interface to manage Counters. This services hides the Counters implementation so that Counters's updated
025 * don't have to be dependent on Simon
026 *
027 * @author Tiry (tdelprat@nuxeo.com)
028 */
029public interface CounterManager {
030
031    /**
032     * Increase a counter
033     *
034     * @param counterName
035     */
036    void increaseCounter(String counterName);
037
038    void increaseCounter(String counterName, long value);
039
040    /**
041     * Set the value of a counter
042     *
043     * @param counterName
044     * @param value
045     */
046    void setCounterValue(String counterName, long value);
047
048    /**
049     * Decrease a counter
050     *
051     * @param counterName
052     */
053    void decreaseCounter(String counterName);
054
055    void decreaseCounter(String counterName, long value);
056
057    /**
058     * Get recorder values of the counter over time
059     *
060     * @param counterName
061     * @return
062     */
063    CounterHistoryStack getCounterHistory(String counterName);
064
065    /**
066     * Enables all counters
067     */
068    void enableCounters();
069
070    /**
071     * Desable all couters
072     */
073    void disableCounters();
074
075}