View Javadoc

1   package com.atlassian.plugin.osgi.factory.descriptor;
2   
3   import com.atlassian.plugin.Plugin;
4   import com.atlassian.plugin.PluginParseException;
5   import com.atlassian.plugin.descriptors.AbstractModuleDescriptor;
6   import com.atlassian.plugin.descriptors.CannotDisable;
7   import com.atlassian.plugin.module.ModuleFactory;
8   import com.atlassian.plugin.osgi.module.BeanPrefixModuleFactory;
9   
10  /**
11   * Module descriptor for Spring components.  Shouldn't be directly used outside providing read-only information.
12   *
13   * @since 2.2.0
14   */
15  @CannotDisable
16  public class ComponentModuleDescriptor<Object> extends AbstractModuleDescriptor
17  {
18      public ComponentModuleDescriptor()
19      {
20          super(ModuleFactory.LEGACY_MODULE_FACTORY);
21      }
22  
23      @Override
24      protected void loadClass(Plugin plugin, String clazz) throws PluginParseException
25      {
26          try
27          {
28              // this should have been done once by Spring so should never throw exception.
29              this.moduleClass = plugin.loadClass(clazz, null);
30          }
31          catch (ClassNotFoundException e)
32          {
33              throw new PluginParseException("cannot load component class", e);
34          }
35      }
36  
37      @Override
38      public Object getModule()
39      {
40          return (Object) new BeanPrefixModuleFactory().createModule(getKey(), this);
41      }
42  
43      /**
44       * @deprecated - BEWARE that this is a temporary method that will not exist for long. Deprecated since 2.3.0
45       *
46       * @return Module Class Name
47       * @since 2.3.0
48       */
49      public String getModuleClassName()
50      {
51          return moduleClassName;
52      }
53  }