Class OMAbstractFactory
- java.lang.Object
-
- org.apache.axiom.om.OMAbstractFactory
-
public class OMAbstractFactory extends Object
Provides instances for object model and meta factories.The
getMetaFactory()
method returns theOMMetaFactory
instance for the default Axiom implementation. ThegetMetaFactory(String)
method locates aOMMetaFactory
instance for an Axiom implementation with a given feature. The following features are predefined by the Axiom API:FEATURE_DEFAULT
- Identifies the default Axiom implementation. An implementation with that feature is expected to provide a full implementation of the Axiom API.
FEATURE_DOM
- Used by Axiom implementations that implement DOM in addition to the Axiom API.
Axiom discovers implementations by looking for
META-INF/axiom.xml
resources. They specify theOMMetaFactory
implementation as well as the set of features that each implementation supports. If multiple implementations with the same feature are found, then Axiom will select the one with the highest priority. The priority for a given feature is also declared inMETA-INF/axiom.xml
. This algorithm is used both in non OSGi and OSGi environments.In a non OSGi environment, the default Axiom implementation can be overridden using the system property specified by
META_FACTORY_NAME_PROPERTY
.The
getOMFactory()
,getSOAP11Factory()
andgetSOAP12Factory()
methods return default instances for plain XML, SOAP 1.1 and SOAP 1.2 object model factories. They are convenience methods callinggetMetaFactory()
and then delegating to the returnedOMMetaFactory
.Note that while
getMetaFactory()
always returns the same instance, the other methods may return new instances on every invocation, depending on theOMMetaFactory
implementation.
-
-
Field Summary
Fields Modifier and Type Field Description static String
FEATURE_DEFAULT
Feature for Axiom implementations that can be used as default implementations.static String
FEATURE_DOM
Feature for Axiom implementations that implement DOM in addition to the Axiom API.static String
META_FACTORY_NAME_PROPERTY
The name of the system property that allows to override the default Axiom implementation.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OMMetaFactory
getMetaFactory()
Get the meta factory instance for the default Axiom implementation.static OMMetaFactory
getMetaFactory(String feature)
Get the meta factory instance for the Axiom implementation with a given feature.static OMFactory
getOMFactory()
Get the default OM factory instance.static SOAPFactory
getSOAP11Factory()
Get the default SOAP 1.1 OM factory instance.static SOAPFactory
getSOAP12Factory()
Get the default SOAP 1.2 OM factory instance.static void
setMetaFactoryLocator(OMMetaFactoryLocator locator)
Explicitly set a meta factory locator.
-
-
-
Field Detail
-
META_FACTORY_NAME_PROPERTY
public static final String META_FACTORY_NAME_PROPERTY
The name of the system property that allows to override the default Axiom implementation. The value must be the fully qualified name of a class implementingOMMetaFactory
and that is visible to the class loader from which theaxiom-api
library is loaded. An instance of this class will be returned bygetMetaFactory()
.Note that this system property is not supported in an OSGi environment.
- See Also:
- Constant Field Values
-
FEATURE_DEFAULT
public static final String FEATURE_DEFAULT
Feature for Axiom implementations that can be used as default implementations.- See Also:
- Constant Field Values
-
FEATURE_DOM
public static final String FEATURE_DOM
Feature for Axiom implementations that implement DOM in addition to the Axiom API. TheOMMetaFactory
for such an Axiom implementation must implementDOMMetaFactory
. See the documentation ofDOMMetaFactory
for more information about the requirements and constraints that apply to Axiom implementations that support this feature.- See Also:
- Constant Field Values
-
-
Method Detail
-
setMetaFactoryLocator
public static void setMetaFactoryLocator(OMMetaFactoryLocator locator)
Explicitly set a meta factory locator. The new locator will be used by all subsequent calls togetMetaFactory()
andgetMetaFactory(String)
to locate the appropriate meta factory. Note that the meta factory locator is an application wide setting. More precisely, the configured locator will be used by all classes loaded from the class loader where Axiom is deployed and all its child class loaders. Therefore this method should be used with care and only be invoked during the initialization of the application.When Axiom is deployed as a bundle in an OSGi environment, this method will be used to inject the meta factory instances from the deployed implementation bundles.
- Parameters:
locator
- the new meta factory locator, ornull
to revert to the default meta factory locator
-
getMetaFactory
public static OMMetaFactory getMetaFactory()
Get the meta factory instance for the default Axiom implementation. This method is equivalent togetMetaFactory(String)
withFEATURE_DEFAULT
as parameter.- Returns:
- the meta factory instance for the default Axiom implementation
- Throws:
OMException
- if no Axiom implementation withFEATURE_DEFAULT
could be located
-
getMetaFactory
public static OMMetaFactory getMetaFactory(String feature)
Get the meta factory instance for the Axiom implementation with a given feature. If multiple Axiom implementations declare the same feature, then the method will return the meta factory for the implementation that declares the highest priority for that feature in itsMETA-INF/axiom.xml
descriptor.- Parameters:
feature
- the requested feature- Returns:
- the meta factory instance for the Axiom implementation with the given feature.
- Throws:
OMException
- if no Axiom implementation with the requested feature could be located
-
getOMFactory
public static OMFactory getOMFactory()
Get the default OM factory instance. This method has the same effect as callingOMMetaFactory.getOMFactory()
on theOMMetaFactory
instance returned bygetMetaFactory()
.- Returns:
- the default OM factory instance
- Throws:
OMException
- if the factory's implementation class can't be found or if the class can't be instantiated
-
getSOAP11Factory
public static SOAPFactory getSOAP11Factory()
Get the default SOAP 1.1 OM factory instance. This method has the same effect as callingOMMetaFactory.getSOAP11Factory()
on theOMMetaFactory
instance returned bygetMetaFactory()
.- Returns:
- the default SOAP 1.1 OM factory instance
- Throws:
OMException
- if the factory's implementation class can't be found or if the class can't be instantiated
-
getSOAP12Factory
public static SOAPFactory getSOAP12Factory()
Get the default SOAP 1.2 OM factory instance. This method has the same effect as callingOMMetaFactory.getSOAP12Factory()
on theOMMetaFactory
instance returned bygetMetaFactory()
.- Returns:
- the default SOAP 1.2 OM factory instance
- Throws:
OMException
- if the factory's implementation class can't be found or if the class can't be instantiated
-
-