src/javax/xml/datatype/DatatypeFactory.java

Print this page

        

*** 23,43 **** * questions. */ package javax.xml.datatype; - import java.math.BigInteger; import java.math.BigDecimal; import java.util.GregorianCalendar; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * <p>Factory that creates new <code>javax.xml.datatype</code> <code>Object</code>s that map XML to/from Java <code>Object</code>s.</p> * ! * <p><a name="DatatypeFactory.newInstance"/>{@link #newInstance()} is used to create a new <code>DatatypeFactory</code>. ! * The following implementation resolution mechanisms are used in the following order:</p> * <ol> * <li> * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "<code>javax.xml.datatype.DatatypeFactory</code>", * exists, a class with the name of the property's value is instantiated. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. --- 23,43 ---- * questions. */ package javax.xml.datatype; import java.math.BigDecimal; + import java.math.BigInteger; import java.util.GregorianCalendar; import java.util.regex.Matcher; import java.util.regex.Pattern; /** * <p>Factory that creates new <code>javax.xml.datatype</code> <code>Object</code>s that map XML to/from Java <code>Object</code>s.</p> * ! * <p>A new instance of the <code>DatatypeFactory</code> is created through the {@link #newInstance()} method ! * that uses the following implementation resolution mechanisms to determine an implementation:</p> * <ol> * <li> * If the system property specified by {@link #DATATYPEFACTORY_PROPERTY}, "<code>javax.xml.datatype.DatatypeFactory</code>", * exists, a class with the name of the property's value is instantiated. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*** 46,57 **** * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>. * The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step * and processed as documented in the prior step. * </li> * <li> ! * The services resolution mechanism is used, e.g. <code>META-INF/services/java.xml.datatype.DatatypeFactory</code>. ! * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. * </li> * <li> * The final mechanism is to attempt to instantiate the <code>Class</code> specified by * {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}. --- 46,62 ---- * If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>. * The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step * and processed as documented in the prior step. * </li> * <li> ! * <p>Uses the service-provider loading facilities, defined by the {@link java.util.ServiceLoader} class, to attempt ! * to locate and load an implementation of the service. In case of multiple providers, the first non-default implementation ! * shall be instantiated and returned. The default implementation is returned if it is the only one ! * found by the service loader.</p> ! * <p> ! * If a misconfigured provider is encountered and {@link java.util.ServiceConfigurationError} is thrown, the error will be wrapped ! * in a {@link javax.xml.datatype.DatatypeConfigurationException}.</p> * </li> * <li> * The final mechanism is to attempt to instantiate the <code>Class</code> specified by * {@link #DATATYPEFACTORY_IMPLEMENTATION_CLASS}. * Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
*** 60,70 **** * * @author <a href="mailto:Joseph.Fialli@Sun.COM">Joseph Fialli</a> * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> * @author <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a> * ! * @version $Revision: 1.13 $, $Date: 2010/03/11 23:10:53 $ * @since 1.5 */ public abstract class DatatypeFactory { /** --- 65,75 ---- * * @author <a href="mailto:Joseph.Fialli@Sun.COM">Joseph Fialli</a> * @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a> * @author <a href="mailto:Neeraj.Bajaj@sun.com">Neeraj Bajaj</a> * ! * @version $Revision: 1.14 $, $Date: 2010-11-01 04:36:08 $ * @since 1.5 */ public abstract class DatatypeFactory { /**
*** 123,142 **** * @see #newInstance(String factoryClassName, ClassLoader classLoader) */ public static DatatypeFactory newInstance() throws DatatypeConfigurationException { ! try { ! return (DatatypeFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ DATATYPEFACTORY_PROPERTY, /* The fallback implementation class name */ DATATYPEFACTORY_IMPLEMENTATION_CLASS); ! } catch (FactoryFinder.ConfigurationError e) { ! throw new DatatypeConfigurationException(e.getMessage(), e.getException()); ! } ! } /** * <p>Obtain a new instance of a <code>DatatypeFactory</code> from class name. * This function is useful when there are multiple providers in the classpath. * It gives more control to the application as it can specify which provider --- 128,143 ---- * @see #newInstance(String factoryClassName, ClassLoader classLoader) */ public static DatatypeFactory newInstance() throws DatatypeConfigurationException { ! return (DatatypeFactory) FactoryFinder.find(DatatypeFactory.class, /* The default property name according to the JAXP spec */ DATATYPEFACTORY_PROPERTY, /* The fallback implementation class name */ DATATYPEFACTORY_IMPLEMENTATION_CLASS); ! } /** * <p>Obtain a new instance of a <code>DatatypeFactory</code> from class name. * This function is useful when there are multiple providers in the classpath. * It gives more control to the application as it can specify which provider
*** 170,184 **** * * @since 1.6 */ public static DatatypeFactory newInstance(String factoryClassName, ClassLoader classLoader) throws DatatypeConfigurationException { - try { return (DatatypeFactory) FactoryFinder.newInstance(factoryClassName, classLoader, false); - } catch (FactoryFinder.ConfigurationError e) { - throw new DatatypeConfigurationException(e.getMessage(), e.getException()); - } } /** * <p>Obtain a new instance of a <code>Duration</code> * specifying the <code>Duration</code> as its string representation, "PnYnMnDTnHnMnS", --- 171,181 ----