/*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the "License"). You may not use this file except
* in compliance with the License.
*
* You can obtain a copy of the license at
* https://jaxp.dev.java.net/CDDLv1.0.html.
* See the License for the specific language governing
* permissions and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* HEADER in each file and include the License file at
* https://jaxp.dev.java.net/CDDLv1.0.html
* If applicable add the following below this CDDL HEADER
* with the fields enclosed by brackets "[]" replaced with
* your own identifying information: Portions Copyright
* [year] [name of copyright owner]
*/
/*
* $Id: XPathFactory.java,v 1.4 2005/11/03 19:34:16 jeffsuttor Exp $
* @(#)XPathFactory.java 1.18 06/06/21
*
* Copyright 2005 Sun Microsystems, Inc. All Rights Reserved.
*/
package javax.xml.xpath;
/**
* <p>An <code>XPathFactory</code> instance can be used to create
* {@link javax.xml.xpath.XPath} objects.</p>
*
*<p>See {@link #newInstance(String uri)} for lookup mechanism.</p>
*
* <p>The {@link XPathFactory} class is not thread-safe. In other words,
* it is the application's responsibility to ensure that at most
* one thread is using a {@link XPathFactory} object at any
* given moment. Implementations are encouraged to mark methods
* as <code>synchronized</code> to protect themselves from broken clients.
*
* <p>{@link XPathFactory} is not re-entrant. While one of the
* <code>newInstance</code> methods is being invoked, applications
* may not attempt to recursively invoke a <code>newInstance</code> method,
* even from the same thread.
*
* @author <a href="mailto:Norman.Walsh@Sun.com">Norman Walsh</a>
* @author <a href="mailto:Jeff.Suttor@Sun.com">Jeff Suttor</a>
*
* @version $Revision: 1.4 $, $Date: 2005/11/03 19:34:16 $
* @since 1.5
*/
public abstract class XPathFactory {
/**
* <p>The default property name according to the JAXP spec.</p>
*/
public static final String DEFAULT_PROPERTY_NAME = "javax.xml.xpath.XPathFactory";
/**
* <p>Default Object Model URI.</p>
*/
public static final String DEFAULT_OBJECT_MODEL_URI = "http://java.sun.com/jaxp/xpath/dom";
/**
*<p> Take care of restrictions imposed by java security model </p>
*/
private static SecuritySupport ss = new SecuritySupport() ;
/**
* <p>Protected constructor as {@link #newInstance()} or {@link #newInstance(String uri)}
* or {@link #newInstance(String uri, String factoryClassName, ClassLoader classLoader)}
* should be used to create a new instance of an <code>XPathFactory</code>.</p>
*/
protected XPathFactory() {
}
/**
* <p>Get a new <code>XPathFactory</code> instance using the default object model,
* {@link #DEFAULT_OBJECT_MODEL_URI},
* the W3C DOM.</p>
*
* <p>This method is functionally equivalent to:</p>
* <pre>
* newInstance(DEFAULT_OBJECT_MODEL_URI)
* </pre>
*
* <p>Since the implementation for the W3C DOM is always available, this method will never fail.</p>
*
* @return Instance of an <code>XPathFactory</code>.
*
* @throws RuntimeException When there is a failure in creating an
* <code>XPathFactory</code> for the default object model.
*/
public static final XPathFactory newInstance() {
try {
return newInstance(DEFAULT_OBJECT_MODEL_URI);
} catch (XPathFactoryConfigurationException xpathFactoryConfigurationException) {
=1= |