Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 1997-2013 Oracle and/or its affiliates. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common Development
* and Distribution License("CDDL") (collectively, the "License"). You
* may not use this file except in compliance with the License. You can
* obtain a copy of the License at
* https://glassfish.dev.java.net/public/CDDL+GPL_1_1.html
* or packager/legal/LICENSE.txt. See the License for the specific
* language governing permissions and limitations under the License.
*
* When distributing the software, include this License Header Notice in each
* file and include the License file at packager/legal/LICENSE.txt.
*
* GPL Classpath Exception:
* Oracle designates this particular file as subject to the "Classpath"
* exception as provided by Oracle in the GPL Version 2 section of the License
* file that accompanied this code.
*
* Modifications:
* If applicable, add the following below the License Header, with the fields
* enclosed by brackets [] replaced by your own identifying information:
* "Portions Copyright [year] [name of copyright owner]"
*
* Contributor(s):
* If you wish your version of this file to be governed by only the CDDL or
* only the GPL Version 2, indicate your decision by adding "[Contributor]
* elects to include this software in this distribution under the [CDDL or GPL
* Version 2] license." If you don't indicate a single choice of license, a
* recipient has the option to distribute your version of this file under
* either the CDDL, the GPL Version 2 or to extend the choice of license to
* its licensees as provided above. However, if you add GPL Version 2 code
* and therefore, elected the GPL Version 2 license, then the option applies
* only if the new code is made subject to such option by the copyright
* holder.
*
*
* This file incorporates work covered by the following copyright and
* permission notice:
*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// $Id: Digester.java 565464 2007-08-13 18:13:47Z remm $
package org.apache.tomcat.util.digester;
import org.apache.catalina.core.StandardServer;
import org.glassfish.logging.annotation.LogMessageInfo;
import org.glassfish.web.util.IntrospectionUtils;
import org.xml.sax.*;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.helpers.DefaultHandler;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.*;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
A Digester processes an XML input stream by matching a
* series of element nesting patterns to execute Rules that have been added
* prior to the start of parsing. This package was inspired by the
* XmlMapper class that was part of Tomcat 3.0 and 3.1,
* but is organized somewhat differently.
IMPLEMENTATION NOTE - A single Digester instance may
* only be used within the context of a single thread at a time, and a call
* to parse() must be completed before another can be initiated
* even from the same thread.
*
*
IMPLEMENTATION NOTE - A bug in Xerces 2.0.2 prevents
* the support of XML schema. You need Xerces 2.1/2.3 and up to make
* this class working with XML schema
*/
public class Digester extends DefaultHandler {
@LogMessageInfo(
message = "Digester.getParser: ",
level = "SEVERE",
cause = "Could not create new SAXParser",
action = "Verify the parser configuration and if SAXParser is supported"
)
public static final String GET_PARRSER_EXCEPTION = "AS-WEB-CORE-00517";
@LogMessageInfo(
message = "Cannot get XMLReader",
level = "SEVERE",
cause = "Could not get XML Reader",
action = "Verify if there are XML Readers can be instantiated"
)
public static final String CANNOT_GET_XML_READER_EXCEPTION = "AS-WEB-CORE-00518";
@LogMessageInfo(
message = "Finish event threw exception",
level = "SEVERE",
cause = "Rules could not remove data",
action = "Verify if finish() is called after all parsing methods have been called"
)
public static final String FINISH_EVENT_EXCEPTION = "AS-WEB-CORE-00519";
@LogMessageInfo(
message = "Finish event threw error",
level = "SEVERE",
cause = "Rules could not remove data",
action = "Verify if finish() is called after all parsing methods have been called"
)
public static final String FINISH_EVENT_ERROR = "AS-WEB-CORE-00520";
@LogMessageInfo(
message = "Body event threw exception",
level = "SEVERE",
cause = "Could not fire body()",
action = "Verify if the current rule has body"
)
public static final String BODY_EVENT_EXCEPTION = "AS-WEB-CORE-00521";
@LogMessageInfo(
message = "Body event threw error",
level = "SEVERE",
cause = "Could not fire body()",
action = "Verify if the current rule has body"
)
public static final String BODY_EVENT_ERROR = "AS-WEB-CORE-00522";
@LogMessageInfo(
message = "No rules found matching {0}.",
level = "WARNING"
)
public static final String NO_RULES_FOUND_MATCHING_EXCEPTION = "AS-WEB-CORE-00523";
@LogMessageInfo(
message = "End event threw exception",
level = "SEVERE",
cause = "Could not call end()",
action = "Verify if this method is called when the end of a matching XML element " +
"is encountered"
)
public static final String END_EVENT_EXCEPTION = "AS-WEB-CORE-00524";
@LogMessageInfo(
message = "End event threw error",
level = "SEVERE",
cause = "Could not call end()",
action = "Verify if this method is called when the end of a matching XML element " +
"is encountered"
)
public static final String END_EVENT_ERROR = "AS-WEB-CORE-00525";
@LogMessageInfo(
message = "Begin event threw exception",
level = "SEVERE",
cause = "Could not call begin()",
action = "Verify if this method is called when the beginning of a matching XML element " +
"is encountered"
)
public static final String BEGIN_EVENT_EXCEPTION = "AS-WEB-CORE-00526";
@LogMessageInfo(
message = "Begin event threw error",
level = "SEVERE",
cause = "Could not call begin()",
action = "Verify if this method is called when the beginning of a matching XML element " +
"is encountered"
)
public static final String BEGIN_EVENT_ERROR = "AS-WEB-CORE-00527";
@LogMessageInfo(
message = "Parse Error at line {0} column {1}: {2}",
level = "SEVERE",
cause = "Parsing error occurs",
action = "Verify if there are any parsing errors occur"
)
public static final String PARSE_ERROR = "AS-WEB-CORE-00528";
@LogMessageInfo(
message = "Parse Fatal Error at line {0} column {1}: {2}",
level = "SEVERE",
cause = "Parsing error occurs",
action = "Verify if there are any parsing errors occur"
)
public static final String PARSE_FATAL_ERROR = "AS-WEB-CORE-00529";
@LogMessageInfo(
message = "Parse Warning Error at line {0} column {1}: {2}",
level = "SEVERE",
cause = "Parsing error occurs",
action = "Verify if there are any parsing errors occur"
)
public static final String PARSE_WARNING_ERROR = "AS-WEB-CORE-00530";
@LogMessageInfo(
message = "Empty stack (returning null)",
level = "WARNING"
)
public static final String EMPTY_STACK_EXCEPTION = "AS-WEB-CORE-00531";
@LogMessageInfo(
message = "No Locator!",
level = "SEVERE",
cause = "There is no document locator",
action = "Verify if document locator has been set"
)
public static final String NO_LOCATOR_EXCEPTION = "AS-WEB-CORE-00532";
// ---------------------------------------------------------- Static Fields
private static class SystemPropertySource
implements IntrospectionUtils.PropertySource {
public String getProperty( String key ) {
return System.getProperty(key);
}
}
static final IntrospectionUtils.PropertySource source[] =
new IntrospectionUtils.PropertySource[] { new SystemPropertySource() };
// --------------------------------------------------------- Constructors
/**
* Construct a new Digester with default properties.
*/
public Digester() {
super();
}
/**
* Construct a new Digester, allowing a SAXParser to be passed in. This
* allows Digester to be used in environments which are unfriendly to
* JAXP1.1 (such as WebLogic 6.0). Thanks for the request to change go to
* James House ([email protected]). This may help in places where
* you are able to load JAXP 1.1 classes yourself.
*/
public Digester(SAXParser parser) {
super();
this.parser = parser;
}
/**
* Construct a new Digester, allowing an XMLReader to be passed in. This
* allows Digester to be used in environments which are unfriendly to
* JAXP1.1 (such as WebLogic 6.0). Note that if you use this option you
* have to configure namespace and validation support yourself, as these
* properties only affect the SAXParser and emtpy constructor.
*/
public Digester(XMLReader reader) {
super();
this.reader = reader;
}
// --------------------------------------------------- Instance Variables
/**
* The body text of the current element.
*/
protected StringBuilder bodyText = new StringBuilder();
/**
* The stack of body text string buffers for surrounding elements.
*/
protected ArrayStack bodyTexts =
new ArrayStack();
/**
* Stack whose elements are List objects, each containing a list of
* Rule objects as returned from Rules.getMatch(). As each xml element
* in the input is entered, the matching rules are pushed onto this
* stack. After the end tag is reached, the matches are popped again.
* The depth of is stack is therefore exactly the same as the current
* "nesting" level of the input xml.
*
* @since 1.6
*/
protected ArrayStack> matches = new ArrayStack>(10);
/**
* The class loader to use for instantiating application objects.
* If not specified, the context class loader, or the class loader
* used to load Digester itself, is used, based on the value of the
* useContextClassLoader variable.
*/
protected ClassLoader classLoader = null;
/**
* Has this Digester been configured yet.
*/
protected boolean configured = false;
/**
* The EntityResolver used by the SAX parser. By default it use this class
*/
protected EntityResolver entityResolver;
/**
* The URLs of entityValidator that have been registered, keyed by the public
* identifier that corresponds.
*/
protected HashMap entityValidator =
new HashMap();
/**
* The application-supplied error handler that is notified when parsing
* warnings, errors, or fatal errors occur.
*/
protected ErrorHandler errorHandler = null;
/**
* The SAXParserFactory that is created the first time we need it.
*/
protected SAXParserFactory factory = null;
/**
* @deprecated This is now managed by {@link ParserFeatureSetterFactory}
*/
protected String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
/**
* The Locator associated with our parser.
*/
protected Locator locator = null;
/**
* The current match pattern for nested element processing.
*/
protected String match = "";
/**
* Do we want a "namespace aware" parser.
*/
protected boolean namespaceAware = false;
/**
* Registered namespaces we are currently processing. The key is the
* namespace prefix that was declared in the document. The value is an
* ArrayStack of the namespace URIs this prefix has been mapped to --
* the top Stack element is the most current one. (This architecture
* is required because documents can declare nested uses of the same
* prefix for different Namespace URIs).
*/
protected HashMap> namespaces =
new HashMap>();
/**
* The parameters stack being utilized by CallMethodRule and
* CallParamRule rules.
*/
protected ArrayStack