View Javadoc

1   package com.atlassian.plugin.impl;
2   
3   /**
4    * This class represents a Plugin that was not able to be loaded by the PluginManager.
5    *
6    * @see com.atlassian.plugin.manager.DefaultPluginManager
7    */
8   public class UnloadablePlugin extends StaticPlugin
9   {
10      private static final String UNKNOWN_KEY_PREFIX = "Unknown-";
11      private String errorText;
12      private boolean uninstallable = true;
13      private boolean deletable = true;
14  
15      public UnloadablePlugin()
16      {
17          this(null);
18      }
19  
20      /**
21       * @param text The error text
22       * @since 2.0.0
23       */
24      public UnloadablePlugin(final String text)
25      {
26          errorText = text;
27          setKey(UNKNOWN_KEY_PREFIX + System.identityHashCode(this));
28      }
29  
30      @Override
31      public boolean isUninstallable()
32      {
33          return uninstallable;
34      }
35  
36      public void setDeletable(final boolean deletable)
37      {
38          this.deletable = deletable;
39      }
40  
41      @Override
42      public boolean isDeleteable()
43      {
44          return deletable;
45      }
46  
47      public void setUninstallable(final boolean uninstallable)
48      {
49          this.uninstallable = uninstallable;
50      }
51  
52      @Override
53      public boolean isEnabledByDefault()
54      {
55          return false;
56      }
57  
58      public String getErrorText()
59      {
60          return errorText;
61      }
62  
63      public void setErrorText(final String errorText)
64      {
65          this.errorText = errorText;
66      }
67  
68      @Override
69      public void close()
70      {
71  
72      }
73  
74      @Override
75      public String toString()
76      {
77          return super.toString() + " " + errorText;
78      }
79  }