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