src/javax/xml/stream/XMLOutputFactory.java
Print this page
*** 119,167 ****
protected XMLOutputFactory(){}
/**
* Create a new instance of the factory.
* @throws FactoryConfigurationError if an instance of this factory cannot be loaded
*/
public static XMLOutputFactory newInstance()
throws FactoryConfigurationError
{
! return (XMLOutputFactory) FactoryFinder.find("javax.xml.stream.XMLOutputFactory",
! DEFAULIMPL);
}
/**
* Create a new instance of the factory.
* This static method creates a new factory instance. This method uses the
* following ordered lookup procedure to determine the XMLOutputFactory
* implementation class to load:
* Use the javax.xml.stream.XMLOutputFactory system property.
! * Use the properties file "lib/stax.properties" in the JRE directory.
! * This configuration file is in standard java.util.Properties format
! * and contains the fully qualified name of the implementation class
* with the key being the system property defined above.
! * Use the Services API (as detailed in the JAR specification), if available,
! * to determine the classname. The Services API will look for a classname
! * in the file META-INF/services/javax.xml.stream.XMLOutputFactory in jars
! * available to the runtime.
! * Platform default XMLOutputFactory instance.
! *
* Once an application has obtained a reference to a XMLOutputFactory it
* can use the factory to configure and obtain stream instances.
! *
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to the
* deprecated method.
! *
! * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
*/
public static XMLOutputFactory newFactory()
throws FactoryConfigurationError
{
! return (XMLOutputFactory) FactoryFinder.find("javax.xml.stream.XMLOutputFactory",
! DEFAULIMPL);
}
/**
* Create a new instance of the factory.
*
--- 119,181 ----
protected XMLOutputFactory(){}
/**
* Create a new instance of the factory.
+ * Same as {@link #newFactory()}.
* @throws FactoryConfigurationError if an instance of this factory cannot be loaded
*/
public static XMLOutputFactory newInstance()
throws FactoryConfigurationError
{
! return FactoryFinder.find(XMLOutputFactory.class, DEFAULIMPL);
}
/**
* Create a new instance of the factory.
+ * <p>
* This static method creates a new factory instance. This method uses the
* following ordered lookup procedure to determine the XMLOutputFactory
* implementation class to load:
+ * </p>
+ * <ul>
+ * <li>
* Use the javax.xml.stream.XMLOutputFactory system property.
! * </li>
! * <li>
! * Use the properties file "lib/stax.properties" in the JRE directory,
! * if present, otherwise, use the properties file "lib/jaxp.properties"
! * in the JRE directory.
! * These configuration files are in standard java.util.Properties format
! * and contain the fully qualified name of the implementation class
* with the key being the system property defined above.
! * </li>
! * <li>
! * Use the service-provider loading facilities, defined by the
! * {@link java.util.ServiceLoader} class, to attempt to locate and load an
! * implementation of the service.
! * </li>
! * <li>
! * Otherwise, the system-default implementation is returned.
! * </li>
! * <p>
* Once an application has obtained a reference to a XMLOutputFactory it
* can use the factory to configure and obtain stream instances.
! * </p>
! * <p>
* Note that this is a new method that replaces the deprecated newInstance() method.
* No changes in behavior are defined by this replacement method relative to the
* deprecated method.
! * </p>
! * @throws FactoryConfigurationError in case of {@linkplain
! * java.util.ServiceConfigurationError service configuration error} or if
! * the implementation is not available or cannot be instantiated.
*/
public static XMLOutputFactory newFactory()
throws FactoryConfigurationError
{
! return FactoryFinder.find(XMLOutputFactory.class, DEFAULIMPL);
}
/**
* Create a new instance of the factory.
*
*** 177,222 ****
* java.lang.ClassLoader)} instead.
*/
public static XMLInputFactory newInstance(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
- try {
//do not fallback if given classloader can't find the class, throw exception
! return (XMLInputFactory) FactoryFinder.find(factoryId, classLoader, null);
! } catch (FactoryFinder.ConfigurationError e) {
! throw new FactoryConfigurationError(e.getException(),
! e.getMessage());
! }
}
/**
* Create a new instance of the factory.
* If the classLoader argument is null, then the ContextClassLoader is used.
*
* Note that this is a new method that replaces the deprecated
! * newInstance(String factoryId, ClassLoader classLoader) method.
! *
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
! *
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param classLoader classLoader to use
* @return the factory implementation
! * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
*/
public static XMLOutputFactory newFactory(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
- try {
//do not fallback if given classloader can't find the class, throw exception
! return (XMLOutputFactory) FactoryFinder.find(factoryId, classLoader, null);
! } catch (FactoryFinder.ConfigurationError e) {
! throw new FactoryConfigurationError(e.getException(),
! e.getMessage());
! }
}
/**
* Create a new XMLStreamWriter that writes to a writer
* @param stream the writer to write to
--- 191,255 ----
* java.lang.ClassLoader)} instead.
*/
public static XMLInputFactory newInstance(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
//do not fallback if given classloader can't find the class, throw exception
! return FactoryFinder.find(XMLInputFactory.class, factoryId, classLoader, null);
}
/**
* Create a new instance of the factory.
* If the classLoader argument is null, then the ContextClassLoader is used.
+ * <p>
+ * This method uses the following ordered lookup procedure to determine
+ * the XMLOutputFactory implementation class to load:
+ * </p>
+ * <ul>
+ * <li>
+ * Use the value of the system property identified by {@code factoryId}.
+ * </li>
+ * <li>
+ * Use the properties file "lib/stax.properties" in the JRE directory,
+ * if present, otherwise, use the properties file "lib/jaxp.properties"
+ * in the JRE directory.
+ * These configuration files are in standard java.util.Properties format
+ * and contain the fully qualified name of the implementation class
+ * with the key being the given {@code factoryId}.
+ * </li>
+ * <li>
+ * If {@code factoryId} is the base service class name,
+ * use the service-provider loading facilities, defined by the
+ * {@link java.util.ServiceLoader} class, to attempt to locate and load an
+ * implementation of the service.
+ * </li>
+ * <li>
+ * Otherwise, throws a {@link FactoryConfigurationError}.
+ * </li>
+ * </ul>
*
+ * <p>
* Note that this is a new method that replaces the deprecated
! * {@link #newInstance(java.lang.String, java.lang.ClassLoader)
! * newInstance(String factoryId, ClassLoader classLoader)} method.
* No changes in behavior are defined by this replacement method relative
* to the deprecated method.
! * </p>
*
* @param factoryId Name of the factory to find, same as
* a property name
* @param classLoader classLoader to use
* @return the factory implementation
! * @throws FactoryConfigurationError in case of {@linkplain
! * java.util.ServiceConfigurationError service configuration error} or if
! * the implementation is not available or cannot be instantiated.
*/
public static XMLOutputFactory newFactory(String factoryId,
ClassLoader classLoader)
throws FactoryConfigurationError {
//do not fallback if given classloader can't find the class, throw exception
! return FactoryFinder.find(XMLOutputFactory.class, factoryId, classLoader, null);
}
/**
* Create a new XMLStreamWriter that writes to a writer
* @param stream the writer to write to