001/*
002 * Licensed under the Apache License, Version 2.0 (the "License");
003 * you may not use this file except in compliance with the License.
004 * You may obtain a copy of the License at
005 *
006 * http://www.apache.org/licenses/LICENSE-2.0
007 *
008 * Unless required by applicable law or agreed to in writing, software
009 * distributed under the License is distributed on an "AS IS" BASIS,
010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
011 * See the License for the specific language governing permissions and
012 * limitations under the License.
013 */
014package org.atteo.moonshine;
015
016import java.util.Collections;
017
018import javax.annotation.Nonnull;
019import javax.xml.bind.annotation.XmlRootElement;
020
021import org.atteo.evo.config.Configurable;
022import org.atteo.moonshine.services.Service;
023
024import com.google.inject.Module;
025
026/**
027 * Service which can be configured from XML configuration file.
028 * <p>
029 * Each service must define the name of the tag under which it can be referenced
030 * in the configuration file using {@literal @}{@link XmlRootElement} annotation.
031 * If you want your Service to be directly under the root tag in the configuration file it should
032 * extend {@link TopLevelService}.
033 * </p>
034 */
035public abstract class ConfigurableService extends Configurable implements Service {
036    @Override
037    public Module configure() {
038        return null;
039    }
040
041    @Override
042    public void close() {
043    }
044
045    @Override
046    public void start() {
047    }
048
049    @Override
050    public void stop() {
051    }
052
053    @Nonnull
054    @Override
055    public Iterable<? extends Service> getSubServices() {
056        return Collections.emptyList();
057    }
058}