org.apache.axiom.om
Class OMAbstractFactory

java.lang.Object
  extended by org.apache.axiom.om.OMAbstractFactory

public class OMAbstractFactory
extends Object

Provides default instances for object model and meta factories.

The getMetaFactory() method returns the default OMMetaFactory instance. See the Javadoc of the getMetaFactory() method for details about how this instance is determined.

The getOMFactory(), getSOAP11Factory() and getSOAP12Factory() methods return default instances for plain XML, SOAP 1.1 and SOAP 1.2 object model factories. They are convenience methods calling getMetaFactory() and then delegating to the returned OMMetaFactory.

Note that while getMetaFactory() always returns the same instance, the other methods may return new instances on every invocation, depending on the OMMetaFactory implementation.


Field Summary
static String META_FACTORY_NAME_PROPERTY
           
 
Method Summary
static OMMetaFactory getMetaFactory()
          Get the default meta factory instance.
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 setMetaFactory(OMMetaFactory newMetaFactory)
          Explicitly set a meta factory instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_FACTORY_NAME_PROPERTY

public static final String META_FACTORY_NAME_PROPERTY
See Also:
Constant Field Values
Method Detail

setMetaFactory

public static void setMetaFactory(OMMetaFactory newMetaFactory)
Explicitly set a meta factory instance. The new instance will be returned by all subsequent calls to getMetaFactory(). Note that this is an application wide setting. More precisely, the configured meta factory 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 instance from the implementation bundle.

Parameters:
newMetaFactory - the new meta factory instance, or null to revert to the default meta factory instance determined by the org.apache.axiom.om.OMMetaFactory system property

getMetaFactory

public static OMMetaFactory getMetaFactory()
Get the default meta factory instance. This method uses the following ordered lookup procedure to determine the default instance:
  1. If an instance has been set using setMetaFactory(OMMetaFactory), then that instance is returned. Note that this will be the case in an OSGi runtime, where setMetaFactory(OMMetaFactory) is invoked by a helper component that is part of Axiom.
  2. Use the org.apache.axiom.om.OMMetaFactory system property. This method uses System.getProperty(String) to determine the value of the system property. A SecurityException thrown by this method is simply ignored and the lookup procedure continues.
  3. Use the JDK 1.3 service discovery mechanism to determine the classname of the meta factory. The method will look for a classname in the file META-INF/services/org.apache.axiom.om.OMMetaFactory in jars in the class path.
  4. Return the meta factory for the LLOM implementation is returned.

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

getOMFactory

public static OMFactory getOMFactory()
Get the default OM factory instance.

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.

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.

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


Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.