CVS: Tapestry/framework/src/net/sf/tapestry/engine Namespace.java,1.7.2.3,1.7.2.4 DefaultTemplateSource.java,1.9.2.4,1.9.2.5
Howard Lewis Ship <[email protected]>
| Newsgroups | gmane.comp.java.tapestry.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/engine
In directory sc8-pr-cvs1:/tmp/cvs-serv23659/framework/src/net/sf/tapestry/engine
Modified Files:
Tag: hship-2-3
Namespace.java DefaultTemplateSource.java
Log Message:
Allow searches for component specifications.
Allow application specification to be in WEB-INF instead of on classpath.
Allow application to run without an application specification.
Index: Namespace.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/engine/Namespace.java,v
retrieving revision 1.7.2.3
retrieving revision 1.7.2.4
diff -C2 -d -r1.7.2.3 -r1.7.2.4
*** Namespace.java 13 Dec 2002 12:22:45 -0000 1.7.2.3
--- Namespace.java 15 Dec 2002 16:26:12 -0000 1.7.2.4
***************
*** 11,14 ****
--- 11,15 ----
import net.sf.tapestry.ISpecificationSource;
import net.sf.tapestry.Tapestry;
+ import net.sf.tapestry.resource.ClasspathResourceLocation;
import net.sf.tapestry.spec.ComponentSpecification;
import net.sf.tapestry.spec.ILibrarySpecification;
***************
*** 36,39 ****
--- 37,65 ----
private boolean _applicationNamespace;
+ /**
+ * Map of {@link ComponentSpecification} keyed on page name.
+ * The map is synchronized because different threads may
+ * try to update it simultaneously (due to dynamic page
+ * discovery in the application namespace).
+ *
+ **/
+
+ private Map _pages = Collections.synchronizedMap(new HashMap());
+
+ /**
+ * Map of {@link ComponentSpecification} keyed on
+ * component alias.
+ *
+ **/
+
+ private Map _components = Collections.synchronizedMap(new HashMap());
+
+ /**
+ * Map, keyed on id, of {@link INamespace}.
+ *
+ **/
+
+ private Map _children = Collections.synchronizedMap(new HashMap());
+
public Namespace(
String id,
***************
*** 67,95 ****
}
- /**
- * Map of {@link ComponentSpecification} keyed on page name.
- * The map is synchronized because different threads may
- * try to update it simultaneously (due to dynamic page
- * discovery in the application namespace).
- *
- **/
-
- private Map _pages = Collections.synchronizedMap(new HashMap());
-
- /**
- * Map of {@link ComponentSpecification} keyed on
- * component alias.
- *
- **/
-
- private Map _components = new HashMap();
-
- /**
- * Map, keyed on id, of {@link INamespace}.
- *
- **/
-
- private Map _children = new HashMap();
-
public String getId()
{
--- 93,96 ----
***************
*** 157,161 ****
result = locatePageSpecification(name);
! _pages.put(name, result);
}
--- 158,162 ----
result = locatePageSpecification(name);
! _pages.put(name, result);
}
***************
*** 233,237 ****
}
-
/**
* Gets the specification from the specification source.
--- 234,237 ----
***************
*** 261,265 ****
Tapestry.getString("Namespace.no-such-alias", type, getNamespaceId()));
! IResourceLocation location = getSpecificationLocation().getRelativeLocation(path);
return _specificationSource.getComponentSpecification(location);
--- 261,265 ----
Tapestry.getString("Namespace.no-such-alias", type, getNamespaceId()));
! IResourceLocation location = getSpecificationLocation().getRelativeLocation(path);
return _specificationSource.getComponentSpecification(location);
***************
*** 276,279 ****
--- 276,287 ----
IResourceLocation location = getSpecificationLocation().getRelativeLocation(path);
+ // Ok, an absolute path to a library for an application whose specification
+ // is in the context root is problematic, cause getRelativeLocation()
+ // will still be looking in the context. Handle this case with the
+ // following little kludge:
+
+ if (location.getResourceURL() == null && path.startsWith("/"))
+ location = new ClasspathResourceLocation(_specification.getResourceResolver(), path);
+
ILibrarySpecification ls = _specificationSource.getLibrarySpecification(location);
***************
*** 304,308 ****
/** @since 2.4 **/
!
public IResourceLocation getSpecificationLocation()
{
--- 312,316 ----
/** @since 2.4 **/
!
public IResourceLocation getSpecificationLocation()
{
***************
*** 311,315 ****
/** @since 2.4 **/
!
public boolean isApplicationNamespace()
{
--- 319,323 ----
/** @since 2.4 **/
!
public boolean isApplicationNamespace()
{
***************
*** 318,325 ****
/** @since 2.4 **/
!
public void installPageSpecification(String pageName, ComponentSpecification specification)
{
_pages.put(pageName, specification);
}
--- 326,357 ----
/** @since 2.4 **/
!
public void installPageSpecification(String pageName, ComponentSpecification specification)
{
_pages.put(pageName, specification);
+ }
+
+ /** @since 2.4 **/
+
+ public void installComponentSpecification(String type, ComponentSpecification specification)
+ {
+ _components.put(type, specification);
+ }
+
+ // On these renamed methods, we simply invoke the old, deprecated method
+ // for code coverage reasons.
+
+ /** @since 2.4 **/
+
+ public boolean containsComponentType(String type)
+ {
+ return containsAlias(type);
+ }
+
+ /** @since 2.4 **/
+
+ public List getComponentTypes()
+ {
+ return getComponentAliases();
}
Index: DefaultTemplateSource.java
===================================================================
RCS file: /cvsroot/tapestry/Tapestry/framework/src/net/sf/tapestry/engine/DefaultTemplateSource.java,v
retrieving revision 1.9.2.4
retrieving revision 1.9.2.5
diff -C2 -d -r1.9.2.4 -r1.9.2.5
*** DefaultTemplateSource.java 11 Dec 2002 14:02:26 -0000 1.9.2.4
--- DefaultTemplateSource.java 15 Dec 2002 16:26:12 -0000 1.9.2.5
***************
*** 17,21 ****
import net.sf.tapestry.ApplicationRuntimeException;
- import net.sf.tapestry.ComponentResolver;
import net.sf.tapestry.IAsset;
import net.sf.tapestry.IComponent;
--- 17,20 ----
***************
*** 37,40 ****
--- 36,40 ----
import net.sf.tapestry.parse.TemplateParser;
import net.sf.tapestry.parse.TemplateToken;
+ import net.sf.tapestry.resolver.ComponentSpecificationResolver;
import net.sf.tapestry.spec.ComponentSpecification;
import net.sf.tapestry.util.MultiKey;
***************
*** 82,91 ****
{
private IComponent _component;
! private ComponentResolver _resolver;
! ParserDelegate(IComponent component, ISpecificationSource _specificationSource)
{
_component = component;
! _resolver = new ComponentResolver(_specificationSource);
}
--- 82,91 ----
{
private IComponent _component;
! private ComponentSpecificationResolver _resolver;
! ParserDelegate(IComponent component, IRequestCycle cycle)
{
_component = component;
! _resolver = new ComponentSpecificationResolver(cycle);
}
***************
*** 368,375 ****
_parser = new TemplateParser();
! IEngine engine = cycle.getEngine();
! ISpecificationSource specificationSource = engine.getSpecificationSource();
!
! ITemplateParserDelegate delegate = new ParserDelegate(component, specificationSource);
TemplateToken[] tokens;
--- 368,372 ----
_parser = new TemplateParser();
! ITemplateParserDelegate delegate = new ParserDelegate(component, cycle);
TemplateToken[] tokens;
-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/