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.operations.watch;
019
020import org.simpleframework.xml.Element;
021import org.simpleframework.xml.Root;
022import org.syncany.operations.OperationOptions;
023import org.syncany.operations.cleanup.CleanupOperationOptions;
024import org.syncany.operations.down.DownOperationOptions;
025import org.syncany.operations.up.UpOperationOptions;
026
027/**
028 * The watch operation options represent the configuration parameters
029 * of the {@link WatchOperation}. They are used to alter the behavior of the
030 * operation, change interval times and enable/disable certain behaviors.
031 * 
032 * <p>The options can also be stored as XML within the daemon configuration.
033 * 
034 * @author Philipp C. Heckel <philipp.heckel@gmail.com>
035 */
036@Root(name="watch")
037public class WatchOperationOptions implements OperationOptions {
038        @Element(required = false)
039        private int interval = 2*60*1000;
040        
041        @Element(required = false)
042        private boolean announcements = true;
043        
044        @Element(required = false)
045        private String announcementsHost = "notify.syncany.org";
046        
047        @Element(required = false)
048        private int announcementsPort = 8080;
049        
050        @Element(required = false)
051        private int settleDelay = 3000;
052        
053        @Element(required = false)
054        private int cleanupInterval = 1*60*60*1000;
055        
056        @Element(required = false)
057        private boolean watcher = true;
058        
059        @Element(name = "up", required = false) 
060        private UpOperationOptions upOptions = new UpOperationOptions();
061        
062        @Element(name = "down", required = false)
063        private DownOperationOptions downOptions = new DownOperationOptions();
064        
065        @Element(name = "clean", required = false) 
066        private CleanupOperationOptions cleanupOptions = new CleanupOperationOptions();
067        
068        public int getInterval() {
069                return interval;
070        }
071
072        public void setInterval(int interval) {
073                this.interval = interval;
074        }
075
076        public boolean announcementsEnabled() {
077                return announcements;
078        }
079
080        public void setAnnouncements(boolean announcements) {
081                this.announcements = announcements;
082        }
083
084        public String getAnnouncementsHost() {
085                return announcementsHost;
086        }
087
088        public void setAnnouncementsHost(String announcementsHost) {
089                this.announcementsHost = announcementsHost;
090        }
091
092        public int getAnnouncementsPort() {
093                return announcementsPort;
094        }
095
096        public void setAnnouncementsPort(int announcementsPort) {
097                this.announcementsPort = announcementsPort;
098        }
099
100        public int getSettleDelay() {
101                return settleDelay;
102        }
103
104        public void setSettleDelay(int settleDelay) {
105                this.settleDelay = settleDelay;
106        }
107
108        public boolean watcherEnabled() {
109                return watcher;
110        }
111
112        public void setWatcher(boolean watcher) {
113                this.watcher = watcher;
114        }
115
116        public int getCleanupInterval() {
117                return cleanupInterval;
118        }
119
120        public void setCleanupInterval(int cleanupInterval) {
121                this.cleanupInterval = cleanupInterval;
122        }
123
124        public UpOperationOptions getUpOptions() {
125                return upOptions;
126        }
127
128        public void setUpOptions(UpOperationOptions upOptions) {
129                this.upOptions = upOptions;
130        }
131
132        public CleanupOperationOptions getCleanupOptions() {
133                return cleanupOptions;
134        }
135
136        public void setCleanupOptions(CleanupOperationOptions cleanupOptions) {
137                this.cleanupOptions = cleanupOptions;
138        }
139
140        public DownOperationOptions getDownOptions() {
141                return downOptions;
142        }
143
144        public void setDownOptions(DownOperationOptions downOptions) {
145                this.downOptions = downOptions;
146        }
147}