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 */
019package org.nuxeo.ecm.core.management.api;
020
021import java.util.List;
022
023/**
024 * Service interface used to manage AdministrativeStatus of Nuxeo's services on a given Nuxeo Instance (node)
025 *
026 * @author tiry
027 */
028public interface AdministrativeStatusManager {
029
030    String ADMINISTRATIVE_INSTANCE_ID = "org.nuxeo.ecm.instance.administrative.id";
031
032    String GLOBAL_INSTANCE_AVAILABILITY = "org.nuxeo.ecm.instance.availability";
033
034    String ADMINISTRATIVE_EVENT_CATEGORY = "administrativeCategory";
035
036    String ADMINISTRATIVE_EVENT_INSTANCE = "instanceIdentifier";
037
038    String ADMINISTRATIVE_EVENT_SERVICE = "serviceIdentifier";
039
040    String ACTIVATED_EVENT = "serviceActivated";
041
042    String PASSIVATED_EVENT = "servicePassivated";
043
044    /**
045     * List {@link AdministrativeStatus} for all tracked resources (Servers or Services).
046     */
047    List<AdministrativeStatus> getAllStatuses();
048
049    /**
050     * Get the {@link AdministrativeStatus} of a given resource.
051     */
052    AdministrativeStatus getStatus(String serviceIdentifier);
053
054    /**
055     * Get the {@link AdministrativeStatus} of a the local Nuxeo Instance.
056     */
057    AdministrativeStatus getNuxeoInstanceStatus();
058
059    /**
060     * Sets the {@link AdministrativeStatus} of a given resource.
061     */
062    AdministrativeStatus setStatus(String serviceIdentifier, String state, String message, String login);
063
064    /**
065     * Sets the {@link AdministrativeStatus} of the Local Nuxeo Instance.
066     */
067    AdministrativeStatus setNuxeoInstanceStatus(String state, String message, String login);
068
069    /**
070     * Mark a given resource as active.
071     */
072    AdministrativeStatus activate(String serviceIdentifier, String message, String login);
073
074    /**
075     * Mark local Nuxeo instance as active.
076     */
077    AdministrativeStatus activateNuxeoInstance(String message, String login);
078
079    /**
080     * Mark a given resource as non active.
081     */
082    AdministrativeStatus deactivate(String serviceIdentifier, String message, String login);
083
084    /**
085     * Mark local Nuxeo instance as non active.
086     */
087    AdministrativeStatus deactivateNuxeoInstance(String message, String login);
088
089}