org.apache.abdera.factory
Interface ExtensionFactory

All Known Implementing Classes:
OpenSearchExtensionFactory, ThreadExtensionFactory

public interface ExtensionFactory

Extension Factories are used to provide a means of dynamically resolving builders for namespaced extension elements

There are four ways of supporting extension elements.

  1. Implement your own Factory (hard)
  2. Subclass the default Axiom-based Factory (also somewhat difficult)
  3. Implement and register an ExtensionFactory (wonderfully simple)
  4. Use the Feed Object Model's dynamic support for extensions (also very simple)

Registering an Extension Factory requires generally nothing more than implementing ExtensionFactory and then creating the file META-INF/services/org.apache.abdera.factory.ExtensionFactory and listing the class names of each ExtensionFactory you wish to register.

Note that at this time, ExtensionFactories are specific to the parser implementation used. That is, if you're using the default StAX-based FOMParser and FOMFactory implementation, your ExtensionFactories will need to also implement FOMExtensionFactory.


Method Summary
 java.util.List<java.lang.String> getNamespaces()
          Returns the Namespace URIs handled by this Extension Factory.
 boolean handlesNamespace(java.lang.String namespace)
          Returns true if this extension factory handles the specified namespace
<T extends Element>
T
newExtensionElement(javax.xml.namespace.QName qname, Base parent, Factory factory)
          Called by the Factory implementaton to create an instance of the extension element.
 

Method Detail

handlesNamespace

boolean handlesNamespace(java.lang.String namespace)
Returns true if this extension factory handles the specified namespace


getNamespaces

java.util.List<java.lang.String> getNamespaces()
Returns the Namespace URIs handled by this Extension Factory.

Returns:
A List of Namespace URIs Supported by this Extension

newExtensionElement

<T extends Element> T newExtensionElement(javax.xml.namespace.QName qname,
                                          Base parent,
                                          Factory factory)
Called by the Factory implementaton to create an instance of the extension element. If parent is not null, the new element will be automatically added as a child of the parent.

Parameters:
qname - the QName of the extension element
parent - the Parent of the extension element
factory - the Factory
Returns:
ExtensionElement The created ExtensionElement