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.atlassian.util.concurrent.CopyOnWriteMap;
11  import com.google.common.collect.ImmutableSet;
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 maxVersion;
26      private float minVersion;
27      private Float minJavaVersion;
28      private Set<PluginPermission> permissions = ImmutableSet.of(); // by default no permissions
29      private final Map<String, String> parameters = CopyOnWriteMap.<String, String>builder().stableViews().newHashMap();
30      private String startup;
31      private Set<String> moduleScanFolders;
32  
33      public String getDescription() {
34          return description;
35      }
36  
37      public void setDescription(final String description) {
38          this.description = description;
39      }
40  
41      public String getVersion() {
42          return version;
43      }
44  
45      public void setVersion(final String version) {
46          this.version = version;
47      }
48  
49      public void setVendorName(final String vendorName) {
50          this.vendorName = vendorName;
51      }
52  
53      public void setVendorUrl(final String vendorUrl) {
54          this.vendorUrl = vendorUrl;
55      }
56  
57      public String getVendorName() {
58          return vendorName;
59      }
60  
61      public String getVendorUrl() {
62          return vendorUrl;
63      }
64  
65      public void setScopeKey(Optional<String> scopeKey) {
66          this.scopeKey = scopeKey;
67      }
68  
69      public Optional<String> getScopeKey() {
70          return scopeKey;
71      }
72  
73      /**
74       * @deprecated Since 2.2.0
75       */
76      @Deprecated
77      public void setMaxVersion(final float maxVersion) {
78          this.maxVersion = maxVersion;
79      }
80  
81      /**
82       * @deprecated Since 2.2.0
83       */
84      @Deprecated
85      public void setMinVersion(final float minVersion) {
86          this.minVersion = minVersion;
87      }
88  
89      /**
90       * @deprecated Since 2.2.0
91       */
92      @Deprecated
93      public float getMaxVersion() {
94          return maxVersion;
95      }
96  
97      /**
98       * @deprecated Since 2.2.0
99       */
100     @Deprecated
101     public float getMinVersion() {
102         return minVersion;
103     }
104 
105     public Float getMinJavaVersion() {
106         return minJavaVersion;
107     }
108 
109     public void setMinJavaVersion(final Float minJavaVersion) {
110         this.minJavaVersion = minJavaVersion;
111     }
112 
113     public Map<String, String> getParameters() {
114         return Collections.unmodifiableMap(parameters);
115     }
116 
117     /**
118      * The set of permissions that the plugin requires to run.
119      *
120      * @return the permissions as parsed from the plugin descriptor.
121      */
122     public Set<PluginPermission> getPermissions() {
123         return permissions;
124     }
125 
126     public void setPermissions(final Set<PluginPermission> permissions) {
127         this.permissions = ImmutableSet.copyOf(permissions);
128     }
129 
130     public void addParameter(final String key, final String value) {
131         parameters.put(key, value);
132     }
133 
134     public boolean satisfiesMinJavaVersion() {
135         return (minJavaVersion == null) || JavaVersionUtils.satisfiesMinVersion(minJavaVersion);
136     }
137 
138     public void setDescriptionKey(final String descriptionKey) {
139         this.descriptionKey = descriptionKey;
140     }
141 
142     public String getDescriptionKey() {
143         return descriptionKey;
144     }
145 
146     public String getStartup() {
147         return startup;
148     }
149 
150     public void setStartup(final String startup) {
151         this.startup = startup;
152     }
153 
154     public Set<String> getModuleScanFolders() {
155         return moduleScanFolders;
156     }
157 
158     public void setModuleScanFolders(Iterable<String> moduleScanFolders) {
159         this.moduleScanFolders = ImmutableSet.copyOf(moduleScanFolders);
160     }
161 }