View Javadoc
1   package com.atlassian.plugin.impl;
2   
3   import com.atlassian.plugin.PluginException;
4   import com.atlassian.plugin.util.ClassLoaderUtils;
5   
6   import java.io.InputStream;
7   import java.net.URL;
8   
9   public class StaticPlugin extends AbstractPlugin {
10      public StaticPlugin() {
11          super(null);
12      }
13  
14      /**
15       * Static plugins loaded from the classpath can't be uninstalled.
16       */
17      public boolean isUninstallable() {
18          return false;
19      }
20  
21      public <T> Class<T> loadClass(final String clazz, final Class<?> callingClass) throws ClassNotFoundException {
22          return ClassLoaderUtils.loadClass(clazz, callingClass);
23      }
24  
25      public ClassLoader getClassLoader() {
26          return getClass().getClassLoader();
27      }
28  
29      public URL getResource(final String name) {
30          return ClassLoaderUtils.getResource(name, getClass());
31      }
32  
33      public InputStream getResourceAsStream(final String name) {
34          return ClassLoaderUtils.getResourceAsStream(name, getClass());
35      }
36  
37      public boolean isDynamicallyLoaded() {
38          return false;
39      }
40  
41      public boolean isDeleteable() {
42          return false;
43      }
44  
45      @Override
46      protected void uninstallInternal() {
47          throw new PluginException("Static plugins cannot be uninstalled");
48      }
49  }