001    /**
002     * Copyright (c) 2010 Yahoo! Inc. All rights reserved.
003     * Licensed under the Apache License, Version 2.0 (the "License");
004     * you may not use this file except in compliance with the License.
005     * You may obtain a copy of the License at
006     *
007     *   http://www.apache.org/licenses/LICENSE-2.0
008     *
009     *  Unless required by applicable law or agreed to in writing, software
010     *  distributed under the License is distributed on an "AS IS" BASIS,
011     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012     *  See the License for the specific language governing permissions and
013     *  limitations under the License. See accompanying LICENSE file.
014     */
015    package org.apache.oozie.service;
016    
017    
018    /**
019     * A service is component managed by the {@link Services} singleton.
020     */
021    public interface Service {
022    
023        /**
024         * Prefix for all services configuration properties.
025         */
026        public static final String CONF_PREFIX = "oozie.service.";
027    
028        /**
029         * Initialize the service. <p/> Invoked by the {@link Service} singleton at start up time.
030         *
031         * @param services services singleton initializing the service.
032         * @throws ServiceException thrown if the service could not initialize.
033         */
034        public void init(Services services) throws ServiceException;
035    
036        /**
037         * Destroy the service. <p/> Invoked by the {@link Service} singleton at shutdown time.
038         */
039        public void destroy();
040    
041        /**
042         * Return the public interface of the service. <p/> Services are retrieved by its public interface. Specializations
043         * of services must return the public interface.
044         *
045         * @return the interface of the service.
046         */
047        public Class<? extends Service> getInterface();
048    
049    }