1 package com.atlassian.plugin.parsers;
2
3 import com.atlassian.plugin.Plugin;
4 import com.atlassian.plugin.ModuleDescriptorFactory;
5 import com.atlassian.plugin.PluginParseException;
6 import com.atlassian.plugin.PluginInformation;
7
8 /**
9 * Interface for parsing a plugin descriptor file, e.g. atlassian-plugin.xml.
10 *
11 * @see XmlDescriptorParser
12 * @see DescriptorParserFactory
13 */
14 public interface DescriptorParser
15 {
16 /**
17 * Sets the configuration on the plugin argument to match the configuration specified in the
18 * plugin descriptor (typically an XML file).
19 *
20 * @param moduleDescriptorFactory a factory for instantiating the required plugin modules
21 * @param plugin the plugin whose configuration will be modified
22 * @return the original plugin with the configuration changed and the module descriptors added
23 * @throws PluginParseException if there was an error getting information about the plugin
24 */
25 Plugin configurePlugin(ModuleDescriptorFactory moduleDescriptorFactory, Plugin plugin) throws PluginParseException;
26
27 /**
28 * @return the key of the plugin specified in the descriptor
29 */
30 String getKey();
31
32 /**
33 * @return true if this plugin is marked as a system plugin in the descriptor. This should only be
34 * acted on by plugin loaders which can trust their plugins implicitly (e.g. a classpath plugin
35 * loader).
36 *
37 * @deprecated The parser will set the SystemPlugin flag within the configurePlugin() method, so there is no need to use this externally.
38 * See PLUG-415. Deprecated since 2.3.0
39 */
40 boolean isSystemPlugin();
41
42 /**
43 * @return The version of the plugin system expected by this plugin. If unknown, it is assumed to be 1.
44 */
45 int getPluginsVersion();
46
47 PluginInformation getPluginInformation();
48 }