com.atlassian.plugin.parsers
Class XmlDescriptorParser

java.lang.Object
  extended by com.atlassian.plugin.parsers.XmlDescriptorParser
All Implemented Interfaces:
DescriptorParser

public class XmlDescriptorParser
extends java.lang.Object
implements DescriptorParser

Provides access to the descriptor information retrieved from an XML InputStream.

Uses the dom4j SAXReader to parse the XML stream into a document when the parser is constructed.

See Also:
XmlDescriptorParserFactory

Constructor Summary
XmlDescriptorParser(java.io.InputStream source)
           
 
Method Summary
 Plugin configurePlugin(ModuleDescriptorFactory moduleDescriptorFactory, Plugin plugin)
          Sets the configuration on the plugin argument to match the configuration specified in the plugin descriptor (typically an XML file).
protected  org.dom4j.Document createDocument(java.io.InputStream source)
           
protected  ModuleDescriptor createModuleDescriptor(Plugin plugin, org.dom4j.Element element, ModuleDescriptorFactory moduleDescriptorFactory)
           
protected  PluginInformation createPluginInformation(org.dom4j.Element element)
           
protected  org.dom4j.Document getDocument()
           
 java.lang.String getKey()
           
 int getPluginsVersion()
           
 boolean isSystemPlugin()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlDescriptorParser

public XmlDescriptorParser(java.io.InputStream source)
                    throws PluginParseException
Throws:
PluginParseException - if there is a problem reading the descriptor from the XML InputStream.
Method Detail

createDocument

protected org.dom4j.Document createDocument(java.io.InputStream source)
                                     throws PluginParseException
Throws:
PluginParseException

getDocument

protected org.dom4j.Document getDocument()

configurePlugin

public Plugin configurePlugin(ModuleDescriptorFactory moduleDescriptorFactory,
                              Plugin plugin)
                       throws PluginParseException
Description copied from interface: DescriptorParser
Sets the configuration on the plugin argument to match the configuration specified in the plugin descriptor (typically an XML file).

Specified by:
configurePlugin in interface DescriptorParser
Parameters:
moduleDescriptorFactory - a factory for instantiating the required plugin modules
plugin - the plugin whose configuration will be modified
Returns:
the original plugin with the configuration changed and the module descriptors added
Throws:
PluginParseException - if there was an error getting information about the plugin

createModuleDescriptor

protected ModuleDescriptor createModuleDescriptor(Plugin plugin,
                                                  org.dom4j.Element element,
                                                  ModuleDescriptorFactory moduleDescriptorFactory)
                                           throws PluginParseException
Throws:
PluginParseException

createPluginInformation

protected PluginInformation createPluginInformation(org.dom4j.Element element)

getKey

public java.lang.String getKey()
Specified by:
getKey in interface DescriptorParser
Returns:
the key of the plugin specified in the descriptor

getPluginsVersion

public int getPluginsVersion()
Specified by:
getPluginsVersion in interface DescriptorParser
Returns:
The version of the plugin system expected by this plugin. If unknown, it is assumed to be 1.

isSystemPlugin

public boolean isSystemPlugin()
Specified by:
isSystemPlugin in interface DescriptorParser
Returns:
true if this plugin is marked as a system plugin in the descriptor. This should only be acted on by plugin loaders which can trust their plugins implicitly (e.g. a classpath plugin loader).


Copyright © 2008 Atlassian Pty Ltd. All Rights Reserved.