Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PersistenceSpeedUp/HeuristicLab.Services.Deployment/3.3/PluginDescription.cs @ 12093

Last change on this file since 12093 was 3217, checked in by gkronber, 15 years ago

Defined PluginDescription data contract as IsReference and changed caching scheme of plugin descriptions in the plugin store to use the plugin id as key. #951 (Refreshing the list of plugins and products of the deployment service is very slow)

File size: 3.7 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26using System.Runtime.Serialization;
27
28namespace HeuristicLab.Services.Deployment {
29  [DataContract(Name = "PluginDescription", IsReference = true)]
30  public class PluginDescription {
31
32    [DataMember(Name = "Name")]
33    private string name;
34    public string Name {
35      get { return name; }
36      set {
37        if (string.IsNullOrEmpty(value)) throw new ArgumentException();
38        name = value;
39      }
40    }
41
42    [DataMember(Name = "Version")]
43    private Version version;
44    public Version Version {
45      get { return version; }
46      set {
47        if (value == null) throw new ArgumentNullException();
48        version = value;
49      }
50    }
51
52    [DataMember(Name = "ContactName")]
53    private string contactName;
54    public string ContactName {
55      get { return contactName; }
56      set {
57        if (value == null) throw new ArgumentNullException();
58        contactName = value;
59      }
60    }
61
62    [DataMember(Name = "ContactEmail")]
63    private string contactEmail;
64    public string ContactEmail {
65      get { return contactEmail; }
66      set {
67        if (value == null) throw new ArgumentNullException();
68        contactEmail = value;
69      }
70    }
71
72    [DataMember(Name = "LicenseText")]
73    private string licenseText;
74    public string LicenseText {
75      get { return licenseText; }
76      set {
77        if (value == null) throw new ArgumentNullException();
78        licenseText = value;
79      }
80    }
81
82    [DataMember(Name = "Dependencies")]
83    private List<PluginDescription> dependencies;
84    public List<PluginDescription> Dependencies {
85      get { return dependencies; }
86      set {
87        if (value == null) throw new ArgumentNullException();
88        dependencies = value;
89      }
90    }
91
92    public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies,
93      string contactName, string contactEmail, string license) {
94      if (string.IsNullOrEmpty(name)) throw new ArgumentException("name is empty");
95      if (version == null || dependencies == null ||
96        contactName == null || contactEmail == null ||
97        license == null) throw new ArgumentNullException();
98      this.name = name;
99      this.version = version;
100      this.dependencies = new List<PluginDescription>(dependencies);
101      this.licenseText = license;
102      this.contactName = contactName;
103      this.contactEmail = contactEmail;
104    }
105
106    public PluginDescription(string name, Version version)
107      : this(name, version, Enumerable.Empty<PluginDescription>()) {
108    }
109
110    public PluginDescription(string name, Version version, IEnumerable<PluginDescription> dependencies)
111      : this(name, version, dependencies, string.Empty, string.Empty, string.Empty) {
112    }
113  }
114}
Note: See TracBrowser for help on using the repository browser.