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  {
11      /**
12       * Static plugins loaded from the classpath can't be uninstalled.
13       */
14      public boolean isUninstallable()
15      {
16          return false;
17      }
18  
19      public <T> Class<T> loadClass(final String clazz, final Class<?> callingClass) throws ClassNotFoundException
20      {
21          return ClassLoaderUtils.loadClass(clazz, callingClass);
22      }
23  
24      public ClassLoader getClassLoader()
25      {
26          return getClass().getClassLoader();
27      }
28  
29      public URL getResource(final String name)
30      {
31          return ClassLoaderUtils.getResource(name, getClass());
32      }
33  
34      public InputStream getResourceAsStream(final String name)
35      {
36          return ClassLoaderUtils.getResourceAsStream(name, getClass());
37      }
38  
39      public boolean isDynamicallyLoaded()
40      {
41          return false;
42      }
43  
44      public boolean isDeleteable()
45      {
46          return false;
47      }
48  
49      @Override
50      protected void uninstallInternal()
51      {
52          throw new PluginException("Static plugins cannot be uninstalled");
53      }
54  }