/* $$ Clover has instrumented this file $$ */// 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.
package org.apache.tapestry.parse;
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.ErrorHandler;
import org.apache.hivemind.Resource;
import org.apache.hivemind.impl.DefaultErrorHandler;
import org.apache.hivemind.parse.AbstractParser;
import org.apache.hivemind.util.PropertyUtils;
import org.apache.tapestry.INamespace;
import org.apache.tapestry.Tapestry;
import org.apache.tapestry.bean.IBeanInitializer;
import org.apache.tapestry.spec.AssetType;
import org.apache.tapestry.spec.BeanLifecycle;
import org.apache.tapestry.spec.BindingType;
import org.apache.tapestry.spec.Direction;
import org.apache.tapestry.spec.IApplicationSpecification;
import org.apache.tapestry.spec.IAssetSpecification;
import org.apache.tapestry.spec.IBeanSpecification;
import org.apache.tapestry.spec.IBindingSpecification;
import org.apache.tapestry.spec.IComponentSpecification;
import org.apache.tapestry.spec.IContainedComponent;
import org.apache.tapestry.spec.IExtensionSpecification;
import org.apache.tapestry.spec.ILibrarySpecification;
import org.apache.tapestry.spec.IListenerBindingSpecification;
import org.apache.tapestry.spec.IParameterSpecification;
import org.apache.tapestry.spec.IPropertySpecification;
import org.apache.tapestry.spec.SpecFactory;
import org.apache.tapestry.util.IPropertyHolder;
import org.apache.tapestry.util.RegexpMatcher;
import org.apache.tapestry.util.xml.DocumentParseException;
import org.apache.tapestry.util.xml.InvalidStringException;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
/**
* Parses the different types of Tapestry specifications.
* <p>
* Not threadsafe; it is the callers responsibility to ensure thread safety.
*
* @author Howard Lewis Ship
*/
public class SpecificationParser extends AbstractParser implements ISpecificationParser
{public static com.cortexeb.tools.clover.d __CLOVER_225_0 = com.cortexeb.tools.clover.aq.getRecorder(new char[] {67,58,92,119,111,114,107,115,112,97,99,101,92,106,97,107,97,114,116,97,45,116,97,112,101,115,116,114,121,92,102,114,97,109,101,119,111,114,107,92,116,97,114,103,101,116,92,99,108,111,118,101,114,45,100,98},1096998272901L);
/**
* Perl5 pattern for asset names. Letter, followed by letter, number or underscore. Also allows
* the special "$template" value.
*
* @since 2.2
*/
public static final String ASSET_NAME_PATTERN = "(\\$template)|("
+ Tapestry.SIMPLE_PROPERTY_NAME_PATTERN + ")";
/**
* Perl5 pattern for helper bean names. Letter, followed by letter, number or underscore.
*
* @since 2.2
*/
public static final String BEAN_NAME_PATTERN = Tapestry.SIMPLE_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern for component alias. Letter, followed by letter, number, or underscore. This is
* used to validate component types registered in the application or library specifications.
*
* @since 2.2
*/
public static final String COMPONENT_ALIAS_PATTERN = Tapestry.SIMPLE_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern for component ids. Letter, followed by letter, number or underscore.
*
* @since 2.2
*/
public static final String COMPONENT_ID_PATTERN = Tapestry.SIMPLE_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern for component types. Component types are an optional namespace prefix followed
* by a normal identifier.
*
* @since 2.2
*/
public static final String COMPONENT_TYPE_PATTERN = "^(_?[a-zA-Z]\\w*:)?[a-zA-Z_](\\w)*$";
/**
* We can share a single map for all the XML attribute to object conversions, since the keys are
* unique.
*/
private final Map CONVERSION_MAP = new HashMap();
/**
* Like modified property name, but allows periods in the name as well.
*
* @since 2.2
*/
public static final String EXTENDED_PROPERTY_NAME_PATTERN = "^_?[a-zA-Z](\\w|-|\\.)*$";
/**
* Per5 pattern for extension names. Letter followed by letter, number, dash, period or
* underscore.
*
* @since 2.2
*/
public static final String EXTENSION_NAME_PATTERN = EXTENDED_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern for library ids. Letter followed by letter, number or underscore.
*
* @since 2.2
*/
public static final String LIBRARY_ID_PATTERN = Tapestry.SIMPLE_PROPERTY_NAME_PATTERN;
/** @since 3.1 */
private final Log _log;
/** @since 3.1 */
private final ErrorHandler _errorHandler;
/**
* Set to true if parsing the 3.1 DTD.
*
* @since 3.1
*/
private boolean _DTD_3_1;
/**
* Perl5 pattern for page names. Letter followed by letter, number, dash, underscore or period.
*
* @since 2.2
*/
public static final String PAGE_NAME_PATTERN = EXTENDED_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern that parameter names must conform to. Letter, followed by letter, number or
* underscore.
*
* @since 2.2
*/
public static final String PARAMETER_NAME_PATTERN = Tapestry.SIMPLE_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern that property names (that can be connected to parameters) must conform to.
* Letter, followed by letter, number or underscore.
*
* @since 2.2
*/
public static final String PROPERTY_NAME_PATTERN = Tapestry.SIMPLE_PROPERTY_NAME_PATTERN;
/**
* Perl5 pattern for service names. Letter followed by letter, number, dash, underscore or
* period.
*
* @since 2.2
* @deprecated As of release 3.1, the <service> element (in 3.0 DTDs) is no longer
* supported.
*/
public static final String SERVICE_NAME_PATTERN = EXTENDED_PROPERTY_NAME_PATTERN;
private static final int STATE_ALLOW_DESCRIPTION = 2000;
private static final int STATE_ALLOW_PROPERTY = 2001;
private static final int STATE_APPLICATION_SPECIFICATION_INITIAL = 1002;
private static final int STATE_BEAN = 4;
/** Very different between 3.0 and 3.1 DTD */
private static final int STATE_BINDING_3_0 = 7;
/** @since 3.1 */
private static final int STATE_BINDING = 100;
private static final int STATE_COMPONENT = 6;
private static final int STATE_COMPONENT_SPECIFICATION = 1;
private static final int STATE_COMPONENT_SPECIFICATION_INITIAL = 1000;
private static final int STATE_CONFIGURE = 14;
private static final int STATE_DESCRIPTION = 2;
private static final int STATE_EXTENSION = 13;
private static final int STATE_LIBRARY_SPECIFICATION = 12;
private static final int STATE_LIBRARY_SPECIFICATION_INITIAL = 1003;
private static final int STATE_LISTENER_BINDING = 8;
private static final int STATE_NO_CONTENT = 3000;
private static final int STATE_PAGE_SPECIFICATION = 11;
private static final int STATE_PAGE_SPECIFICATION_INITIAL = 1001;
private static final int STATE_PROPERTY = 3;
private static final int STATE_PROPERTY_SPECIFICATION = 10;
private static final int STATE_SET_PROPERTY = 5;
/** 3.0 DTD only */
private static final int STATE_STATIC_BINDING = 9;
/** @since 3.0 */
public static final String TAPESTRY_DTD_3_0_PUBLIC_ID = "-//Apache Software Foundation//Tapestry Specification 3.0//EN";
/** @since 3.1 */
public static final String TAPESTRY_DTD_3_1_PUBLIC_ID = "-//Apache Software Foundation//Tapestry Specification 3.1//EN";
/**
* The attributes of the current element, as a map (string keyed on string).
*/
private Map _attributes;
/**
* The name of the current element.
*/
private String _elementName;
/** @since 1.0.9 */
private final SpecFactory _factory;
private RegexpMatcher _matcher = new RegexpMatcher();
private SAXParser _parser;
private SAXParserFactory _parserFactory = SAXParserFactory.newInstance();
/**
* @since 3.0
*/
private final ClassResolver _resolver;
/**
* The root object parsed: a component or page specification, a library specification, or an
* application specification.
*/
private Object _rootObject;
// Identify all the different acceptible values.
// We continue to sneak by with a single map because
// there aren't conflicts; when we have 'foo' meaning
// different things in different places in the DTD, we'll
// need multiple maps.
{
__CLOVER_225_0.S[5030]++;CONVERSION_MAP.put("true", Boolean.TRUE);
__CLOVER_225_0.S[5031]++;CONVERSION_MAP.put("t", Boolean.TRUE);
__CLOVER_225_0.S[5032]++;CONVERSION_MAP.put("1", Boolean.TRUE);
__CLOVER_225_0.S[5033]++;CONVERSION_MAP.put("y", Boolean.TRUE);
__CLOVER_225_0.S[5034]++;CONVERSION_MAP.put("yes", Boolean.TRUE);
__CLOVER_225_0.S[5035]++;CONVERSION_MAP.put("on", Boolean.TRUE);
__CLOVER_225_0.S[5036]++;CONVERSION_MAP.put("false", Boolean.FALSE);
__CLOVER_225_0.S[5037]++;CONVERSION_MAP.put("f", Boolean.FALSE);
__CLOVER_225_0.S[5038]++;CONVERSION_MAP.put("0", Boolean.FALSE);
__CLOVER_225_0.S[5039]++;CONVERSION_MAP.put("off", Boolean.FALSE);
__CLOVER_225_0.S[5040]++;CONVERSION_MAP.put("no", Boolean.FALSE);
__CLOVER_225_0.S[5041]++;CONVERSION_MAP.put("n", Boolean.FALSE);
__CLOVER_225_0.S[5042]++;CONVERSION_MAP.put("none", BeanLifecycle.NONE);
__CLOVER_225_0.S[5043]++;CONVERSION_MAP.put("request", BeanLifecycle.REQUEST);
__CLOVER_225_0.S[5044]++;CONVERSION_MAP.put("page", BeanLifecycle.PAGE);
__CLOVER_225_0.S[5045]++;CONVERSION_MAP.put("render", BeanLifecycle.RENDER);
__CLOVER_225_0.S[5046]++;CONVERSION_MAP.put("in", Direction.IN);
__CLOVER_225_0.S[5047]++;CONVERSION_MAP.put("form", Direction.FORM);
__CLOVER_225_0.S[5048]++;CONVERSION_MAP.put("custom", Direction.CUSTOM);
__CLOVER_225_0.S[5049]++;CONVERSION_MAP.put("auto", Direction.AUTO);
__CLOVER_225_0.S[5050]++;_parserFactory.setNamespaceAware(false);
__CLOVER_225_0.S[5051]++;_parserFactory.setValidating(true);
}
/**
* This constructor is a convienience used by some tests.
*/
public SpecificationParser(ClassResolver resolver)
{
this(resolver, new SpecFactory());__CLOVER_225_0.S[5052]++;try { __CLOVER_225_0.M[1105]++;
} finally { }}
/**
* Create a new instance with resolver and a provided SpecFactory (used by Spindle).
*
* @deprecated to be removed in release 3.2
*/
public SpecificationParser(ClassResolver resolver, SpecFactory factory)
{
this(new DefaultErrorHandler(), LogFactory.getLog(SpecificationParser.class), resolver,
factory);__CLOVER_225_0.S[5053]++;try { __CLOVER_225_0.M[1106]++;
} finally { }}
/**
* The full constructor, used within Tapestry.
*/
public SpecificationParser(ErrorHandler errorHandler, Log log, ClassResolver resolver,
SpecFactory factory)
{try { __CLOVER_225_0.M[1107]++;
__CLOVER_225_0.S[5054]++;_errorHandler = errorHandler;
__CLOVER_225_0.S[5055]++;_log = log;
__CLOVER_225_0.S[5056]++;_resolver = resolver;
__CLOVER_225_0.S[5057]++;_factory = factory;
} finally { }}
protected void begin(String elementName, Map attributes)
{try { __CLOVER_225_0.M[1108]++;
__CLOVER_225_0.S[5058]++;_elementName = elementName;
__CLOVER_225_0.S[5059]++;_attributes = attributes;
__CLOVER_225_0.S[5060]++;switch (getState())
{
case STATE_COMPONENT_SPECIFICATION_INITIAL:
__CLOVER_225_0.S[5061]++;beginComponentSpecificationInitial();
__CLOVER_225_0.S[5062]++;break;
case STATE_PAGE_SPECIFICATION_INITIAL:
__CLOVER_225_0.S[5063]++;beginPageSpecificationInitial();
__CLOVER_225_0.S[5064]++;break;
case STATE_APPLICATION_SPECIFICATION_INITIAL:
__CLOVER_225_0.S[5065]++;beginApplicationSpecificationInitial();
__CLOVER_225_0.S[5066]++;break;
case STATE_LIBRARY_SPECIFICATION_INITIAL:
__CLOVER_225_0.S[5067]++;beginLibrarySpecificationInitial();
__CLOVER_225_0.S[5068]++;break;
case STATE_COMPONENT_SPECIFICATION:
__CLOVER_225_0.S[5069]++;beginComponentSpecification();
__CLOVER_225_0.S[5070]++;break;
case STATE_PAGE_SPECIFICATION:
__CLOVER_225_0.S[5071]++;beginPageSpecification();
__CLOVER_225_0.S[5072]++;break;
case STATE_ALLOW_DESCRIPTION:
__CLOVER_225_0.S[5073]++;beginAllowDescription();
__CLOVER_225_0.S[5074]++;break;
case STATE_ALLOW_PROPERTY:
__CLOVER_225_0.S[5075]++;beginAllowProperty();
__CLOVER_225_0.S[5076]++;break;
case STATE_BEAN:
__CLOVER_225_0.S[5077]++;beginBean();
__CLOVER_225_0.S[5078]++;break;
case STATE_COMPONENT:
__CLOVER_225_0.S[5079]++;beginComponent();
__CLOVER_225_0.S[5080]++;break;
case STATE_LIBRARY_SPECIFICATION:
__CLOVER_225_0.S[5081]++;beginLibrarySpecification();
__CLOVER_225_0.S[5082]++;break;
case STATE_EXTENSION:
__CLOVER_225_0.S[5083]++;beginExtension();
__CLOVER_225_0.S[5084]++;break;
default:
__CLOVER_225_0.S[5085]++;unexpectedElement(_elementName);
}
} finally { }}
/**
* Special state for a number of specification types that can support the <description>
* element.
*/
private void beginAllowDescription()
{try { __CLOVER_225_0.M[1109]++;
__CLOVER_225_0.S[5086]++;if ((((_elementName.equals("description")) && (++__CLOVER_225_0.CT[906] != 0)) || (++__CLOVER_225_0.CF[906] == 0))){
{
__CLOVER_225_0.S[5087]++;enterDescription();
__CLOVER_225_0.S[5088]++;return;
}}
__CLOVER_225_0.S[5089]++;unexpectedElement(_elementName);
} finally { }}
/**
* Special state for a number of elements that can support the nested <property>
* (meta-data) element.
*/
private void beginAllowProperty()
{try { __CLOVER_225_0.M[1110]++;
__CLOVER_225_0.S[5090]++;if ((((_elementName.equals("property")) && (++__CLOVER_225_0.CT[907] != 0)) || (++__CLOVER_225_0.CF[907] == 0))){
{
__CLOVER_225_0.S[5091]++;enterProperty();
__CLOVER_225_0.S[5092]++;return;
}}
__CLOVER_225_0.S[5093]++;unexpectedElement(_elementName);
} finally { }}
private void beginApplicationSpecificationInitial()
{try { __CLOVER_225_0.M[1111]++;
__CLOVER_225_0.S[5094]++;expectElement("application");
__CLOVER_225_0.S[5095]++;String name = getAttribute("name");
__CLOVER_225_0.S[5096]++;String engineClassName = getAttribute("engine-class");
__CLOVER_225_0.S[5097]++;IApplicationSpecification as = _factory.createApplicationSpecification();
__CLOVER_225_0.S[5098]++;as.setName(name);
__CLOVER_225_0.S[5099]++;if ((((Tapestry.isNonBlank(engineClassName)) && (++__CLOVER_225_0.CT[908] != 0)) || (++__CLOVER_225_0.CF[908] == 0))){
__CLOVER_225_0.S[5100]++;as.setEngineClassName(engineClassName);}
__CLOVER_225_0.S[5101]++;_rootObject = as;
__CLOVER_225_0.S[5102]++;push(_elementName, as, STATE_LIBRARY_SPECIFICATION);
} finally { }}
private void beginBean()
{try { __CLOVER_225_0.M[1112]++;
__CLOVER_225_0.S[5103]++;if ((((_elementName.equals("set-property")) && (++__CLOVER_225_0.CT[909] != 0)) || (++__CLOVER_225_0.CF[909] == 0))){
{
__CLOVER_225_0.S[5104]++;enterSetProperty();
__CLOVER_225_0.S[5105]++;return;
}}
__CLOVER_225_0.S[5106]++;if ((((_elementName.equals("set-message-property")) && (++__CLOVER_225_0.CT[910] != 0)) || (++__CLOVER_225_0.CF[910] == 0))){
{
__CLOVER_225_0.S[5107]++;enterSetMessage();
__CLOVER_225_0.S[5108]++;return;
}}
__CLOVER_225_0.S[5109]++;if ((((_elementName.equals("description")) && (++__CLOVER_225_0.CT[911] != 0)) || (++__CLOVER_225_0.CF[911] == 0))){
{
__CLOVER_225_0.S[5110]++;enterDescription();
__CLOVER_225_0.S[5111]++;return;
}}
__CLOVER_225_0.S[5112]++;if ((((_elementName.equals("property")) && (++__CLOVER_225_0.CT[912] != 0)) || (++__CLOVER_225_0.CF[912] == 0))){
{
__CLOVER_225_0.S[5113]++;enterProperty();
__CLOVER_225_0.S[5114]++;return;
}}
__CLOVER_225_0.S[5115]++;unexpectedElement(_elementName);
} finally { }}
private void beginComponent()
{try { __CLOVER_225_0.M[1113]++;
__CLOVER_225_0.S[5116]++;if ((((_elementName.equals("binding")) && (++__CLOVER_225_0.CT[913] != 0)) || (++__CLOVER_225_0.CF[913] == 0))){
{
__CLOVER_225_0.S[5117]++;enterBinding();
__CLOVER_225_0.S[5118]++;return;
}}
// 3.0 DTD only
__CLOVER_225_0.S[5119]++;if ((((_elementName.equals("static-binding")) && (++__CLOVER_225_0.CT[914] != 0)) || (++__CLOVER_225_0.CF[914] == 0))){
{
__CLOVER_225_0.S[5120]++;enterStaticBinding();
__CLOVER_225_0.S[5121]++;return;
}}
// 3.0 DTD only
__CLOVER_225_0.S[5122]++;if ((((_elementName.equals("message-binding")) && (++__CLOVER_225_0.CT[915] != 0)) || (++__CLOVER_225_0.CF[915] == 0))){
{
__CLOVER_225_0.S[5123]++;enterMessageBinding();
__CLOVER_225_0.S[5124]++;return;
}}
// 3.0 DTD only
__CLOVER_225_0.S[5125]++;if ((((_elementName.equals("inherited-binding")) && (++__CLOVER_225_0.CT[916] != 0)) || (++__CLOVER_225_0.CF[916] == 0))){
{
__CLOVER_225_0.S[5126]++;enterInheritedBinding();
__CLOVER_225_0.S[5127]++;return;
}}
__CLOVER_225_0.S[5128]++;if ((((_elementName.equals("listener-binding")) && (++__CLOVER_225_0.CT[917] != 0)) || (++__CLOVER_225_0.CF[917] == 0))){
{
__CLOVER_225_0.S[5129]++;enterListenerBinding();
__CLOVER_225_0.S[5130]++;return;
}}
__CLOVER_225_0.S[5131]++;if ((((_elementName.equals("property")) && (++__CLOVER_225_0.CT[918] != 0)) || (++__CLOVER_225_0.CF[918] == 0))){
{
__CLOVER_225_0.S[5132]++;enterProperty();
__CLOVER_225_0.S[5133]++;return;
}}
__CLOVER_225_0.S[5134]++;unexpectedElement(_elementName);
} finally { }}
private void beginComponentSpecification()
{try { __CLOVER_225_0.M[1114]++;
__CLOVER_225_0.S[5135]++;if ((((_elementName.equals("reserved-parameter")) && (++__CLOVER_225_0.CT[919] != 0)) || (++__CLOVER_225_0.CF[919] == 0))){
{
__CLOVER_225_0.S[5136]++;enterReservedParameter();
__CLOVER_225_0.S[5137]++;return;
}}
__CLOVER_225_0.S[5138]++;if ((((_elementName.equals("parameter")) && (++__CLOVER_225_0.CT[920] != 0)) || (++__CLOVER_225_0.CF[920] == 0))){
{
__CLOVER_225_0.S[5139]++;enterParameter();
__CLOVER_225_0.S[5140]++;return;
}}
// The remainder are common to both <component-specification> and
// <page-specification>
__CLOVER_225_0.S[5141]++;beginPageSpecification();
} finally { }}
private void beginComponentSpecificationInitial()
{try { __CLOVER_225_0.M[1115]++;
__CLOVER_225_0.S[5142]++;expectElement("component-specification");
__CLOVER_225_0.S[5143]++;IComponentSpecification cs = _factory.createComponentSpecification();
__CLOVER_225_0.S[5144]++;cs.setAllowBody(getBooleanAttribute("allow-body", true));
__CLOVER_225_0.S[5145]++;cs.setAllowInformalParameters(getBooleanAttribute("allow-informal-parameters", true));
__CLOVER_225_0.S[5146]++;String className = getAttribute("class");
__CLOVER_225_0.S[5147]++;if ((((className != null) && (++__CLOVER_225_0.CT[921] != 0)) || (++__CLOVER_225_0.CF[921] == 0))){
__CLOVER_225_0.S[5148]++;cs.setComponentClassName(className);}
__CLOVER_225_0.S[5149]++;cs.setSpecificationLocation(getResource());
__CLOVER_225_0.S[5150]++;_rootObject = cs;
__CLOVER_225_0.S[5151]++;push(_elementName, cs, STATE_COMPONENT_SPECIFICATION);
} finally { }}
private void beginExtension()
{try { __CLOVER_225_0.M[1116]++;
__CLOVER_225_0.S[5152]++;if ((((_elementName.equals("property")) && (++__CLOVER_225_0.CT[922] != 0)) || (++__CLOVER_225_0.CF[922] == 0))){
{
__CLOVER_225_0.S[5153]++;enterProperty();
__CLOVER_225_0.S[5154]++;return;
}}
__CLOVER_225_0.S[5155]++;if ((((_elementName.equals("configure")) && (++__CLOVER_225_0.CT[923] != 0)) || (++__CLOVER_225_0.CF[923] == 0))){
{
__CLOVER_225_0.S[5156]++;enterConfigure();
__CLOVER_225_0.S[5157]++;return;
}}
__CLOVER_225_0.S[5158]++;unexpectedElement(_elementName);
} finally { }}
private void beginLibrarySpecification()
{try { __CLOVER_225_0.M[1117]++;
__CLOVER_225_0.S[5159]++;if ((((_elementName.equals("description")) && (++__CLOVER_225_0.CT[924] != 0)) || (++__CLOVER_225_0.CF[924] == 0))){
{
__CLOVER_225_0.S[5160]++;enterDescription();
__CLOVER_225_0.S[5161]++;return;
}}
__CLOVER_225_0.S[5162]++;if ((((_elementName.equals("property")) && (++__CLOVER_225_0.CT[925] != 0)) || (++__CLOVER_225_0.CF[925] == 0))){
{
__CLOVER_225_0.S[5163]++;enterProperty();
__CLOVER_225_0.S[5164]++;return;
}}
__CLOVER_225_0.S[5165]++;if ((((_elementName.equals("page")) && (++__CLOVER_225_0.CT[926] != 0)) || (++__CLOVER_225_0.CF[926] == 0))){
{
__CLOVER_225_0.S[5166]++;enterPage();
__CLOVER_225_0.S[5167]++;return;
}}
__CLOVER_225_0.S[5168]++;if ((((_elementName.equals("component-type")) && (++__CLOVER_225_0.CT[927] != 0)) || (++__CLOVER_225_0.CF[927] == 0))){
{
__CLOVER_225_0.S[5169]++;enterComponentType();
__CLOVER_225_0.S[5170]++;return;
}}
// Holdover from the 3.0 DTD, now ignored.
__CLOVER_225_0.S[5171]++;if ((((_elementName.equals("service")) && (++__CLOVER_225_0.CT[928] != 0)) || (++__CLOVER_225_0.CF[928] == 0))){
{
__CLOVER_225_0.S[5172]++;enterService();
__CLOVER_225_0.S[5173]++;return;
}}
__CLOVER_225_0.S[5174]++;if ((((_elementName.equals("library")) && (++__CLOVER_225_0.CT[929] != 0)) || (++__CLOVER_225_0.CF[929] == 0))){
{
__CLOVER_225_0.S[5175]++;enterLibrary();
__CLOVER_225_0.S[5176]++;return;
}}
__CLOVER_225_0.S[5177]++;if ((((_elementName.equals("extension")) && (++__CLOVER_225_0.CT[930] != 0)) || (++__CLOVER_225_0.CF[930] == 0))){
{
__CLOVER_225_0.S[5178]++;enterExtension();
__CLOVER_225_0.S[5179]++;return;
}}
__CLOVER_225_0.S[5180]++;unexpectedElement(_elementName);
} finally { }}
private void beginLibrarySpecificationInitial()
{try { __CLOVER_225_0.M[1118]++;
__CLOVER_225_0.S[5181]++;expectElement("library-specification");
__CLOVER_225_0.S[5182]++;ILibrarySpecification ls = _factory.createLibrarySpecification();
__CLOVER_225_0.S[5183]++;_rootObject = ls;
__CLOVER_225_0.S[5184]++;push(_elementName, ls, STATE_LIBRARY_SPECIFICATION);
} finally { }}
private void beginPageSpecification()
{try { __CLOVER_225_0.M[1119]++;
__CLOVER_225_0.S[5185]++;if ((((_elementName.equals("component")) && (++__CLOVER_225_0.CT[931] != 0)) || (++__CLOVER_225_0.CF[931] == 0))){
{
__CLOVER_225_0.S[5186]++;enterComponent();
__CLOVER_225_0.S[5187]++;return;
}}
__CLOVER_225_0.S[5188]++;if ((((_elementName.equals("bean")) && (++__CLOVER_225_0.CT[932] != 0)) || (++__CLOVER_225_0.CF[932] == 0))){
{
__CLOVER_225_0.S[5189]++;enterBean();
__CLOVER_225_0.S[5190]++;return;
}}
__CLOVER_225_0.S[5191]++;if ((((_elementName.equals("property-specification")) && (++__CLOVER_225_0.CT[933] != 0)) || (++__CLOVER_225_0.CF[933] == 0))){
{
__CLOVER_225_0.S[5192]++;enterPropertySpecification();
__CLOVER_225_0.S[5193]++;return;
}}
__CLOVER_225_0.S[5194]++;if ((((_elementName.equals("context-asset")) && (++__CLOVER_225_0.CT[934] != 0)) || (++__CLOVER_225_0.CF[934] == 0))){
{
__CLOVER_225_0.S[5195]++;enterContextAsset();
__CLOVER_225_0.S[5196]++;return;
}}
__CLOVER_225_0.S[5197]++;if ((((_elementName.equals("private-asset")) && (++__CLOVER_225_0.CT[935] != 0)) || (++__CLOVER_225_0.CF[935] == 0))){
{
__CLOVER_225_0.S[5198]++;enterPrivateAsset();
__CLOVER_225_0.S[5199]++;return;
}}
__CLOVER_225_0.S[5200]++;if ((((_elementName.equals("external-asset")) && (++__CLOVER_225_0.CT[936] != 0)) || (++__CLOVER_225_0.CF[936] == 0))){
{
__CLOVER_225_0.S[5201]++;enterExternalAsset();
__CLOVER_225_0.S[5202]++;return;
}}
__CLOVER_225_0.S[5203]++;if ((((_elementName.equals("property")) && (++__CLOVER_225_0.CT[937] != 0)) || (++__CLOVER_225_0.CF[937] == 0))){
{
__CLOVER_225_0.S[5204]++;enterProperty();
__CLOVER_225_0.S[5205]++;return;
}}
__CLOVER_225_0.S[5206]++;if ((((_elementName.equals("description")) && (++__CLOVER_225_0.CT[938] != 0)) || (++__CLOVER_225_0.CF[938] == 0))){
{
__CLOVER_225_0.S[5207]++;enterDescription();
__CLOVER_225_0.S[5208]++;return;
}}
__CLOVER_225_0.S[5209]++;unexpectedElement(_elementName);
} finally { }}
private void beginPageSpecificationInitial()
{try { __CLOVER_225_0.M[1120]++;
__CLOVER_225_0.S[5210]++;expectElement("page-specification");
__CLOVER_225_0.S[5211]++;IComponentSpecification cs = _factory.createComponentSpecification();
__CLOVER_225_0.S[5212]++;String className = getAttribute("class");
__CLOVER_225_0.S[5213]++;if ((((className != null) && (++__CLOVER_225_0.CT[939] != 0)) || (++__CLOVER_225_0.CF[939] == 0))){
__CLOVER_225_0.S[5214]++;cs.setComponentClassName(className);}
__CLOVER_225_0.S[5215]++;cs.setSpecificationLocation(getResource());
__CLOVER_225_0.S[5216]++;cs.setPageSpecification(true);
__CLOVER_225_0.S[5217]++;_rootObject = cs;
__CLOVER_225_0.S[5218]++;push(_elementName, cs, STATE_PAGE_SPECIFICATION);
} finally { }}
/**
* Close a stream (if not null), ignoring any errors.
*/
private void close(InputStream stream)
{try { __CLOVER_225_0.M[1121]++;
__CLOVER_225_0.S[5219]++;try
{
__CLOVER_225_0.S[5220]++;if ((((stream != null) && (++__CLOVER_225_0.CT[940] != 0)) || (++__CLOVER_225_0.CF[940] == 0))){
__CLOVER_225_0.S[5221]++;stream.close();}
}
catch (IOException ex)
{
// ignore
}
} finally { }}
private void copyBindings(String sourceComponentId, IComponentSpecification cs,
IContainedComponent target)
{try { __CLOVER_225_0.M[1122]++;
__CLOVER_225_0.S[5222]++;IContainedComponent source = cs.getComponent(sourceComponentId);
__CLOVER_225_0.S[5223]++;if ((((source == null) && (++__CLOVER_225_0.CT[941] != 0)) || (++__CLOVER_225_0.CF[941] == 0))){
__CLOVER_225_0.S[5224]++;throw new DocumentParseException(ParseMessages.unableToCopy(sourceComponentId),
getLocation(), null);}
__CLOVER_225_0.S[5225]++;Iterator i = source.getBindingNames().iterator();
__CLOVER_225_0.S[5226]++;while ((((i.hasNext()) && (++__CLOVER_225_0.CT[942] != 0)) || (++__CLOVER_225_0.CF[942] == 0))){
{
__CLOVER_225_0.S[5227]++;String bindingName = (String) i.next();
__CLOVER_225_0.S[5228]++;IBindingSpecification binding = source.getBinding(bindingName);
__CLOVER_225_0.S[5229]++;target.setBinding(bindingName, binding);
}}
__CLOVER_225_0.S[5230]++;target.setType(source.getType());
} finally { }}
protected void end(String elementName)
{try { __CLOVER_225_0.M[1123]++;
__CLOVER_225_0.S[5231]++;_elementName = elementName;
__CLOVER_225_0.S[5232]++;switch (getState())
{
case STATE_DESCRIPTION:
__CLOVER_225_0.S[5233]++;endDescription();
__CLOVER_225_0.S[5234]++;break;
case STATE_PROPERTY:
__CLOVER_225_0.S[5235]++;endProperty();
__CLOVER_225_0.S[5236]++;break;
case STATE_SET_PROPERTY:
__CLOVER_225_0.S[5237]++;endSetProperty();
__CLOVER_225_0.S[5238]++;break;
case STATE_BINDING_3_0:
__CLOVER_225_0.S[5239]++;endBinding_3_0();
__CLOVER_225_0.S[5240]++;break;
case STATE_BINDING:
__CLOVER_225_0.S[5241]++;endBinding();
__CLOVER_225_0.S[5242]++;break;
case STATE_LISTENER_BINDING:
__CLOVER_225_0.S[5243]++;endListenerBinding();
__CLOVER_225_0.S[5244]++;break;
case STATE_STATIC_BINDING:
__CLOVER_225_0.S[5245]++;endStaticBinding();
__CLOVER_225_0.S[5246]++;break;
case STATE_PROPERTY_SPECIFICATION:
__CLOVER_225_0.S[5247]++;endPropertySpecification();
__CLOVER_225_0.S[5248]++;break;
case STATE_LIBRARY_SPECIFICATION:
__CLOVER_225_0.S[5249]++;endLibrarySpecification();
__CLOVER_225_0.S[5250]++;break;
case STATE_CONFIGURE:
__CLOVER_225_0.S[5251]++;endConfigure();
__CLOVER_225_0.S[5252]++;break;
default:
__CLOVER_225_0.S[5253]++;break;
}
// Pop the top element of the stack and continue processing from there.
__CLOVER_225_0.S[5254]++;pop();
} finally { }}
private void endBinding_3_0()
{try { __CLOVER_225_0.M[1124]++;
__CLOVER_225_0.S[5255]++;BindingSetter bs = (BindingSetter) peekObject();
__CLOVER_225_0.S[5256]++;String expression = getExtendedValue(bs.getValue(), "expression", true);
__CLOVER_225_0.S[5257]++;IBindingSpecification spec = _factory.createBindingSpecification();
__CLOVER_225_0.S[5258]++;spec.setType(BindingType.PREFIXED);
__CLOVER_225_0.S[5259]++;spec.setValue("ognl:" + expression);
__CLOVER_225_0.S[5260]++;bs.apply(spec);
} finally { }}
private void endConfigure()
{try { __CLOVER_225_0.M[1125]++;
__CLOVER_225_0.S[5261]++;ExtensionConfigurationSetter setter = (ExtensionConfigurationSetter) peekObject();
__CLOVER_225_0.S[5262]++;String finalValue = getExtendedValue(setter.getValue(), "value", true);
__CLOVER_225_0.S[5263]++;setter.apply(finalValue);
} finally { }}
private void endDescription()
{try { __CLOVER_225_0.M[1126]++;
__CLOVER_225_0.S[5264]++;DescriptionSetter setter = (DescriptionSetter) peekObject();
__CLOVER_225_0.S[5265]++;String description = peekContent();
__CLOVER_225_0.S[5266]++;setter.apply(description);
} finally { }}
private void endLibrarySpecification()
{try { __CLOVER_225_0.M[1127]++;
__CLOVER_225_0.S[5267]++;ILibrarySpecification spec = (ILibrarySpecification) peekObject();
__CLOVER_225_0.S[5268]++;spec.setResourceResolver(_resolver);
__CLOVER_225_0.S[5269]++;spec.setSpecificationLocation(getResource());
__CLOVER_225_0.S[5270]++;spec.instantiateImmediateExtensions();
} finally { }}
private void endListenerBinding()
{try { __CLOVER_225_0.M[1128]++;
__CLOVER_225_0.S[5271]++;BindingSetter bs = (BindingSetter) peekObject();
__CLOVER_225_0.S[5272]++;IListenerBindingSpecification lbs = _factory.createListenerBindingSpecification();
__CLOVER_225_0.S[5273]++;lbs.setLanguage(bs.getValue());
// Do we need a check for no body content?
__CLOVER_225_0.S[5274]++;lbs.setValue(peekContent());
__CLOVER_225_0.S[5275]++;lbs.setLocation(getLocation());
__CLOVER_225_0.S[5276]++;bs.apply(lbs);
} finally { }}
private void endProperty()
{try { __CLOVER_225_0.M[1129]++;
__CLOVER_225_0.S[5277]++;PropertyValueSetter pvs = (PropertyValueSetter) peekObject();
__CLOVER_225_0.S[5278]++;String finalValue = getExtendedValue(pvs.getPropertyValue(), "value", true);
__CLOVER_225_0.S[5279]++;pvs.applyValue(finalValue);
} finally { }}
private void endPropertySpecification()
{try { __CLOVER_225_0.M[1130]++;
__CLOVER_225_0.S[5280]++;IPropertySpecification ps = (IPropertySpecification) peekObject();
__CLOVER_225_0.S[5281]++;String initialValue = getExtendedValue(ps.getInitialValue(), "initial-value", false);
__CLOVER_225_0.S[5282]++;ps.setInitialValue(initialValue);
} finally { }}
private void endSetProperty()
{try { __CLOVER_225_0.M[1131]++;
__CLOVER_225_0.S[5283]++;BeanSetPropertySetter bs = (BeanSetPropertySetter) peekObject();
__CLOVER_225_0.S[5284]++;String finalValue = getExtendedValue(bs.getExpression(), "expression", true);
__CLOVER_225_0.S[5285]++;bs.applyExpression(finalValue);
} finally { }}
private void endStaticBinding()
{try { __CLOVER_225_0.M[1132]++;
__CLOVER_225_0.S[5286]++;BindingSetter bs = (BindingSetter) peekObject();
__CLOVER_225_0.S[5287]++;String literalValue = getExtendedValue(bs.getValue(), "value", true);
__CLOVER_225_0.S[5288]++;IBindingSpecification spec = _factory.createBindingSpecification();
__CLOVER_225_0.S[5289]++;spec.setType(BindingType.PREFIXED);
__CLOVER_225_0.S[5290]++;spec.setValue("literal:" + literalValue);
__CLOVER_225_0.S[5291]++;bs.apply(spec);
} finally { }}
private void enterAsset(String pathAttributeName, AssetType type)
{try { __CLOVER_225_0.M[1133]++;
__CLOVER_225_0.S[5292]++;String name = getValidatedAttribute("name", ASSET_NAME_PATTERN, "invalid-asset-name");
__CLOVER_225_0.S[5293]++;String path = getAttribute(pathAttributeName);
__CLOVER_225_0.S[5294]++;IAssetSpecification ia = _factory.createAssetSpecification();
__CLOVER_225_0.S[5295]++;ia.setType(type);
__CLOVER_225_0.S[5296]++;ia.setPath(path);
__CLOVER_225_0.S[5297]++;IComponentSpecification cs = (IComponentSpecification) peekObject();
__CLOVER_225_0.S[5298]++;cs.addAsset(name, ia);
__CLOVER_225_0.S[5299]++;push(_elementName, ia, STATE_ALLOW_PROPERTY);
} finally { }}
private void enterBean()
{try { __CLOVER_225_0.M[1134]++;
__CLOVER_225_0.S[5300]++;String name = getValidatedAttribute("name", BEAN_NAME_PATTERN, "invalid-bean-name");
__CLOVER_225_0.S[5301]++;String className = getAttribute("class");
__CLOVER_225_0.S[5302]++;BeanLifecycle lifecycle = (BeanLifecycle) getConvertedAttribute(
"lifecycle",
BeanLifecycle.REQUEST);
__CLOVER_225_0.S[5303]++;IBeanSpecification bs = _factory.createBeanSpecification();
__CLOVER_225_0.S[5304]++;bs.setClassName(className);
__CLOVER_225_0.S[5305]++;bs.setLifecycle(lifecycle);
__CLOVER_225_0.S[5306]++;IComponentSpecification cs = (IComponentSpecification) peekObject();
__CLOVER_225_0.S[5307]++;cs.addBeanSpecification(name, bs);
__CLOVER_225_0.S[5308]++;push(_elementName, bs, STATE_BEAN);
} finally { }}
private void enterBinding()
{try { __CLOVER_225_0.M[1135]++;
__CLOVER_225_0.S[5309]++;if ((((!_DTD_3_1) && (++__CLOVER_225_0.CT[943] != 0)) || (++__CLOVER_225_0.CF[943] == 0))){
{
__CLOVER_225_0.S[5310]++;enterBinding_3_0();
__CLOVER_225_0.S[5311]++;return;
}}
// 3.1 stuff
__CLOVER_225_0.S[5312]++;String name = getValidatedAttribute(
"name",
PARAMETER_NAME_PATTERN,
"invalid-parameter-name");
__CLOVER_225_0.S[5313]++;String value = getAttribute("value");
__CLOVER_225_0.S[5314]++;IContainedComponent cc = (IContainedComponent) peekObject();
__CLOVER_225_0.S[5315]++;BindingSetter bs = new BindingSetter(cc, name, value);
__CLOVER_225_0.S[5316]++;push(_elementName, bs, STATE_BINDING, false);
} finally { }}
private void endBinding()
{try { __CLOVER_225_0.M[1136]++;
__CLOVER_225_0.S[5317]++;BindingSetter bs = (BindingSetter) peekObject();
__CLOVER_225_0.S[5318]++;String value = getExtendedValue(bs.getValue(), "value", true);
__CLOVER_225_0.S[5319]++;IBindingSpecification spec = _factory.createBindingSpecification();
__CLOVER_225_0.S[5320]++;spec.setType(BindingType.PREFIXED);
__CLOVER_225_0.S[5321]++;spec.setValue(value);
__CLOVER_225_0.S[5322]++;bs.apply(spec);
} finally { }}
/**
* Handles a binding in a 3.0 DTD.
*/
private void enterBinding_3_0()
{try { __CLOVER_225_0.M[1137]++;
__CLOVER_225_0.S[5323]++;String name = getAttribute("name");
__CLOVER_225_0.S[5324]++;String expression = getAttribute("expression");
__CLOVER_225_0.S[5325]++;IContainedComponent cc = (IContainedComponent) peekObject();
__CLOVER_225_0.S[5326]++;BindingSetter bs = new BindingSetter(cc, name, expression);
__CLOVER_225_0.S[5327]++;push(_elementName, bs, STATE_BINDING_3_0, false);
} finally { }}
private void enterComponent()
{try { __CLOVER_225_0.M[1138]++;
__CLOVER_225_0.S[5328]++;String id = getValidatedAttribute("id", COMPONENT_ID_PATTERN, "invalid-component-id");
__CLOVER_225_0.S[5329]++;String type = getValidatedAttribute(
"type",
COMPONENT_TYPE_PATTERN,
"invalid-component-type");
__CLOVER_225_0.S[5330]++;String copyOf = getAttribute("copy-of");
__CLOVER_225_0.S[5331]++;boolean inherit = getBooleanAttribute("inherit-informal-parameters", false);
// Check that either copy-of or type, but not both
__CLOVER_225_0.S[5332]++;boolean hasCopyOf = Tapestry.isNonBlank(copyOf);
__CLOVER_225_0.S[5333]++;if ((((hasCopyOf) && (++__CLOVER_225_0.CT[944] != 0)) || (++__CLOVER_225_0.CF[944] == 0))){
{
__CLOVER_225_0.S[5334]++;if ((((Tapestry.isNonBlank(type)) && (++__CLOVER_225_0.CT[945] != 0)) || (++__CLOVER_225_0.CF[945] == 0))){
__CLOVER_225_0.S[5335]++;throw new DocumentParseException(ParseMessages.bothTypeAndCopyOf(id),
getLocation(), null);}
}}
else{
{
__CLOVER_225_0.S[5336]++;if ((((Tapestry.isBlank(type)) && (++__CLOVER_225_0.CT[946] != 0)) || (++__CLOVER_225_0.CF[946] == 0))){
__CLOVER_225_0.S[5337]++;throw new DocumentParseException(ParseMessages.missingTypeOrCopyOf(id),
getLocation(), null);}
}}
__CLOVER_225_0.S[5338]++;IContainedComponent cc = _factory.createContainedComponent();
__CLOVER_225_0.S[5339]++;cc.setType(type);
__CLOVER_225_0.S[5340]++;cc.setCopyOf(copyOf);
__CLOVER_225_0.S[5341]++;cc.setInheritInformalParameters(inherit);
__CLOVER_225_0.S[5342]++;IComponentSpecification cs = (IComponentSpecification) peekObject();
__CLOVER_225_0.S[5343]++;cs.addComponent(id, cc);
__CLOVER_225_0.S[5344]++;if ((((hasCopyOf) && (++__CLOVER_225_0.CT[947] != 0)) || (++__CLOVER_225_0.CF[947] == 0))){
__CLOVER_225_0.S[5345]++;copyBindings(copyOf, cs, cc);}
__CLOVER_225_0.S[5346]++;push(_elementName, cc, STATE_COMPONENT);
} finally { }}
private void enterComponentType()
{try { __CLOVER_225_0.M[1139]++;
__CLOVER_225_0.S[5347]++;String type = getValidatedAttribute(
"type",
COMPONENT_ALIAS_PATTERN,
"invalid-component-type");
__CLOVER_225_0.S[5348]++;String path = getAttribute("specification-path");
__CLOVER_225_0.S[5349]++;ILibrarySpecification ls = (ILibrarySpecification) peekObject();
__CLOVER_225_0.S[5350]++;ls.setComponentSpecificationPath(type, path);
__CLOVER_225_0.S[5351]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterConfigure()
{try { __CLOVER_225_0.M[1140]++;
__CLOVER_225_0.S[5352]++;String propertyName = getValidatedAttribute(
"property-name",
PROPERTY_NAME_PATTERN,
"invalid-property-name");
__CLOVER_225_0.S[5353]++;String value = getAttribute("value");
__CLOVER_225_0.S[5354]++;IExtensionSpecification es = (IExtensionSpecification) peekObject();
__CLOVER_225_0.S[5355]++;ExtensionConfigurationSetter setter = new ExtensionConfigurationSetter(es, propertyName,
value);
__CLOVER_225_0.S[5356]++;push(_elementName, setter, STATE_CONFIGURE, false);
} finally { }}
private void enterContextAsset()
{try { __CLOVER_225_0.M[1141]++;
__CLOVER_225_0.S[5357]++;enterAsset("path", AssetType.CONTEXT);
} finally { }}
private void enterDescription()
{try { __CLOVER_225_0.M[1142]++;
__CLOVER_225_0.S[5358]++;push(_elementName, new DescriptionSetter(peekObject()), STATE_DESCRIPTION, false);
} finally { }}
private void enterExtension()
{try { __CLOVER_225_0.M[1143]++;
__CLOVER_225_0.S[5359]++;String name = getValidatedAttribute(
"name",
EXTENSION_NAME_PATTERN,
"invalid-extension-name");
__CLOVER_225_0.S[5360]++;boolean immediate = getBooleanAttribute("immediate", false);
__CLOVER_225_0.S[5361]++;String className = getAttribute("class");
__CLOVER_225_0.S[5362]++;IExtensionSpecification es = _factory.createExtensionSpecification();
__CLOVER_225_0.S[5363]++;es.setClassName(className);
__CLOVER_225_0.S[5364]++;es.setImmediate(immediate);
__CLOVER_225_0.S[5365]++;ILibrarySpecification ls = (ILibrarySpecification) peekObject();
__CLOVER_225_0.S[5366]++;ls.addExtensionSpecification(name, es);
__CLOVER_225_0.S[5367]++;push(_elementName, es, STATE_EXTENSION);
} finally { }}
private void enterExternalAsset()
{try { __CLOVER_225_0.M[1144]++;
__CLOVER_225_0.S[5368]++;enterAsset("URL", AssetType.EXTERNAL);
} finally { }}
private void enterInheritedBinding()
{try { __CLOVER_225_0.M[1145]++;
__CLOVER_225_0.S[5369]++;String name = getAttribute("name");
__CLOVER_225_0.S[5370]++;String parameterName = getAttribute("parameter-name");
__CLOVER_225_0.S[5371]++;IBindingSpecification bs = _factory.createBindingSpecification();
__CLOVER_225_0.S[5372]++;bs.setType(BindingType.INHERITED);
__CLOVER_225_0.S[5373]++;bs.setValue(parameterName);
__CLOVER_225_0.S[5374]++;IContainedComponent cc = (IContainedComponent) peekObject();
__CLOVER_225_0.S[5375]++;cc.setBinding(name, bs);
__CLOVER_225_0.S[5376]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterLibrary()
{try { __CLOVER_225_0.M[1146]++;
__CLOVER_225_0.S[5377]++;String libraryId = getValidatedAttribute("id", LIBRARY_ID_PATTERN, "invalid-library-id");
__CLOVER_225_0.S[5378]++;String path = getAttribute("specification-path");
__CLOVER_225_0.S[5379]++;if ((((libraryId.equals(INamespace.FRAMEWORK_NAMESPACE)) && (++__CLOVER_225_0.CT[948] != 0)) || (++__CLOVER_225_0.CF[948] == 0))){
__CLOVER_225_0.S[5380]++;throw new DocumentParseException(ParseMessages
.frameworkLibraryIdIsReserved(INamespace.FRAMEWORK_NAMESPACE), getLocation(),
null);}
__CLOVER_225_0.S[5381]++;ILibrarySpecification ls = (ILibrarySpecification) peekObject();
__CLOVER_225_0.S[5382]++;ls.setLibrarySpecificationPath(libraryId, path);
__CLOVER_225_0.S[5383]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterListenerBinding()
{try { __CLOVER_225_0.M[1147]++;
__CLOVER_225_0.S[5384]++;String name = getAttribute("name");
__CLOVER_225_0.S[5385]++;String language = getAttribute("language");
__CLOVER_225_0.S[5386]++;IContainedComponent cc = (IContainedComponent) peekObject();
__CLOVER_225_0.S[5387]++;BindingSetter bs = new BindingSetter(cc, name, language);
__CLOVER_225_0.S[5388]++;push(_elementName, bs, STATE_LISTENER_BINDING, false);
} finally { }}
private void enterMessageBinding()
{try { __CLOVER_225_0.M[1148]++;
__CLOVER_225_0.S[5389]++;String name = getAttribute("name");
__CLOVER_225_0.S[5390]++;String key = getAttribute("key");
__CLOVER_225_0.S[5391]++;IBindingSpecification bs = _factory.createBindingSpecification();
__CLOVER_225_0.S[5392]++;bs.setType(BindingType.PREFIXED);
__CLOVER_225_0.S[5393]++;bs.setValue("message:" + key);
__CLOVER_225_0.S[5394]++;bs.setLocation(getLocation());
__CLOVER_225_0.S[5395]++;IContainedComponent cc = (IContainedComponent) peekObject();
__CLOVER_225_0.S[5396]++;cc.setBinding(name, bs);
__CLOVER_225_0.S[5397]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterPage()
{try { __CLOVER_225_0.M[1149]++;
__CLOVER_225_0.S[5398]++;String name = getValidatedAttribute("name", PAGE_NAME_PATTERN, "invalid-page-name");
__CLOVER_225_0.S[5399]++;String path = getAttribute("specification-path");
__CLOVER_225_0.S[5400]++;ILibrarySpecification ls = (ILibrarySpecification) peekObject();
__CLOVER_225_0.S[5401]++;ls.setPageSpecificationPath(name, path);
__CLOVER_225_0.S[5402]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterParameter()
{try { __CLOVER_225_0.M[1150]++;
__CLOVER_225_0.S[5403]++;IParameterSpecification ps = _factory.createParameterSpecification();
__CLOVER_225_0.S[5404]++;String name = getValidatedAttribute(
"name",
PARAMETER_NAME_PATTERN,
"invalid-parameter-name");
__CLOVER_225_0.S[5405]++;String propertyName = getValidatedAttribute(
"property-name",
PROPERTY_NAME_PATTERN,
"invalid-property-name");
__CLOVER_225_0.S[5406]++;if ((((propertyName == null) && (++__CLOVER_225_0.CT[949] != 0)) || (++__CLOVER_225_0.CF[949] == 0))){
__CLOVER_225_0.S[5407]++;propertyName = name;}
__CLOVER_225_0.S[5408]++;ps.setPropertyName(propertyName);
__CLOVER_225_0.S[5409]++;ps.setRequired(getBooleanAttribute("required", false));
__CLOVER_225_0.S[5410]++;ps.setDefaultValue(getAttribute("default-value"));
__CLOVER_225_0.S[5411]++;ps.setDirection((Direction) getConvertedAttribute("direction", Direction.CUSTOM));
__CLOVER_225_0.S[5412]++;String type = getAttribute("type"); // Current, 3.0+ DTD
__CLOVER_225_0.S[5413]++;if ((((type != null) && (++__CLOVER_225_0.CT[950] != 0)) || (++__CLOVER_225_0.CF[950] == 0))){
__CLOVER_225_0.S[5414]++;ps.setType(type);}
__CLOVER_225_0.S[5415]++;IComponentSpecification cs = (IComponentSpecification) peekObject();
__CLOVER_225_0.S[5416]++;cs.addParameter(name, ps);
__CLOVER_225_0.S[5417]++;push(_elementName, ps, STATE_ALLOW_DESCRIPTION);
} finally { }}
private void enterPrivateAsset()
{try { __CLOVER_225_0.M[1151]++;
__CLOVER_225_0.S[5418]++;enterAsset("resource-path", AssetType.PRIVATE);
} finally { }}
private void enterProperty()
{try { __CLOVER_225_0.M[1152]++;
__CLOVER_225_0.S[5419]++;String name = getAttribute("name");
__CLOVER_225_0.S[5420]++;String value = getAttribute("value");
// Value may be null, in which case the value is set from the element content
__CLOVER_225_0.S[5421]++;IPropertyHolder ph = (IPropertyHolder) peekObject();
__CLOVER_225_0.S[5422]++;push(_elementName, new PropertyValueSetter(ph, name, value), STATE_PROPERTY, false);
} finally { }}
private void enterPropertySpecification()
{try { __CLOVER_225_0.M[1153]++;
__CLOVER_225_0.S[5423]++;String name = getValidatedAttribute("name", PROPERTY_NAME_PATTERN, "invalid-property-name");
__CLOVER_225_0.S[5424]++;String type = getAttribute("type");
__CLOVER_225_0.S[5425]++;boolean persistent = getBooleanAttribute("persistent", false);
__CLOVER_225_0.S[5426]++;String initialValue = getAttribute("initial-value");
__CLOVER_225_0.S[5427]++;IPropertySpecification ps = _factory.createPropertySpecification();
__CLOVER_225_0.S[5428]++;ps.setName(name);
__CLOVER_225_0.S[5429]++;if ((((Tapestry.isNonBlank(type)) && (++__CLOVER_225_0.CT[951] != 0)) || (++__CLOVER_225_0.CF[951] == 0))){
__CLOVER_225_0.S[5430]++;ps.setType(type);}
__CLOVER_225_0.S[5431]++;ps.setPersistent(persistent);
__CLOVER_225_0.S[5432]++;ps.setInitialValue(initialValue);
__CLOVER_225_0.S[5433]++;IComponentSpecification cs = (IComponentSpecification) peekObject();
__CLOVER_225_0.S[5434]++;cs.addPropertySpecification(ps);
__CLOVER_225_0.S[5435]++;push(_elementName, ps, STATE_PROPERTY_SPECIFICATION, false);
} finally { }}
private void enterReservedParameter()
{try { __CLOVER_225_0.M[1154]++;
__CLOVER_225_0.S[5436]++;String name = getAttribute("name");
__CLOVER_225_0.S[5437]++;IComponentSpecification cs = (IComponentSpecification) peekObject();
__CLOVER_225_0.S[5438]++;cs.addReservedParameterName(name);
__CLOVER_225_0.S[5439]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterService()
{try { __CLOVER_225_0.M[1155]++;
__CLOVER_225_0.S[5440]++;_errorHandler.error(_log, ParseMessages.serviceElementNotSupported(), getLocation(), null);
__CLOVER_225_0.S[5441]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterSetMessage()
{try { __CLOVER_225_0.M[1156]++;
__CLOVER_225_0.S[5442]++;String name = getAttribute("name");
__CLOVER_225_0.S[5443]++;String key = getAttribute("key");
__CLOVER_225_0.S[5444]++;IBeanInitializer bi = _factory.createMessageBeanInitializer();
__CLOVER_225_0.S[5445]++;PropertyUtils.write(bi, "propertyName", name);
__CLOVER_225_0.S[5446]++;PropertyUtils.write(bi, "key", key);
__CLOVER_225_0.S[5447]++;bi.setLocation(getLocation());
__CLOVER_225_0.S[5448]++;IBeanSpecification bs = (IBeanSpecification) peekObject();
__CLOVER_225_0.S[5449]++;bs.addInitializer(bi);
__CLOVER_225_0.S[5450]++;push(_elementName, null, STATE_NO_CONTENT);
} finally { }}
private void enterSetProperty()
{try { __CLOVER_225_0.M[1157]++;
__CLOVER_225_0.S[5451]++;String name = getAttribute("name");
__CLOVER_225_0.S[5452]++;String expression = getAttribute("expression");
__CLOVER_225_0.S[5453]++;IBeanInitializer bi = _factory.createExpressionBeanInitializer();
__CLOVER_225_0.S[5454]++;PropertyUtils.write(bi, "propertyName", name);
__CLOVER_225_0.S[5455]++;IBeanSpecification bs = (IBeanSpecification) peekObject();
__CLOVER_225_0.S[5456]++;push(_elementName, new BeanSetPropertySetter(bs, bi, expression), STATE_SET_PROPERTY, false);
} finally { }}
private void enterStaticBinding()
{try { __CLOVER_225_0.M[1158]++;
__CLOVER_225_0.S[5457]++;String name = getAttribute("name");
__CLOVER_225_0.S[5458]++;String expression = getAttribute("value");
__CLOVER_225_0.S[5459]++;IContainedComponent cc = (IContainedComponent) peekObject();
__CLOVER_225_0.S[5460]++;BindingSetter bs = new BindingSetter(cc, name, expression);
__CLOVER_225_0.S[5461]++;push(_elementName, bs, STATE_STATIC_BINDING, false);
} finally { }}
private void expectElement(String elementName)
{try { __CLOVER_225_0.M[1159]++;
__CLOVER_225_0.S[5462]++;if ((((_elementName.equals(elementName)) && (++__CLOVER_225_0.CT[952] != 0)) || (++__CLOVER_225_0.CF[952] == 0))){
__CLOVER_225_0.S[5463]++;return;}
__CLOVER_225_0.S[5464]++;throw new DocumentParseException(ParseMessages.incorrectDocumentType(
_elementName,
elementName), getLocation(), null);
} finally { }}
private String getAttribute(String name)
{try { __CLOVER_225_0.M[1160]++;
__CLOVER_225_0.S[5465]++;return (String) _attributes.get(name);
} finally { }}
private boolean getBooleanAttribute(String name, boolean defaultValue)
{try { __CLOVER_225_0.M[1161]++;
__CLOVER_225_0.S[5466]++;String value = getAttribute(name);
__CLOVER_225_0.S[5467]++;if ((((value == null) && (++__CLOVER_225_0.CT[953] != 0)) || (++__CLOVER_225_0.CF[953] == 0))){
__CLOVER_225_0.S[5468]++;return defaultValue;}
__CLOVER_225_0.S[5469]++;return value.equals("yes");
} finally { }}
private Object getConvertedAttribute(String name, Object defaultValue)
{try { __CLOVER_225_0.M[1162]++;
__CLOVER_225_0.S[5470]++;String key = getAttribute(name);
__CLOVER_225_0.S[5471]++;if ((((key == null) && (++__CLOVER_225_0.CT[954] != 0)) || (++__CLOVER_225_0.CF[954] == 0))){
__CLOVER_225_0.S[5472]++;return defaultValue;}
__CLOVER_225_0.S[5473]++;return CONVERSION_MAP.get(key);
} finally { }}
private InputSource getDTDInputSource(String name)
{try { __CLOVER_225_0.M[1163]++;
__CLOVER_225_0.S[5474]++;InputStream stream = getClass().getResourceAsStream(name);
__CLOVER_225_0.S[5475]++;return new InputSource(stream);
} finally { }}
private String getExtendedValue(String attributeValue, String attributeName, boolean required)
{try { __CLOVER_225_0.M[1164]++;
__CLOVER_225_0.S[5476]++;String contentValue = peekContent();
__CLOVER_225_0.S[5477]++;boolean asAttribute = Tapestry.isNonBlank(attributeValue);
__CLOVER_225_0.S[5478]++;boolean asContent = Tapestry.isNonBlank(contentValue);
__CLOVER_225_0.S[5479]++;if ((((asAttribute && asContent) && (++__CLOVER_225_0.CT[955] != 0)) || (++__CLOVER_225_0.CF[955] == 0))){
{
__CLOVER_225_0.S[5480]++;throw new DocumentParseException(ParseMessages.noAttributeAndBody(
attributeName,
_elementName), getLocation(), null);
}}
__CLOVER_225_0.S[5481]++;if ((((required && !(asAttribute || asContent)) && (++__CLOVER_225_0.CT[956] != 0)) || (++__CLOVER_225_0.CF[956] == 0))){
{
__CLOVER_225_0.S[5482]++;throw new DocumentParseException(ParseMessages.requiredExtendedAttribute(
_elementName,
attributeName), getLocation(), null);
}}
__CLOVER_225_0.S[5483]++;if ((((asAttribute) && (++__CLOVER_225_0.CT[957] != 0)) || (++__CLOVER_225_0.CF[957] == 0))){
__CLOVER_225_0.S[5484]++;return attributeValue;}
__CLOVER_225_0.S[5485]++;return contentValue;
} finally { }}
private String getValidatedAttribute(String name, String pattern, String errorKey)
{try { __CLOVER_225_0.M[1165]++;
__CLOVER_225_0.S[5486]++;String value = getAttribute(name);
__CLOVER_225_0.S[5487]++;if ((((value == null) && (++__CLOVER_225_0.CT[958] != 0)) || (++__CLOVER_225_0.CF[958] == 0))){
__CLOVER_225_0.S[5488]++;return null;}
__CLOVER_225_0.S[5489]++;if ((((_matcher.matches(pattern, value)) && (++__CLOVER_225_0.CT[959] != 0)) || (++__CLOVER_225_0.CF[959] == 0))){
__CLOVER_225_0.S[5490]++;return value;}
__CLOVER_225_0.S[5491]++;throw new InvalidStringException(ParseMessages.invalidAttribute(errorKey, value), value,
getLocation());
} finally { }}
protected void initializeParser(Resource resource, int startState)
{try { __CLOVER_225_0.M[1166]++;
__CLOVER_225_0.S[5492]++;super.initializeParser(resource, startState);
__CLOVER_225_0.S[5493]++;_rootObject = null;
__CLOVER_225_0.S[5494]++;_attributes = new HashMap();
} finally { }}
public IApplicationSpecification parseApplicationSpecification(Resource resource)
{try { __CLOVER_225_0.M[1167]++;
__CLOVER_225_0.S[5495]++;initializeParser(resource, STATE_APPLICATION_SPECIFICATION_INITIAL);
__CLOVER_225_0.S[5496]++;try
{
__CLOVER_225_0.S[5497]++;parseDocument();
__CLOVER_225_0.S[5498]++;return (IApplicationSpecification) _rootObject;
}
finally
{
__CLOVER_225_0.S[5499]++;resetParser();
}
} finally { }}
public IComponentSpecification parseComponentSpecification(Resource resource)
{try { __CLOVER_225_0.M[1168]++;
__CLOVER_225_0.S[5500]++;initializeParser(resource, STATE_COMPONENT_SPECIFICATION_INITIAL);
__CLOVER_225_0.S[5501]++;try
{
__CLOVER_225_0.S[5502]++;parseDocument();
__CLOVER_225_0.S[5503]++;return (IComponentSpecification) _rootObject;
}
finally
{
__CLOVER_225_0.S[5504]++;resetParser();
}
} finally { }}
private void parseDocument()
{try { __CLOVER_225_0.M[1169]++;
__CLOVER_225_0.S[5505]++;InputStream stream = null;
__CLOVER_225_0.S[5506]++;Resource resource = getResource();
__CLOVER_225_0.S[5507]++;boolean success = false;
__CLOVER_225_0.S[5508]++;try
{
__CLOVER_225_0.S[5509]++;if ((((_parser == null) && (++__CLOVER_225_0.CT[960] != 0)) || (++__CLOVER_225_0.CF[960] == 0))){
__CLOVER_225_0.S[5510]++;_parser = _parserFactory.newSAXParser();}
__CLOVER_225_0.S[5511]++;URL resourceURL = resource.getResourceURL();
__CLOVER_225_0.S[5512]++;if ((((resourceURL == null) && (++__CLOVER_225_0.CT[961] != 0)) || (++__CLOVER_225_0.CF[961] == 0))){
__CLOVER_225_0.S[5513]++;throw new DocumentParseException(ParseMessages.missingResource(resource), resource);}
__CLOVER_225_0.S[5514]++;InputStream rawStream = resourceURL.openStream();
__CLOVER_225_0.S[5515]++;stream = new BufferedInputStream(rawStream);
__CLOVER_225_0.S[5516]++;_parser.parse(stream, this, resourceURL.toExternalForm());
__CLOVER_225_0.S[5517]++;stream.close();
__CLOVER_225_0.S[5518]++;stream = null;
__CLOVER_225_0.S[5519]++;success = true;
}
catch (Exception ex)
{
__CLOVER_225_0.S[5520]++;_parser = null;
__CLOVER_225_0.S[5521]++;throw new DocumentParseException(ParseMessages.errorReadingResource(resource, ex),
resource, ex);
}
finally
{
__CLOVER_225_0.S[5522]++;if ((((!success) && (++__CLOVER_225_0.CT[962] != 0)) || (++__CLOVER_225_0.CF[962] == 0))){
__CLOVER_225_0.S[5523]++;_parser = null;}
__CLOVER_225_0.S[5524]++;close(stream);
}
} finally { }}
public ILibrarySpecification parseLibrarySpecification(Resource resource)
{try { __CLOVER_225_0.M[1170]++;
__CLOVER_225_0.S[5525]++;initializeParser(resource, STATE_LIBRARY_SPECIFICATION_INITIAL);
__CLOVER_225_0.S[5526]++;try
{
__CLOVER_225_0.S[5527]++;parseDocument();
__CLOVER_225_0.S[5528]++;return (ILibrarySpecification) _rootObject;
}
finally
{
__CLOVER_225_0.S[5529]++;resetParser();
}
} finally { }}
public IComponentSpecification parsePageSpecification(Resource resource)
{try { __CLOVER_225_0.M[1171]++;
__CLOVER_225_0.S[5530]++;initializeParser(resource, STATE_PAGE_SPECIFICATION_INITIAL);
__CLOVER_225_0.S[5531]++;try
{
__CLOVER_225_0.S[5532]++;parseDocument();
__CLOVER_225_0.S[5533]++;return (IComponentSpecification) _rootObject;
}
finally
{
__CLOVER_225_0.S[5534]++;resetParser();
}
} finally { }}
protected String peekContent()
{try { __CLOVER_225_0.M[1172]++;
__CLOVER_225_0.S[5535]++;String content = super.peekContent();
__CLOVER_225_0.S[5536]++;if ((((content == null) && (++__CLOVER_225_0.CT[963] != 0)) || (++__CLOVER_225_0.CF[963] == 0))){
__CLOVER_225_0.S[5537]++;return null;}
__CLOVER_225_0.S[5538]++;return content.trim();
} finally { }}
protected void resetParser()
{try { __CLOVER_225_0.M[1173]++;
__CLOVER_225_0.S[5539]++;_rootObject = null;
__CLOVER_225_0.S[5540]++;_DTD_3_1 = false;
__CLOVER_225_0.S[5541]++;_attributes.clear();
} finally { }}
/**
* Resolved an external entity, which is assumed to be the doctype. Might need a check to ensure
* that specs without a doctype fail.
*/
public InputSource resolveEntity(String publicId, String systemId) throws SAXException
{try { __CLOVER_225_0.M[1174]++;
__CLOVER_225_0.S[5542]++;if ((((TAPESTRY_DTD_3_1_PUBLIC_ID.equals(publicId)) && (++__CLOVER_225_0.CT[964] != 0)) || (++__CLOVER_225_0.CF[964] == 0))){
{
__CLOVER_225_0.S[5543]++;_DTD_3_1 = true;
__CLOVER_225_0.S[5544]++;return getDTDInputSource("Tapestry_3_1.dtd");
}}
__CLOVER_225_0.S[5545]++;if ((((TAPESTRY_DTD_3_0_PUBLIC_ID.equals(publicId)) && (++__CLOVER_225_0.CT[965] != 0)) || (++__CLOVER_225_0.CF[965] == 0))){
__CLOVER_225_0.S[5546]++;return getDTDInputSource("Tapestry_3_0.dtd");}
__CLOVER_225_0.S[5547]++;throw new DocumentParseException(ParseMessages.unknownPublicId(getResource(), publicId),
getResource());
} finally { }}
}