001/*
002 * Syncany, www.syncany.org
003 * Copyright (C) 2011-2016 Philipp C. Heckel <philipp.heckel@gmail.com> 
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU General Public License as published by
007 * the Free Software Foundation, either version 3 of the License, or
008 * (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU General Public License for more details.
014 *
015 * You should have received a copy of the GNU General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018package org.syncany.config.to;
019
020import org.simpleframework.xml.Element;
021import org.simpleframework.xml.Root;
022
023/**
024 * This class is the access object to configure the local daemon web
025 * server. It mainly defines whether to enable/disable the server,
026 * its bind port and IP address, as well as which certificates and
027 * key pairs to use. 
028 * 
029 * <p>It uses the Simple framework for XML serialization, and its corresponding
030 * annotation-based configuration.
031 *
032 * @see <a href="http://simple.sourceforge.net/">Simple framework</a>
033 * @author Philipp C. Heckel (philipp.heckel@gmail.com)
034 */
035@Root(strict = false)
036public class WebServerTO {
037        @Element(required = false)
038        private boolean enabled = true;
039        
040        @Element(required = false)
041        private String bindAddress = "127.0.0.1";
042        
043        @Element(required = false)
044        private int bindPort = 8443;
045        
046        @Element(required = false)
047        private boolean certificateAutoGenerate = true;
048        
049        @Element(required = false)
050        private String certificateCommonName = "localhost";
051
052        public boolean isEnabled() {
053                return enabled;
054        }
055
056        public String getBindAddress() {
057                return bindAddress;
058        }
059        
060        public int getBindPort() {
061                return bindPort;
062        }
063
064        public void setBindPort(int port) {
065                this.bindPort = port;
066        }
067
068        public boolean isCertificateAutoGenerate() {
069                return certificateAutoGenerate;
070        }
071        
072        public String getCertificateCommonName() {
073                return certificateCommonName;
074        }       
075}