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.ArrayList;
017import java.util.List;
018
019import javax.validation.Valid;
020import javax.xml.bind.annotation.XmlAnyElement;
021import javax.xml.bind.annotation.XmlElementRef;
022import javax.xml.bind.annotation.XmlElementWrapper;
023import javax.xml.bind.annotation.XmlRootElement;
024
025import org.atteo.moonshine.services.Service;
026import org.w3c.dom.Element;
027
028/**
029 * Root class for the {@link Moonshine} configuration file.
030 */
031@XmlRootElement
032public class Config extends ConfigurableService {
033    @XmlElementWrapper(name = "properties")
034    @XmlAnyElement(lax = false)
035    private List<Element> properties;
036
037    @XmlElementRef
038    @Valid
039    private List<TopLevelService> services = new ArrayList<>();
040
041    @Override
042    public List<? extends Service> getSubServices() {
043        return services;
044    }
045}