001/*
002 * (C) Copyright 2006-2011 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
020package org.nuxeo.ecm.core.management.api;
021
022import java.util.Collection;
023
024import org.nuxeo.ecm.core.management.probes.HealthCheckProbesDescriptor;
025import org.nuxeo.ecm.core.management.statuses.HealthCheckResult;
026
027public interface ProbeManager extends ProbeRunnerMBean {
028
029    Collection<ProbeInfo> getAllProbeInfos();
030
031    Collection<ProbeInfo> getInSuccessProbeInfos();
032
033    Collection<ProbeInfo> getInFailureProbeInfos();
034
035    ProbeInfo runProbe(ProbeInfo probe);
036
037    ProbeInfo runProbe(String name);
038
039    ProbeInfo getProbeInfo(String name);
040
041    ProbeInfo getProbeInfo(Class<? extends Probe> probeClass);
042
043    /**
044     * List of probes evaluated for a health check
045     *
046     * @since 9.3
047     */
048    Collection<ProbeInfo> getHealthCheckProbes();
049
050    /**
051     * Return the status of all the probes evaluated for a healthCheck. The probes are run if the last run was more than
052     * a short while ago
053     *
054     * @since 9.3
055     */
056    HealthCheckResult getOrRunHealthChecks();
057
058    /**
059     * This probe is taken into account for the healthCheck
060     *
061     * @since 9.3
062     */
063    void registerProbeForHealthCheck(HealthCheckProbesDescriptor descriptor);
064
065    /**
066     * Return the status of the given probe. The probe is run only if the last run was more than a short while ago
067     *
068     * @since 9.3
069     */
070    HealthCheckResult getOrRunHealthCheck(String probe);
071}