de.ispsoft.jaxme
Class JMFactory

java.lang.Object
  extended byde.ispsoft.jaxme.JMFactory

public class JMFactory
extends java.lang.Object

Defines a factory API that enables applications to configure and obtain a JMManagerFactory to work with XML documents.

Implementations of JMFactory, JMManagerFactory and JMManagerFactory MUST be thread safe, once they are initialized.


Field Summary
static java.lang.String CLASS_PROPERTY
          Name of the property to use for loading a JMManagerFactory implementation.
static java.lang.String URI_PROPERTY
          Name of the property to use for loading the URI.
 
Constructor Summary
JMFactory()
           
 
Method Summary
static JMManagerFactory getJMManagerFactory()
          Returns a JMManagerFactory implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_PROPERTY

public static final java.lang.String CLASS_PROPERTY

Name of the property to use for loading a JMManagerFactory implementation.


URI_PROPERTY

public static final java.lang.String URI_PROPERTY

Name of the property to use for loading the URI.

Constructor Detail

JMFactory

public JMFactory()
Method Detail

getJMManagerFactory

public static JMManagerFactory getJMManagerFactory()
                                            throws org.xml.sax.SAXException

Returns a JMManagerFactory implementation. The returned instance depends on a class name and an URI. Class name and URI are determined as follows:

  1. If the property de.ispsoft.jaxme.JMManagerFactory is set, then the value is taken as a class name and the URI is read from the system property de.ispsoft.jaxme.JMManagerFactory.uri.
  2. If the system property didn't exist, but a file ${java.home}/lib/jaxme.properties exists, then it is loaded and interpreted as a property file. If the property de.ispsoft.jaxme.JMManagerFactory is set in that file, then the value is taken as a class name and the URI is read from the property de.ispsoft.jaxme.JMManagerFactory.uri in the same file.
  3. If neither the system property exists nor the configuration file in ${java.home} was found, then the ressource META-INF/services/de.ispsoft.jaxme.JMManagerFactory is located through the class path. If it is found, then its first line is taken as a class name and the given class is instantiated. The second line is taken as the URI.
  4. If none of the above methods worked, then an instance of de.ispsoft.jaxme.JMManagerFactoryImpl is returned and the URI defaults to resource:de/ispsoft/jaxme/JMManagerFactoryImpl.xml.
Once class name and URI are determined, then the class is instantiated and the method setURI() is called on that instance. Finally the instance is returned.

Returns:
An implementation of JMManagerFactory, never null.
Throws:
org.xml.sax.SAXException