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.plugin;
019
020import java.util.ArrayList;
021import java.util.Arrays;
022import java.util.List;
023
024import org.simpleframework.xml.Element;
025import org.simpleframework.xml.Root;
026import org.syncany.util.StringUtil;
027
028@Root(name = "pluginInfo", strict = false)
029public class PluginInfo {
030        @Element(name = "pluginId", required = true)
031        private String pluginId;
032
033        @Element(name = "pluginName", required = false)
034        private String pluginName;
035
036        @Element(name = "pluginVersion", required = false)
037        private String pluginVersion;
038        
039        @Element(name = "pluginOperatingSystem", required = false)
040        private String pluginOperatingSystem;
041        
042        @Element(name = "pluginArchitecture", required = false)
043        private String pluginArchitecture;      
044
045        @Element(name = "pluginDate", required = false)
046        private String pluginDate;
047
048        @Element(name = "pluginAppMinVersion", required = false)
049        private String pluginAppMinVersion;
050
051        @Element(name = "pluginRelease", required = false)
052        private boolean pluginRelease;
053
054        @Element(name = "pluginConflictsWith", required = false)
055        private String conflictingPluginIds; // comma-separated
056
057        @Element(name = "pluginThirdParty", required = false)
058        private boolean pluginThirdParty; 
059
060        @Element(name = "sha256sum", required = false)
061        private String sha256sum;
062
063        @Element(name = "downloadUrl", required = false)
064        private String downloadUrl;
065
066        public PluginInfo() {
067                // Nothing.
068        }
069
070        public String getPluginId() {
071                return pluginId;
072        }
073
074        public void setPluginId(String pluginId) {
075                this.pluginId = pluginId;
076        }
077
078        public String getPluginName() {
079                return pluginName;
080        }
081
082        public void setPluginName(String pluginName) {
083                this.pluginName = pluginName;
084        }
085
086        public String getPluginVersion() {
087                return pluginVersion;
088        }
089
090        public void setPluginVersion(String pluginVersion) {
091                this.pluginVersion = pluginVersion;
092        }
093
094        public String getPluginOperatingSystem() {
095                return pluginOperatingSystem;
096        }
097
098        public void setPluginOperatingSystem(String pluginOperatingSystem) {
099                this.pluginOperatingSystem = pluginOperatingSystem;
100        }
101
102        public String getPluginArchitecture() {
103                return pluginArchitecture;
104        }
105
106        public void setPluginArchitecture(String pluginArchitecture) {
107                this.pluginArchitecture = pluginArchitecture;
108        }
109
110        public String getPluginDate() {
111                return pluginDate;
112        }
113
114        public void setPluginDate(String pluginDate) {
115                this.pluginDate = pluginDate;
116        }
117
118        public String getPluginAppMinVersion() {
119                return pluginAppMinVersion;
120        }
121
122        public void setPluginAppMinVersion(String pluginAppMinVersion) {
123                this.pluginAppMinVersion = pluginAppMinVersion;
124        }
125
126        public boolean isPluginRelease() {
127                return pluginRelease;
128        }
129
130        public void setPluginRelease(boolean pluginRelease) {
131                this.pluginRelease = pluginRelease;
132        }
133
134        public String getSha256sum() {
135                return sha256sum;
136        }
137
138        public void setSha256sum(String sha256sum) {
139                this.sha256sum = sha256sum;
140        }
141
142        public String getDownloadUrl() {
143                return downloadUrl;
144        }
145
146        public void setDownloadUrl(String downloadUrl) {
147                this.downloadUrl = downloadUrl;
148        }
149
150        public boolean isPluginThirdParty() {
151                return pluginThirdParty;
152        }
153
154        public void setPluginThirdParty(boolean pluginThirdParty) {
155                this.pluginThirdParty = pluginThirdParty;
156        }
157
158        public List<String> getConflictingPluginIds() {
159                if (conflictingPluginIds != null) {
160                        return Arrays.asList(conflictingPluginIds.split(","));
161                }
162                else {
163                        return new ArrayList<String>();
164                }
165        }
166
167        public void setConflictingPluginIds(List<String> conflictingPluginIds) {
168                this.conflictingPluginIds = (conflictingPluginIds != null) ? StringUtil.join(conflictingPluginIds, ",") : null;
169        }
170}