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