001package org.javasimon.source;
002
003import org.javasimon.Manager;
004import org.javasimon.Simon;
005
006/**
007 * Monitor source provides monitors (Simons) for a specific "location" name. This mechanism enables
008 * caching of monitors for "locations" that do not change but may be expensive to transform to
009 * Simon names, for instance.
010 *
011 * @param <L> Location/invocation context/name
012 * @param <M> Simon type
013 * @author gquintana
014 */
015public interface MonitorSource<L, M extends Simon> {
016        /**
017         * Indicates whether given location should be monitored or not.
018         *
019         * @param location Location
020         * @return true means monitored
021         */
022        boolean isMonitored(L location);
023
024        /**
025         * Returns the monitor for given location.
026         *
027         * @param location Location
028         * @return Monitor
029         */
030        M getMonitor(L location);
031
032        /**
033         * Returns the {@link Manager} used as a real source of monitors.
034         *
035         * @return Manager to get the monitors from
036         */
037        Manager getManager();
038}