[30261] Provide a public implementation of ITemplateParserDelegate.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/tapestry/branches/branch-3-0@243931 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/org/apache/tapestry/engine/DefaultTemplateSource.java b/framework/src/org/apache/tapestry/engine/DefaultTemplateSource.java
index a9c79a4..44765e1 100644
--- a/framework/src/org/apache/tapestry/engine/DefaultTemplateSource.java
+++ b/framework/src/org/apache/tapestry/engine/DefaultTemplateSource.java
@@ -104,47 +104,6 @@
private ITemplateSourceDelegate _delegate;
- private static class ParserDelegate implements ITemplateParserDelegate
- {
- private IComponent _component;
- private ComponentSpecificationResolver _resolver;
- private IRequestCycle _cycle;
-
- ParserDelegate(IComponent component, IRequestCycle cycle)
- {
- _component = component;
- _resolver = new ComponentSpecificationResolver(cycle);
- _cycle = cycle;
- }
-
- public boolean getKnownComponent(String componentId)
- {
- return _component.getSpecification().getComponent(componentId) != null;
- }
-
- public boolean getAllowBody(String componentId, ILocation location)
- {
- IComponent embedded = _component.getComponent(componentId);
-
- if (embedded == null)
- throw Tapestry.createNoSuchComponentException(_component, componentId, location);
-
- return embedded.getSpecification().getAllowBody();
- }
-
- public boolean getAllowBody(String libraryId, String type, ILocation location)
- {
- INamespace namespace = _component.getNamespace();
-
- _resolver.resolve(_cycle, namespace, libraryId, type, location);
-
- IComponentSpecification spec = _resolver.getSpecification();
-
- return spec.getAllowBody();
- }
-
- }
-
/**
* Clears the template cache. This is used during debugging.
*
@@ -433,7 +392,7 @@
if (_parser == null)
_parser = new TemplateParser();
- ITemplateParserDelegate delegate = new ParserDelegate(component, cycle);
+ ITemplateParserDelegate delegate = new TemplateParserDelegateImpl(component, cycle);
TemplateToken[] tokens;
diff --git a/framework/src/org/apache/tapestry/engine/TemplateParserDelegateImpl.java b/framework/src/org/apache/tapestry/engine/TemplateParserDelegateImpl.java
new file mode 100644
index 0000000..b601a22
--- /dev/null
+++ b/framework/src/org/apache/tapestry/engine/TemplateParserDelegateImpl.java
@@ -0,0 +1,70 @@
+//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.engine;
+
+import org.apache.tapestry.IComponent;
+import org.apache.tapestry.ILocation;
+import org.apache.tapestry.INamespace;
+import org.apache.tapestry.IRequestCycle;
+import org.apache.tapestry.Tapestry;
+import org.apache.tapestry.parse.ITemplateParserDelegate;
+import org.apache.tapestry.resolver.ComponentSpecificationResolver;
+import org.apache.tapestry.spec.IComponentSpecification;
+
+/**
+ * Basic implementation of the {@link org.apache.tapestry.parse.ITemplateParserDelegate} interface.
+ *
+ * @author Howard Lewis Ship
+ */
+public class TemplateParserDelegateImpl implements ITemplateParserDelegate
+{
+ private IComponent _component;
+ private ComponentSpecificationResolver _resolver;
+ private IRequestCycle _cycle;
+
+ public TemplateParserDelegateImpl(IComponent component, IRequestCycle cycle)
+ {
+ _component = component;
+ _resolver = new ComponentSpecificationResolver(cycle);
+ _cycle = cycle;
+ }
+
+ public boolean getKnownComponent(String componentId)
+ {
+ return _component.getSpecification().getComponent(componentId) != null;
+ }
+
+ public boolean getAllowBody(String componentId, ILocation location)
+ {
+ IComponent embedded = _component.getComponent(componentId);
+
+ if (embedded == null)
+ throw Tapestry.createNoSuchComponentException(_component, componentId, location);
+
+ return embedded.getSpecification().getAllowBody();
+ }
+
+ public boolean getAllowBody(String libraryId, String type, ILocation location)
+ {
+ INamespace namespace = _component.getNamespace();
+
+ _resolver.resolve(_cycle, namespace, libraryId, type, location);
+
+ IComponentSpecification spec = _resolver.getSpecification();
+
+ return spec.getAllowBody();
+ }
+
+}
\ No newline at end of file
diff --git a/status.xml b/status.xml
index 9e7cd6b..6de4291 100644
--- a/status.xml
+++ b/status.xml
@@ -262,6 +262,10 @@
Fix NPE in ValidationDelegate when the form has errors recorded for fields that did not render.
</action>
+ <action type="update" dev="HLS" fixes-bug="30261">
+ Provide a public implementation of ITemplateParserDelegate.
+ </action>
+
</release>
<release version="3.0" date="Apr 18 2004">