View Javadoc
1   /*
2    * Created by IntelliJ IDEA.
3    * User: Mike
4    * Date: Jul 31, 2004
5    * Time: 12:58:29 PM
6    */
7   package com.atlassian.plugin;
8   
9   import com.atlassian.plugin.util.JavaVersionUtils;
10  import com.google.common.collect.ImmutableSet;
11  import io.atlassian.util.concurrent.CopyOnWriteMap;
12  
13  import java.util.Collections;
14  import java.util.Map;
15  import java.util.Optional;
16  import java.util.Set;
17  
18  public class PluginInformation {
19      private String description = "";
20      private String descriptionKey;
21      private String version = "0.0";
22      private String vendorName = "(unknown)";
23      private String vendorUrl;
24      private Optional<String> scopeKey;
25      private Float minJavaVersion;
26      private Set<PluginPermission> permissions = ImmutableSet.of(); // by default no permissions
27      private final Map<String, String> parameters = CopyOnWriteMap.<String, String>builder().stableViews().newHashMap();
28      private String startup;
29      private Set<String> moduleScanFolders;
30  
31      public String getDescription() {
32          return description;
33      }
34  
35      public void setDescription(final String description) {
36          this.description = description;
37      }
38  
39      public String getVersion() {
40          return version;
41      }
42  
43      public void setVersion(final String version) {
44          this.version = version;
45      }
46  
47      public void setVendorName(final String vendorName) {
48          this.vendorName = vendorName;
49      }
50  
51      public void setVendorUrl(final String vendorUrl) {
52          this.vendorUrl = vendorUrl;
53      }
54  
55      public String getVendorName() {
56          return vendorName;
57      }
58  
59      public String getVendorUrl() {
60          return vendorUrl;
61      }
62  
63      public void setScopeKey(Optional<String> scopeKey) {
64          this.scopeKey = scopeKey;
65      }
66  
67      public Optional<String> getScopeKey() {
68          return scopeKey;
69      }
70  
71      public Float getMinJavaVersion() {
72          return minJavaVersion;
73      }
74  
75      public void setMinJavaVersion(final Float minJavaVersion) {
76          this.minJavaVersion = minJavaVersion;
77      }
78  
79      public Map<String, String> getParameters() {
80          return Collections.unmodifiableMap(parameters);
81      }
82  
83      /**
84       * The set of permissions that the plugin requires to run.
85       *
86       * @return the permissions as parsed from the plugin descriptor.
87       */
88      public Set<PluginPermission> getPermissions() {
89          return permissions;
90      }
91  
92      public void setPermissions(final Set<PluginPermission> permissions) {
93          this.permissions = ImmutableSet.copyOf(permissions);
94      }
95  
96      public void addParameter(final String key, final String value) {
97          parameters.put(key, value);
98      }
99  
100     public boolean satisfiesMinJavaVersion() {
101         return (minJavaVersion == null) || JavaVersionUtils.satisfiesMinVersion(minJavaVersion);
102     }
103 
104     public void setDescriptionKey(final String descriptionKey) {
105         this.descriptionKey = descriptionKey;
106     }
107 
108     public String getDescriptionKey() {
109         return descriptionKey;
110     }
111 
112     public String getStartup() {
113         return startup;
114     }
115 
116     public void setStartup(final String startup) {
117         this.startup = startup;
118     }
119 
120     public Set<String> getModuleScanFolders() {
121         return moduleScanFolders;
122     }
123 
124     public void setModuleScanFolders(Iterable<String> moduleScanFolders) {
125         this.moduleScanFolders = ImmutableSet.copyOf(moduleScanFolders);
126     }
127 }