View Javadoc

1   package com.atlassian.plugin.osgi.factory;
2   
3   import com.atlassian.plugin.parsers.DescriptorParser;
4   import com.atlassian.plugin.parsers.DescriptorParserFactory;
5   import com.atlassian.plugin.PluginParseException;
6   
7   import java.io.InputStream;
8   
9   import org.apache.commons.lang.Validate;
10  
11  /**
12   * Descriptor parser factory that creates parsers that ignore all component-related modules
13   */
14  public class ComponentFilteringXmlDescriptorParserFactory implements DescriptorParserFactory
15  {
16      /**
17       * Gets an instance that filters the modules "component", "bean", and "spring"
18       * @param source The descriptor source
19       * @return The parser
20       * @throws PluginParseException
21       */
22      public DescriptorParser getInstance(InputStream source) throws PluginParseException
23      {
24          Validate.notNull(source, "The descriptor source must not be null");
25          return new FilteringXmlDescriptorParser(source, "component", "component-import", "bean", "spring", "module-type");
26      }
27  }