tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hls...@apache.org
Subject svn commit: r547839 [1/2] - in /tapestry/tapestry5/trunk/tapestry-core/src: main/java/org/apache/tapestry/ main/java/org/apache/tapestry/internal/services/ main/java/org/apache/tapestry/internal/structure/ main/java/org/apache/tapestry/internal/test/ m...
Date Sat, 16 Jun 2007 00:36:42 GMT
Author: hlship
Date: Fri Jun 15 17:36:40 2007
New Revision: 547839

URL: http://svn.apache.org/viewvc?view=rev&rev=547839
Log:
TAPESTRY-1491: No way to get the logical page name for a page instance

Removed:
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/NoOpPage.java
Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassResolverImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentSourceImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InjectPageWorker.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoader.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePool.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePoolImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCache.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCacheImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/Page.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageImpl.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentClassResolver.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentSource.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentFieldManager.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
    tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/MetaDataLocatorImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PageLoaderImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/PagePoolImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/RequestPageCacheImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/structure/ComponentPageElementImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/structure/PageImplTest.java
    tapestry/tapestry5/trunk/tapestry-core/src/test/resources/org/apache/tapestry/integration/app1/components/Border.html

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/ComponentResourcesCommon.java Fri Jun 15 17:36:40 2007
@@ -151,4 +151,11 @@
      */
     Block findBlock(String blockId);
 
+    /**
+     * Returns the <em>logical</em> name of the page containing this component. This is the short
+     * name (it often appears in URLs)
+     * 
+     * @return the logical name of the page which contains this component
+     */
+    String getPageName();
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassResolverImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassResolverImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassResolverImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentClassResolverImpl.java Fri Jun 15 17:36:40 2007
@@ -26,6 +26,8 @@
 import org.apache.tapestry.internal.events.InvalidationListener;
 import org.apache.tapestry.ioc.annotations.Inject;
 import org.apache.tapestry.ioc.annotations.Symbol;
+import org.apache.tapestry.ioc.internal.util.ConcurrentBarrier;
+import org.apache.tapestry.ioc.internal.util.Invokable;
 import org.apache.tapestry.services.ComponentClassResolver;
 import org.apache.tapestry.services.LibraryMapping;
 
@@ -66,6 +68,10 @@
     /** This one is case sensitive, since class names do always have a particular case. */
     private final Map<String, String> _pageClassNameToLogicalName = newMap();
 
+    private final Map<String, String> _pageNameToCanonicalPageName = newCaseInsensitiveMap();
+
+    private final ConcurrentBarrier _barrier = new ConcurrentBarrier();
+
     public ComponentClassResolverImpl(ComponentInstantiatorSource componentInstantiatorSource,
             ClassNameLocator classNameLocator,
 
@@ -120,32 +126,45 @@
     /** When the class loader is invalidated, clear any cached page names or component types. */
     public synchronized void objectWasInvalidated()
     {
-        _needsRebuild = true;
+        _barrier.withWrite(new Runnable()
+        {
+            public void run()
+            {
+                _needsRebuild = true;
 
-        _pageToClassName.clear();
-        _componentToClassName.clear();
-        _mixinToClassName.clear();
-        _pageClassNameToLogicalName.clear();
+                _pageToClassName.clear();
+                _componentToClassName.clear();
+                _mixinToClassName.clear();
+                _pageClassNameToLogicalName.clear();
+                _pageNameToCanonicalPageName.clear();
+            }
+        });
 
     }
 
-    private synchronized void rebuild()
+    private void rebuild()
     {
         if (!_needsRebuild) return;
 
-        rebuild("", _appRootPackage);
-
-        for (String prefix : _mappings.keySet())
+        _barrier.withWrite(new Runnable()
         {
-            List<String> packages = _mappings.get(prefix);
+            public void run()
+            {
+                rebuild("", _appRootPackage);
 
-            String folder = prefix + "/";
+                for (String prefix : _mappings.keySet())
+                {
+                    List<String> packages = _mappings.get(prefix);
 
-            for (String packageName : packages)
-                rebuild(folder, packageName);
-        }
+                    String folder = prefix + "/";
 
-        _needsRebuild = false;
+                    for (String packageName : packages)
+                        rebuild(folder, packageName);
+                }
+
+                _needsRebuild = false;
+            }
+        });
     }
 
     private void rebuild(String pathPrefix, String rootPackage)
@@ -173,7 +192,11 @@
         {
             String logicalName = toLogicalName(name, pathPrefix, startPos);
 
-            if (isPage) _pageClassNameToLogicalName.put(name, logicalName);
+            if (isPage)
+            {
+                _pageClassNameToLogicalName.put(name, logicalName);
+                _pageNameToCanonicalPageName.put(logicalName, logicalName);
+            }
 
             logicalNameToClassName.put(logicalName, name);
         }
@@ -249,45 +272,70 @@
                 .length());
     }
 
-    public String resolvePageNameToClassName(String pageName)
+    public String resolvePageNameToClassName(final String pageName)
     {
-        String result = locate(pageName, _pageToClassName);
+        return _barrier.withRead(new Invokable<String>()
+        {
+            public String invoke()
+            {
+                String result = locate(pageName, _pageToClassName);
 
-        if (result == null)
-            throw new IllegalArgumentException(ServicesMessages.couldNotResolvePageName(
-                    pageName,
-                    _pageToClassName.keySet()));
+                if (result == null)
+                    throw new IllegalArgumentException(ServicesMessages.couldNotResolvePageName(
+                            pageName,
+                            _pageToClassName.keySet()));
+
+                return result;
+            }
+        });
 
-        return result;
     }
 
-    public boolean isPageName(String pageName)
+    public boolean isPageName(final String pageName)
     {
-        return locate(pageName, _pageToClassName) != null;
+        return _barrier.withRead(new Invokable<Boolean>()
+        {
+            public Boolean invoke()
+            {
+                return locate(pageName, _pageToClassName) != null;
+            }
+        });
     }
 
-    public String resolveComponentTypeToClassName(String componentType)
+    public String resolveComponentTypeToClassName(final String componentType)
     {
-        String result = locate(componentType, _componentToClassName);
+        return _barrier.withRead(new Invokable<String>()
+        {
+            public String invoke()
+            {
+                String result = locate(componentType, _componentToClassName);
 
-        if (result == null)
-            throw new IllegalArgumentException(ServicesMessages.couldNotResolveComponentType(
-                    componentType,
-                    _componentToClassName.keySet()));
+                if (result == null)
+                    throw new IllegalArgumentException(ServicesMessages
+                            .couldNotResolveComponentType(componentType, _componentToClassName
+                                    .keySet()));
 
-        return result;
+                return result;
+            }
+        });
     }
 
-    public String resolveMixinTypeToClassName(String mixinType)
+    public String resolveMixinTypeToClassName(final String mixinType)
     {
-        String result = locate(mixinType, _mixinToClassName);
+        return _barrier.withRead(new Invokable<String>()
+        {
+            public String invoke()
+            {
+                String result = locate(mixinType, _mixinToClassName);
 
-        if (result == null)
-            throw new IllegalArgumentException(ServicesMessages.couldNotResolveMixinType(
-                    mixinType,
-                    _mixinToClassName.keySet()));
+                if (result == null)
+                    throw new IllegalArgumentException(ServicesMessages.couldNotResolveMixinType(
+                            mixinType,
+                            _mixinToClassName.keySet()));
 
-        return result;
+                return result;
+            }
+        });
     }
 
     /**
@@ -314,15 +362,41 @@
         return result;
     }
 
-    public String resolvePageClassNameToPageName(String pageClassName)
+    public String resolvePageClassNameToPageName(final String pageClassName)
     {
-        rebuild();
+        return _barrier.withRead(new Invokable<String>()
+        {
+            public String invoke()
+            {
+                rebuild();
 
-        String result = _pageClassNameToLogicalName.get(pageClassName);
+                String result = _pageClassNameToLogicalName.get(pageClassName);
 
-        if (result == null)
-            throw new IllegalArgumentException(ServicesMessages.pageNameUnresolved(pageClassName));
+                if (result == null)
+                    throw new IllegalArgumentException(ServicesMessages
+                            .pageNameUnresolved(pageClassName));
 
-        return result;
+                return result;
+            }
+        });
+    }
+
+    public String canonicalizePageName(final String pageName)
+    {
+        return _barrier.withRead(new Invokable<String>()
+        {
+            public String invoke()
+            {
+                String result = locate(pageName, _pageNameToCanonicalPageName);
+
+                if (result == null)
+                    throw new IllegalArgumentException(ServicesMessages
+                            .couldNotCanonicalizePageName(pageName, _pageNameToCanonicalPageName
+                                    .keySet()));
+
+                return result;
+            }
+        });
     }
+
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessor.java Fri Jun 15 17:36:40 2007
@@ -44,21 +44,15 @@
         ComponentResources resources = value.getComponentResources();
 
         if (resources.getContainer() != null)
-        {
             _log.warn(ServicesMessages.componentInstanceIsNotAPage(
                     methodDescription,
                     component,
                     value));
 
-            resources = resources.getPage().getComponentResources();
-        }
-
         // We have all these layers and layers between us and the page instance, but its easy to
         // extract the page class name and quickly re-resolve that to the page instance.
 
-        String pageClassName = resources.getCompleteId();
-
-        Page page = _requestPageCache.getByClassName(pageClassName);
+        Page page = _requestPageCache.get(resources.getPageName());
 
         Link link = _linkFactory.createPageLink(page);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentSourceImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ComponentSourceImpl.java Fri Jun 15 17:36:40 2007
@@ -14,8 +14,6 @@
 
 package org.apache.tapestry.internal.services;
 
-import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
-
 import org.apache.tapestry.internal.structure.Page;
 import org.apache.tapestry.runtime.Component;
 import org.apache.tapestry.services.ComponentSource;
@@ -35,28 +33,17 @@
 
         if (colonx < 0)
         {
-            Page page = _pageCache.getByClassName(componentId);
+            Page page = _pageCache.get(componentId);
 
             return page.getRootComponent();
         }
 
         String pageName = componentId.substring(0, colonx);
 
-        Page page = _pageCache.getByClassName(pageName);
+        Page page = _pageCache.get(pageName);
         String nestedId = componentId.substring(colonx + 1);
 
         return page.getComponentElementByNestedId(nestedId).getComponent();
-    }
-
-    public <T> T getPage(Class<T> pageClass)
-    {
-        notNull(pageClass, "pageClass");
-
-        Page page = _pageCache.getByClassName(pageClass.getName());
-
-        Component root = page.getRootComponent();
-
-        return pageClass.cast(root);
     }
 
     public Component getPage(String pageName)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InjectPageWorker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InjectPageWorker.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InjectPageWorker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InjectPageWorker.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -23,6 +23,7 @@
 import org.apache.tapestry.ioc.util.BodyBuilder;
 import org.apache.tapestry.model.MutableComponentModel;
 import org.apache.tapestry.services.ClassTransformation;
+import org.apache.tapestry.services.ComponentClassResolver;
 import org.apache.tapestry.services.ComponentClassTransformWorker;
 import org.apache.tapestry.services.MethodSignature;
 
@@ -35,17 +36,19 @@
 {
     private final RequestPageCache _requestPageCache;
 
-    public InjectPageWorker(final RequestPageCache requestPageCache)
+    private final ComponentClassResolver _resolver;
+
+    public InjectPageWorker(RequestPageCache requestPageCache, ComponentClassResolver resolver)
     {
         _requestPageCache = requestPageCache;
+        _resolver = resolver;
     }
 
     public void transform(ClassTransformation transformation, MutableComponentModel model)
     {
         List<String> names = transformation.findFieldsWithAnnotation(InjectPage.class);
 
-        if (names.isEmpty())
-            return;
+        if (names.isEmpty()) return;
 
         String cacheFieldName = transformation.addInjectedField(
                 RequestPageCache.class,
@@ -67,20 +70,20 @@
         String fieldType = transformation.getFieldType(fieldName);
         String methodName = transformation.newMemberName("read_inject_page", fieldName);
 
+        String injectedPageName = InternalUtils.isBlank(pageName) ? _resolver
+                .resolvePageClassNameToPageName(fieldType) : pageName;
+
         MethodSignature sig = new MethodSignature(Modifier.PRIVATE, fieldType, methodName, null,
                 null);
 
         BodyBuilder builder = new BodyBuilder();
         builder.begin();
 
-        builder.add("%s page = %s.", Page.class.getName(), cacheFieldName);
-
-        if (InternalUtils.isBlank(pageName))
-            builder.add("getByClassName(\"%s\")", fieldType);
-        else
-            builder.add("get(\"%s\")", pageName);
-
-        builder.addln(";");
+        builder.add(
+                "%s page = %s.get(\"%s\");",
+                Page.class.getName(),
+                cacheFieldName,
+                injectedPageName);
 
         builder.addln("return (%s) page.getRootElement().getComponent();", fieldType);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/InternalModule.java Fri Jun 15 17:36:40 2007
@@ -202,9 +202,9 @@
     }
 
     public PagePool build(Log log, PageLoader pageLoader,
-            ComponentMessagesSource componentMessagesSource)
+            ComponentMessagesSource componentMessagesSource, ComponentClassResolver resolver)
     {
-        PagePoolImpl service = new PagePoolImpl(log, pageLoader, _threadLocale);
+        PagePoolImpl service = new PagePoolImpl(log, pageLoader, _threadLocale, resolver);
 
         // This covers invalidations due to changes to classes
 
@@ -236,7 +236,7 @@
     @Scope(PERTHREAD_SCOPE)
     public RequestPageCache build(PagePool pagePool)
     {
-        RequestPageCacheImpl service = new RequestPageCacheImpl(_componentClassResolver, pagePool);
+        RequestPageCacheImpl service = new RequestPageCacheImpl(pagePool);
 
         _threadCleanupHub.addThreadCleanupListener(service);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/LinkFactoryImpl.java Fri Jun 15 17:36:40 2007
@@ -118,9 +118,8 @@
         notBlank(action, "action");
 
         Page containingPage = component.getContainingPage();
-        String pageName = containingPage.getName();
 
-        String logicalPageName = _componentClassResolver.resolvePageClassNameToPageName(pageName);
+        String logicalPageName = containingPage.getLogicalName();
 
         ActionLinkTarget target = new ActionLinkTarget(action, logicalPageName, component
                 .getNestedId());
@@ -169,8 +168,7 @@
     {
         notNull(page, "page");
 
-        String pageName = page.getName();
-        String logicalPageName = _componentClassResolver.resolvePageClassNameToPageName(pageName);
+        String logicalPageName = page.getLogicalName();
 
         String[] context = activationContext.length != 0 ? toContextStrings(activationContext)
                 : collectActivationContextForPage(page);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/MetaDataLocatorImpl.java Fri Jun 15 17:36:40 2007
@@ -15,28 +15,23 @@
 package org.apache.tapestry.internal.services;
 
 import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newConcurrentMap;
 
 import java.util.Map;
 
 import org.apache.tapestry.ComponentResources;
 import org.apache.tapestry.internal.events.InvalidationListener;
 import org.apache.tapestry.ioc.internal.util.CollectionFactory;
-import org.apache.tapestry.services.ComponentClassResolver;
 import org.apache.tapestry.services.MetaDataLocator;
 
 public class MetaDataLocatorImpl implements MetaDataLocator, InvalidationListener
 {
     private final Map<String, Map<String, String>> _defaultsByFolder = newCaseInsensitiveMap();
 
-    private final Map<String, String> _cache = CollectionFactory.newConcurrentMap();
+    private final Map<String, String> _cache = newConcurrentMap();
 
-    private final ComponentClassResolver _componentClassResolver;
-
-    public MetaDataLocatorImpl(ComponentClassResolver componentClassResolver,
-            Map<String, String> configuration)
+    public MetaDataLocatorImpl(Map<String, String> configuration)
     {
-        _componentClassResolver = componentClassResolver;
-
         loadDefaults(configuration);
     }
 
@@ -73,11 +68,10 @@
     {
         // The component's complete id should be sufficient as locale-specific
         // values don't enter into this.
-        
+
         String cacheKey = resources.getCompleteId() + "/" + key;
 
-        if (_cache.containsKey(cacheKey))
-            return _cache.get(cacheKey);
+        if (_cache.containsKey(cacheKey)) return _cache.get(cacheKey);
 
         String result = locate(key, resources);
 
@@ -94,13 +88,11 @@
         {
             String value = cursor.getComponentModel().getMeta(key);
 
-            if (value != null)
-                return value;
+            if (value != null) return value;
 
             ComponentResources next = cursor.getContainerResources();
 
-            if (next == null)
-                return locateInDefaults(key, cursor);
+            if (next == null) return locateInDefaults(key, cursor);
 
             cursor = next;
         }
@@ -108,9 +100,7 @@
 
     private String locateInDefaults(String key, ComponentResources pageResources)
     {
-        String pageClassName = pageResources.getCompleteId();
-
-        String logicalName = _componentClassResolver.resolvePageClassNameToPageName(pageClassName);
+        String logicalName = pageResources.getPageName();
 
         // We're going to peel this apart, slash by slash. Thus for
         // "mylib/myfolder/mysubfolder/MyPage" we'll be checking: "mylib/myfolder/mysubfolder",
@@ -126,11 +116,9 @@
 
             Map<String, String> forFolder = _defaultsByFolder.get(folderKey);
 
-            if (forFolder != null && forFolder.containsKey(key))
-                return forFolder.get(key);
+            if (forFolder != null && forFolder.containsKey(key)) return forFolder.get(key);
 
-            if (lastSlashx < 0)
-                break;
+            if (lastSlashx < 0) break;
 
             path = path.substring(0, lastSlashx);
         }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoader.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoader.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoader.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoader.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -12,34 +12,39 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.internal.services;
-
-import java.util.Locale;
-
-import org.apache.tapestry.internal.event.InvalidationEventHub;
-import org.apache.tapestry.internal.structure.Page;
-
-/**
- * Instantiates a fully loaded, configured instance of a Tapestry page. This is a recursive process,
- * since part of loading a page is to load the page elements for the page, many of which are
- * components. Further, in some cases, the full component tree is not identified until after each
- * component's template is loaded. Because this is an expensive process, loaded pages will be used
- * for many requests (on behalf of many different users) and will be pooled between requests.
- * 
- * 
- * @see PagePool
- * @see RequestPageCache
- */
-public interface PageLoader extends InvalidationEventHub
-{
-    /**
-     * Loads the page in the given locale.
-     * 
-     * @param pageClassName
-     *            fully qualified class name of the root component of the page
-     * @param locale
-     *            the locale to load the page and its components in
-     * @see Page#getLocale()
-     */
-    Page loadPage(String pageClassName, Locale locale);
-}
+package org.apache.tapestry.internal.services;
+
+import java.util.Locale;
+
+import org.apache.tapestry.ComponentResourcesCommon;
+import org.apache.tapestry.internal.event.InvalidationEventHub;
+import org.apache.tapestry.internal.structure.Page;
+
+/**
+ * Instantiates a fully loaded, configured instance of a Tapestry page. This is a recursive process,
+ * since part of loading a page is to load the page elements for the page, many of which are
+ * components. Further, in some cases, the full component tree is not identified until after each
+ * component's template is loaded. Because this is an expensive process, loaded pages will be used
+ * for many requests (on behalf of many different users) and will be pooled between requests.
+ * 
+ * @see PagePool
+ * @see RequestPageCache
+ */
+public interface PageLoader extends InvalidationEventHub
+{
+    /**
+     * Loads the page in the given locale.
+     * 
+     * @param logicalPageName
+     *            the <em>canonicalized</em> logical name of the page, which will be made
+     *            available via {@link Page#getLogicalName()} and
+     *            {@link ComponentResourcesCommon#getPageName()} (for any component within the
+     *            page).
+     * @param locale
+     *            the locale to load the page and its components , which will be made available via
+     *            {@link Page#getLocale()} and {@link ComponentResourcesCommon#getLocale()} (for any
+     *            component within the page)
+     * @see Page#getLocale()
+     */
+    Page loadPage(String logicalPageName, Locale locale);
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderImpl.java Fri Jun 15 17:36:40 2007
@@ -19,6 +19,7 @@
 import org.apache.tapestry.internal.event.InvalidationEventHubImpl;
 import org.apache.tapestry.internal.events.InvalidationListener;
 import org.apache.tapestry.internal.structure.Page;
+import org.apache.tapestry.services.ComponentClassResolver;
 import org.apache.tapestry.services.PersistentFieldManager;
 
 public class PageLoaderImpl extends InvalidationEventHubImpl implements PageLoader,
@@ -32,23 +33,20 @@
 
     private final PersistentFieldManager _persistentFieldManager;
 
+    private final ComponentClassResolver _resolver;
+
     public PageLoaderImpl(ComponentTemplateSource templateSource,
             PageElementFactory pageElementFactory, LinkFactory linkFactory,
-            PersistentFieldManager persistentFieldManager)
+            PersistentFieldManager persistentFieldManager, ComponentClassResolver resolver)
     {
         _templateSource = templateSource;
         _pageElementFactory = pageElementFactory;
-
         _linkFactory = linkFactory;
         _persistentFieldManager = persistentFieldManager;
+        _resolver = resolver;
     }
 
-    /**
-     * For the moment, this service is a singleton. However, only a single page can be built at one
-     * time. The coming rework will shift the loc al variables to a secondary process object and
-     * allow the loader to work in parallel.
-     */
-    public Page loadPage(String pageClassName, Locale locale)
+    public Page loadPage(String logicalPageName, Locale locale)
     {
         // For the moment, the processors are used once and discarded. Perhaps it is worth the
         // effort to pool them for reuse, but not too likely.
@@ -56,7 +54,9 @@
         PageLoaderProcessor processor = new PageLoaderProcessor(_templateSource,
                 _pageElementFactory, _linkFactory, _persistentFieldManager);
 
-        return processor.loadPage(pageClassName, locale);
+        String pageClassName = _resolver.resolvePageNameToClassName(logicalPageName);
+
+        return processor.loadPage(logicalPageName, pageClassName, locale);
     }
 
     /**

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PageLoaderProcessor.java Fri Jun 15 17:36:40 2007
@@ -375,10 +375,10 @@
     }
 
     /**
-     * As currently implemented, this should be invoked just once and then the instance should be
-     * discarded.
+     * As currently implemented, this should be invoked just once and then the PageLoaderProcessor
+     * instance should be discarded.
      */
-    public Page loadPage(String pageClassName, Locale locale)
+    public Page loadPage(String logicalPageName, String pageClassName, Locale locale)
     {
         // Ensure that loadPage() may only be invoked once.
 
@@ -386,7 +386,7 @@
 
         _locale = locale;
 
-        _page = new PageImpl(pageClassName, _locale, _linkFactory, _persistentFieldManager);
+        _page = new PageImpl(logicalPageName, _locale, _linkFactory, _persistentFieldManager);
 
         loadRootComponent(pageClassName);
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePool.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePool.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePool.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePool.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -12,30 +12,28 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
-package org.apache.tapestry.internal.services;
-
-import org.apache.tapestry.internal.structure.Page;
-
-/**
- * Provides access to pages, creating them as necessary, and pooling them between requests.
- * 
- * 
- */
-public interface PagePool
-{
-    /**
-     * Obtains a page instance from the pool via a page name. A page instance is created if no such
-     * page is currently available.
-     * 
-     * @param pageName
-     *            identifies the page name, as a fully qualified class name
-     * @return a page instance
-     */
-    Page checkout(String pageName);
-
-    /**
-     * @param page
-     *            a previously checked-out page
-     */
-    void release(Page page);
-}
+package org.apache.tapestry.internal.services;
+
+import org.apache.tapestry.internal.structure.Page;
+
+/**
+ * Provides access to pages, creating them as necessary, and pooling them between requests.
+ */
+public interface PagePool
+{
+    /**
+     * Obtains a page instance from the pool via a logical page name. A page instance is created if
+     * no such page is currently available.
+     * 
+     * @param logicalPageName
+     *            logical name used to identify the page
+     * @return a page instance
+     */
+    Page checkout(String logicalPageName);
+
+    /**
+     * @param page
+     *            a previously checked-out page
+     */
+    void release(Page page);
+}

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePoolImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePoolImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePoolImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/PagePoolImpl.java Fri Jun 15 17:36:40 2007
@@ -25,6 +25,7 @@
 import org.apache.tapestry.internal.structure.Page;
 import org.apache.tapestry.ioc.internal.util.CollectionFactory;
 import org.apache.tapestry.ioc.services.ThreadLocale;
+import org.apache.tapestry.services.ComponentClassResolver;
 
 /**
  * A very naive implementation just to get us past the start line.
@@ -40,27 +41,33 @@
 
     private final ThreadLocale _threadLocale;
 
+    private final ComponentClassResolver _resolver;
+
     private final Map<PageLocator, List<Page>> _pool = newMap();
 
-    public PagePoolImpl(Log log, PageLoader pageLoader, ThreadLocale threadLocale)
+    public PagePoolImpl(Log log, PageLoader pageLoader, ThreadLocale threadLocale,
+            ComponentClassResolver resolver)
     {
         _log = log;
         _pageLoader = pageLoader;
         _threadLocale = threadLocale;
+        _resolver = resolver;
     }
 
-    public synchronized Page checkout(String pageName)
+    public synchronized Page checkout(String logicalPageName)
     {
+        String canonicalPageName = _resolver.canonicalizePageName(logicalPageName);
+
         Locale locale = _threadLocale.getLocale();
-        List<Page> pages = _pool.get(new PageLocator(pageName, locale));
+        List<Page> pages = _pool.get(new PageLocator(canonicalPageName, locale));
 
         // When we load a page, we load it in the active locale, whatever that is.
         // Even if the locale later changes, we keep the version we originally got.
         // This is not as bad in T5 as in T4, since a seperate request will
         // render the response (and will have a chance to get the page in a different locale).
 
-        if (pages == null || pages.isEmpty())
-            return _pageLoader.loadPage(pageName, locale);
+        if (pages == null || pages.isEmpty()) 
+            return _pageLoader.loadPage(canonicalPageName, locale);
 
         // Remove and return the last page in the pool.
 
@@ -77,7 +84,7 @@
             return;
         }
 
-        PageLocator locator = new PageLocator(page.getName(), page.getLocale());
+        PageLocator locator = new PageLocator(page.getLogicalName(), page.getLocale());
         List<Page> pages = _pool.get(locator);
 
         if (pages == null)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCache.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCache.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCache.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCache.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -26,23 +26,12 @@
      * Gets the page via its page name, in the current locale. The page name is resolved to a class
      * name, which is used to obtain the page (from the page pool).
      * 
-     * @param pageName
+     * @param logicalPageName
      *            the name of the page to retrieve (this is the logical page name, not the fully
      *            qualified class name)
      * @return a page instance reserved for this request
      * @throws IllegalArgumentException
      *             if the name can not be resolved to a page instance
      */
-    Page get(String pageName);
-
-    /**
-     * Gets the page via its fully qualified class name, in the current locale.
-     * 
-     * @param pageName
-     *            fully qualified class name
-     * @return a page instance reserved for this request
-     * @throws IllegalArgumentException
-     *             if the name can not be resolved to a page instance
-     */
-    Page getByClassName(String className);
+    Page get(String logicalPageName);
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCacheImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCacheImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCacheImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/RequestPageCacheImpl.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -14,57 +14,47 @@
 
 package org.apache.tapestry.internal.services;
 
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newMap;
+import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newCaseInsensitiveMap;
 
 import java.util.Map;
 
 import org.apache.tapestry.internal.structure.Page;
 import org.apache.tapestry.ioc.services.ThreadCleanupListener;
-import org.apache.tapestry.services.ComponentClassResolver;
 
 public class RequestPageCacheImpl implements RequestPageCache, ThreadCleanupListener
 {
-    private final ComponentClassResolver _resolver;
-
     private final PagePool _pagePool;
 
     /**
-     * Keyed on fully qualified page class name.
+     * Keyed on logical page name (case insensitive).
      */
-    private final Map<String, Page> _cache = newMap();
+    private final Map<String, Page> _cache = newCaseInsensitiveMap();
 
-    public RequestPageCacheImpl(ComponentClassResolver resolver, PagePool pagePool)
+    public RequestPageCacheImpl(PagePool pagePool)
     {
-        _resolver = resolver;
         _pagePool = pagePool;
     }
 
-    public Page get(String pageName)
-    {
-        String className = _resolver.resolvePageNameToClassName(pageName);
-
-        if (className == null)
-            throw new IllegalArgumentException(ServicesMessages.pageDoesNotExist(pageName));
-
-        return getByClassName(className);
-    }
-
-    public Page getByClassName(String className)
+    public Page get(String logicalPageName)
     {
-        Page page = _cache.get(className);
+        Page page = _cache.get(logicalPageName);
 
         if (page == null)
         {
-            page = _pagePool.checkout(className);
+            page = _pagePool.checkout(logicalPageName);
 
             page.attached();
 
-            _cache.put(className, page);
+            _cache.put(logicalPageName, page);
         }
 
         return page;
     }
 
+    /**
+     * At the end of the request, when the thread cleanup event occurs, release any pages attached
+     * to the request back to the page pool.
+     */
     public void threadDidCleanup()
     {
         for (Page p : _cache.values())

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/services/ServicesMessages.java Fri Jun 15 17:36:40 2007
@@ -165,11 +165,6 @@
         return MESSAGES.format("context-index-out-of-range", methodDescription);
     }
 
-    static String pageDoesNotExist(String pageName)
-    {
-        return MESSAGES.format("page-does-not-exist", pageName);
-    }
-
     static String pageNameUnresolved(String pageClassName)
     {
         return MESSAGES.format("page-name-unresolved", pageClassName);
@@ -198,6 +193,12 @@
         return MESSAGES.format("could-not-resolve-page-name", pageName, InternalUtils
                 .joinSorted(pageNames));
     }
+    
+    static String couldNotCanonicalizePageName(String pageName, Collection<String> pageNames)
+    {
+        return MESSAGES.format("could-not-canonicalize-page-name", pageName, InternalUtils
+                .joinSorted(pageNames));
+    }
 
     static String couldNotResolveComponentType(String componentType,
             Collection<String> componentTypes)
@@ -398,7 +399,7 @@
     {
         return MESSAGES.format("no-display-for-data-type", datatype);
     }
-    
+
     static String noEditForDataType(String datatype)
     {
         return MESSAGES.format("no-edit-for-data-type", datatype);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ComponentPageElementImpl.java Fri Jun 15 17:36:40 2007
@@ -550,7 +550,7 @@
 
         _coreComponent = _coreResources.getComponent();
 
-        String pageName = _page.getName();
+        String pageName = _page.getLogicalName();
 
         // A page (really, the root component of a page) does not have a container.
 
@@ -571,7 +571,7 @@
             if (parentNestedId == null)
             {
                 _nestedId = caselessId;
-                _completeId = _page.getName() + ":" + caselessId;
+                _completeId = pageName + ":" + caselessId;
             }
             else
             {
@@ -1113,4 +1113,10 @@
 
         return null;
     }
+
+    public String getPageName()
+    {
+        return _page.getLogicalName();
+    }
+
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/InternalComponentResourcesImpl.java Fri Jun 15 17:36:40 2007
@@ -360,4 +360,9 @@
         return _componentModel.getBaseResource();
     }
 
+    public String getPageName()
+    {
+        return _element.getPageName();
+    }
+
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/Page.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/Page.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/Page.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/Page.java Fri Jun 15 17:36:40 2007
@@ -37,11 +37,9 @@
 public interface Page
 {
     /**
-     * Returns the name of the page, which is the fully qualifed class name of the page's
-     * <em>root component</em>. The name is unique within the application, though it is combined
-     * with the locale to select and pool page instances.
+     * Returns the short, logical name for the page.
      */
-    String getName();
+    String getLogicalName();
 
     /**
      * The locale for which the page is localized. This is set when the page is created and does not

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageImpl.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageImpl.java Fri Jun 15 17:36:40 2007
@@ -32,7 +32,7 @@
 
 public class PageImpl implements Page
 {
-    private final String _name;
+    private final String _logicalPageName;
 
     private final Locale _locale;
 
@@ -52,10 +52,10 @@
      */
     private PersistentFieldBundle _fieldBundle;
 
-    public PageImpl(String name, Locale locale, LinkFactory linkFactory,
+    public PageImpl(String logicalPageName, Locale locale, LinkFactory linkFactory,
             PersistentFieldManager persistentFieldManager)
     {
-        _name = name;
+        _logicalPageName = logicalPageName;
         _locale = locale;
         _linkFactory = linkFactory;
         _persistentFieldManager = persistentFieldManager;
@@ -64,7 +64,7 @@
     @Override
     public String toString()
     {
-        return String.format("Page[%s %s]", _name, _locale);
+        return String.format("Page[%s %s]", _logicalPageName, _locale);
     }
 
     public ComponentPageElement getComponentElementByNestedId(String nestedId)
@@ -86,11 +86,6 @@
         return element;
     }
 
-    public String getName()
-    {
-        return _name;
-    }
-
     public Locale getLocale()
     {
         return _locale;
@@ -146,8 +141,7 @@
 
     public void attached()
     {
-        if (_dirtyCount != 0)
-            throw new IllegalStateException(StructureMessages.pageIsDirty(this));
+        if (_dirtyCount != 0) throw new IllegalStateException(StructureMessages.pageIsDirty(this));
 
         for (PageLifecycleListener listener : _listeners)
             listener.containingPageDidAttach();
@@ -171,13 +165,13 @@
 
     public void persistFieldChange(ComponentResources resources, String fieldName, Object newValue)
     {
-        _persistentFieldManager.postChange(_name, resources, fieldName, newValue);
+        _persistentFieldManager.postChange(_logicalPageName, resources, fieldName, newValue);
     }
 
     public Object getFieldChange(ComponentPageElement element, String fieldName)
     {
         if (_fieldBundle == null)
-            _fieldBundle = _persistentFieldManager.gatherChanges(_name);
+            _fieldBundle = _persistentFieldManager.gatherChanges(_logicalPageName);
 
         return _fieldBundle.getValue(element.getNestedId(), fieldName);
     }
@@ -191,5 +185,9 @@
     {
         _dirtyCount++;
     }
- 
+
+    public String getLogicalName()
+    {
+        return _logicalPageName;
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/InternalBaseTestCase.java Fri Jun 15 17:36:40 2007
@@ -198,11 +198,6 @@
         expect(loader.loadPage(pageName, locale)).andReturn(page);
     }
 
-    protected final void train_getName(Page page, String name)
-    {
-        expect(page.getName()).andReturn(name).atLeastOnce();
-    }
-
     protected final PagePool mockPagePool()
     {
         return newMock(PagePool.class);
@@ -382,12 +377,6 @@
         return ins;
     }
 
-    protected final void train_getByClassName(RequestPageCache cache, String pageClassName,
-            Page page)
-    {
-        expect(cache.getByClassName(pageClassName)).andReturn(page).atLeastOnce();
-    }
-
     protected final RequestPageCache mockRequestPageCache()
     {
         return newMock(RequestPageCache.class);
@@ -554,5 +543,33 @@
     protected final DocumentScriptBuilder mockDocumentScriptBuilder()
     {
         return newMock(DocumentScriptBuilder.class);
+    }
+
+    protected final void train_canonicalizePageName(ComponentClassResolver resolver,
+            String pageName, String canonicalized)
+    {
+        expect(resolver.canonicalizePageName(pageName)).andReturn(canonicalized);
+    }
+
+    protected final void train_getLogicalName(Page page, String logicalName)
+    {
+        expect(page.getLogicalName()).andReturn(logicalName).atLeastOnce();
+    }
+
+    protected final void train_resolvePageNameToClassName(ComponentClassResolver resolver,
+            String pageName, String pageClassName)
+    {
+        expect(resolver.resolvePageNameToClassName(pageName)).andReturn(pageClassName)
+                .atLeastOnce();
+    }
+
+    protected final void train_getLocale(Page page, Locale locale)
+    {
+        expect(page.getLocale()).andReturn(locale).atLeastOnce();
+    }
+
+    protected final void train_detached(Page page, boolean dirty)
+    {
+        expect(page.detached()).andReturn(dirty);
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentClassResolver.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentClassResolver.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentClassResolver.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentClassResolver.java Fri Jun 15 17:36:40 2007
@@ -40,13 +40,13 @@
      * Converts a logical page name (such as might be encoded into a URL) into a fully qualified
      * class name. The case of the page name is irrelevant.
      * 
-     * @param pageName
+     * @param logicalPageName
      *            logical page name
      * @return fully qualified class name for the page
      * @throws IllegalArgumentException
      *             if the name does not match a known page class
      */
-    String resolvePageNameToClassName(String pageName);
+    String resolvePageNameToClassName(String logicalPageName);
 
     /**
      * For a particular path, determines if the path is a logical page name. The check is case
@@ -70,6 +70,15 @@
      *             if the name can not be resolved
      */
     String resolvePageClassNameToPageName(String pageClassName);
+
+    /**
+     * Returns the canonical form of a logical page name. The canonical form uses character case
+     * matching the underlying class name.
+     * 
+     * @throws IllegalArgumentException
+     *             if the page name does not match a logical page name
+     */
+    String canonicalizePageName(String pageName);
 
     /**
      * Converts a component type (a logical component name such as might be used inside a template

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentSource.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/ComponentSource.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -36,19 +36,6 @@
      * @see ComponentResourcesCommon#getCompleteId()
      */
     Component getComponent(String componentId);
-
-    /**
-     * Gets a page given its class.
-     * 
-     * @param <T>
-     *            the type of the page
-     * @param pageClass
-     *            the class of the page's root component
-     * @return the root component of the page
-     * @throws IllegalArgumentException
-     *             if the page can not be found
-     */
-    <T> T getPage(Class<T> pageClass);
 
     /**
      * Returns the page identified by its logical page name. A logical page name is the short form

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentFieldManager.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentFieldManager.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentFieldManager.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PersistentFieldManager.java Fri Jun 15 17:36:40 2007
@@ -1,4 +1,4 @@
-// Copyright 2006 The Apache Software Foundation
+// Copyright 2006, 2007 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.
@@ -26,7 +26,7 @@
      * Posts a change of a persistent property.
      * 
      * @param pageName
-     *            the name of the page containing the component
+     *            the logical name of the page containing the component
      * @param resources
      *            the resources for the component or mixin (used to determine the persistence
      *            strategy)
@@ -42,7 +42,7 @@
      * session and request) and gathers them together into a bundle.
      * 
      * @param pageName
-     *            the name of the page to gather changes for
+     *            the logical name of the page to gather changes for
      * @return a bundle identifying all such changes
      */
     PersistentFieldBundle gatherChanges(String pageName);

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/TapestryModule.java Fri Jun 15 17:36:40 2007
@@ -433,7 +433,7 @@
         configuration.add("Mixin", new MixinWorker(resolver));
         configuration.add("OnEvent", new OnEventWorker());
         configuration.add("SupportsInformalParameters", new SupportsInformalParametersWorker());
-        configuration.add("InjectPage", new InjectPageWorker(requestPageCache));
+        configuration.add("InjectPage", new InjectPageWorker(requestPageCache, resolver));
         configuration.add("InjectComponent", new InjectComponentWorker());
         configuration.add("RenderCommand", new RenderCommandWorker());
 

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/test/TapestryTestCase.java Fri Jun 15 17:36:40 2007
@@ -975,4 +975,9 @@
         expect(request.getParameter(elementName)).andReturn(value).atLeastOnce();
     }
 
+    protected final void train_getPageName(ComponentResourcesCommon resources, String pageName)
+    {
+        expect(resources.getPageName()).andReturn(pageName).atLeastOnce();
+    }
+
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry/internal/services/ServicesStrings.properties Fri Jun 15 17:36:40 2007
@@ -41,13 +41,13 @@
   or define the component inside class %s using the @Component annotation on a private instance variable.
 embedded-components-not-in-template=Embedded component(s) %s are defined within component class %s, but are not present in the component template.
 binding-source-failure=Could not convert '%s' into a component parameter binding: %s
-page-does-not-exist=Page '%s' is not defined by this application.
 page-name-unresolved=Unable to resolve class name %s to a logical page name.
 context-index-out-of-range=Method %s has more parameters than there are context values for this component event.
 exception-in-method-parameter=Exception in method %s, parameter #%d: %s
 component-event-is-aborted=Can not store result from invoking method %s, because an event result value has already been obtained from some other event handler method.
 unknown-persistent-field-strategy='%s' is not a defined persistent strategy.  Defined stategies: %s.
-could-not-resolve-page-name=Unable to resolve page '%s' to a component class name.  Available page names: %s.
+could-not-resolve-page-name=Unable to resolve page '%s' to a component class name.  Available page names: %s.
+could-not-canonicalize-page-name=Unable to resolve page '%s' to a known page name. Available page names: %s.
 could-not-resolve-component-type=Unable to resolve component type '%s' to a component class name.  Available component types: %s.
 could-not-resolve-mixin-type=Unable to resolve mixin type '%s' to a component class name.  Available mixin types: %s.
 parameter-name-must-be-unique=Parameter names are required to be unique.  Parameter '%s' already has the value '%s'.

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/integration/IntegrationTests.java Fri Jun 15 17:36:40 2007
@@ -106,7 +106,7 @@
         open(BASE_URL);
         clickAndWait("link=ParameterDefault");
 
-        assertTextPresent("Echo component default: [org.apache.tapestry.integration.app1.pages.ParameterDefault:echo]");
+        assertTextPresent("Echo component default: [ParameterDefault:echo]");
     }
 
     @Test
@@ -174,7 +174,7 @@
 
         // And exception message:
 
-        assertTextPresent("Component org.apache.tapestry.integration.app1.pages.InjectComponentMismatch is not assignable to field org.apache.tapestry.corelib.mixins.RenderDisabled._field (of type org.apache.tapestry.Field).");
+        assertTextPresent("Component InjectComponentMismatch is not assignable to field org.apache.tapestry.corelib.mixins.RenderDisabled._field (of type org.apache.tapestry.Field).");
     }
 
     @Test
@@ -188,7 +188,7 @@
         assertTextPresent("<Proxy for Request(org.apache.tapestry.services.Request)>");
 
         // This is a test for an annonymous @Inject and ComponentResourcesInjectionProvider
-        assertTextPresent("ComponentResources[org.apache.tapestry.integration.app1.pages.InjectDemo]");
+        assertTextPresent("ComponentResources[InjectDemo]");
 
         // Another test, DefaultInjectionProvider
         assertTextPresent("<Proxy for BindingSource(org.apache.tapestry.services.BindingSource)>");
@@ -655,7 +655,9 @@
 
         clickAndWait("link=Rating");
 
-        assertText("//img[@id='rating:sort']/@src", "/assets/tapestry/corelib/components/sort-asc.png");
+        assertText(
+                "//img[@id='rating:sort']/@src",
+                "/assets/tapestry/corelib/components/sort-asc.png");
         assertText("//img[@id='rating:sort']/@alt", "[Asc]");
 
         assertTextSeries(
@@ -672,14 +674,18 @@
 
         clickAndWait("link=Rating");
 
-        assertText("//img[@id='rating:sort']/@src", "/assets/tapestry/corelib/components/sort-desc.png");
+        assertText(
+                "//img[@id='rating:sort']/@src",
+                "/assets/tapestry/corelib/components/sort-desc.png");
         assertText("//img[@id='rating:sort']/@alt", "[Desc]");
 
         assertTextSeries("//tr[1]/td[%d]", 1, "Hey Blondie", "Out from Out Where");
 
         clickAndWait("link=Title");
 
-        assertText("//img[@id='title:sort']/@src", "/assets/tapestry/corelib/components/sort-asc.png");
+        assertText(
+                "//img[@id='title:sort']/@src",
+                "/assets/tapestry/corelib/components/sort-asc.png");
         assertText("//img[@id='title:sort']/@alt", "[Asc]");
 
         clickAndWait("link=1");
@@ -935,14 +941,14 @@
         addSelection("languages:avail", "label=Ruby");
 
         click("languages:select");
-        
+
         clickAndWait("//input[@type='submit']");
-        
+
         assertTextPresent("[ERLANG, HASKELL, JAVA, LISP, ML, PERL, PYTHON, RUBY]");
-  
+
         check("reorder");
         clickAndWait("//input[@type='submit']");
-        
+
         addSelection("languages", "label=Ruby");
 
         for (int i = 0; i < 6; i++)
@@ -952,14 +958,15 @@
         addSelection("languages", "label=Perl");
 
         click("languages:down");
-        
+
         clickAndWait("//input[@type='submit']");
 
         assertTextPresent("[ERLANG, RUBY, HASKELL, JAVA, LISP, ML, PYTHON, PERL]");
     }
 
     @Test
-    public void event_handler_return_types() {
+    public void event_handler_return_types()
+    {
 
         open(BASE_URL);
         assertTextPresent("Tapestry 5 Integration Application 1");
@@ -1000,6 +1007,18 @@
                 "An unexpected application exception has occurred.",
                 "An event handler for component org.apache.tapestry.integration.app1.pages.Start returned the value 20 (from method org.apache.tapestry.integration.app1.pages.Start.onActionFromBadReturnType() (at Start.java:34)). Return type java.lang.Integer can not be handled.");
 
+    }
+
+    @Test
+    public void access_to_page_name()
+    {
+        open(BASE_URL);
+
+        assertTextPresent("Currently on page: Start");
+
+        clickAndWait("link=Grid Demo");
+
+        assertTextPresent("Currently on page: GridDemo");
     }
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentClassResolverImplTest.java Fri Jun 15 17:36:40 2007
@@ -68,6 +68,28 @@
     }
 
     @Test
+    public void canonicalize_existing_page_name()
+    {
+        ComponentInstantiatorSource source = mockComponentInstantiatorSource();
+        ClassNameLocator locator = newClassNameLocator();
+
+        train_for_app_packages(source);
+
+        String className = APP_ROOT_PACKAGE + ".pages.SimplePage";
+
+        train_locateComponentClassNames(locator, APP_ROOT_PACKAGE + ".pages", className);
+
+        replay();
+
+        ComponentClassResolver resolver = create(source, locator);
+
+        assertEquals(resolver.canonicalizePageName("simplepage"), "SimplePage");
+
+        verify();
+
+    }
+
+    @Test
     public void page_name_in_subfolder()
     {
         ComponentInstantiatorSource source = mockComponentInstantiatorSource();
@@ -420,6 +442,39 @@
     }
 
     @Test
+    public void page_name_to_canonicalize_does_not_exist()
+    {
+
+        ComponentInstantiatorSource source = mockComponentInstantiatorSource();
+        ClassNameLocator locator = newClassNameLocator();
+
+        train_for_packages(source, CORE_ROOT_PACKAGE);
+        train_for_app_packages(source);
+
+        train_locateComponentClassNames(locator, APP_ROOT_PACKAGE + ".pages", APP_ROOT_PACKAGE
+                + ".pages.Start");
+
+        replay();
+
+        ComponentClassResolver resolver = create(source, locator, new LibraryMapping(CORE_PREFIX,
+                CORE_ROOT_PACKAGE));
+
+        try
+        {
+            resolver.canonicalizePageName("MissingPage");
+            unreachable();
+        }
+        catch (IllegalArgumentException ex)
+        {
+            assertEquals(
+                    ex.getMessage(),
+                    "Unable to resolve page \'MissingPage\' to a known page name. Available page names: Start.");
+        }
+
+        verify();
+    }
+
+    @Test
     public void class_name_not_in_a_pages_package()
     {
         ComponentInstantiatorSource source = mockComponentInstantiatorSource();
@@ -629,7 +684,6 @@
         }
 
         verify();
-
     }
 
     private void train_for_app_packages(ComponentInstantiatorSource source)

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentInstanceResultProcessorTest.java Fri Jun 15 17:36:40 2007
@@ -26,7 +26,7 @@
 
 public class ComponentInstanceResultProcessorTest extends InternalBaseTestCase
 {
-    private static final String PAGE_NAME = "foo.bar.Zoop";
+    private static final String PAGE_NAME = "Zoop";
 
     private static final String METHOD_DESCRIPTION = "foo.bar.Baz.biff()";
 
@@ -48,8 +48,8 @@
         train_getComponentResources(result, resources);
         train_getContainer(resources, null);
 
-        train_getCompleteId(resources, PAGE_NAME);
-        train_getByClassName(cache, PAGE_NAME, page);
+        train_getPageName(resources, PAGE_NAME);
+        train_get(cache, PAGE_NAME, page);
 
         train_createPageLink(factory, page, link);
         train_toRedirectURI(link, LINK_URI);
@@ -70,12 +70,12 @@
     @Test
     public void warning_for_component_is_not_root_component() throws Exception
     {
-        Component child = mockComponent();
+        Component value = mockComponent();
         Component source = mockComponent();
         Component root = mockComponent();
-        Component container = mockComponent();
+        Component containerResources = mockComponent();
         ComponentResources rootResources = mockComponentResources();
-        ComponentResources childResources = mockComponentResources();
+        ComponentResources valueResources = mockComponentResources();
         ComponentResources sourceResources = mockComponentResources();
         Log log = mockLog();
         RequestPageCache cache = mockRequestPageCache();
@@ -84,23 +84,19 @@
         Response response = mockResponse();
         Link link = mockLink();
 
-        train_getComponentResources(child, childResources);
-
-        train_getContainer(childResources, container);
+        train_getComponentResources(value, valueResources);
 
+        train_getContainer(valueResources, containerResources);
         train_getComponentResources(source, sourceResources);
 
         train_getCompleteId(sourceResources, PAGE_NAME + ":source");
-        train_getCompleteId(childResources, PAGE_NAME + ":child");
-
-        train_getPage(childResources, root);
-        train_getComponentResources(root, rootResources);
-
-        train_getCompleteId(rootResources, PAGE_NAME);
-        train_getByClassName(cache, PAGE_NAME, page);
+        train_getCompleteId(valueResources, PAGE_NAME + ":child");
 
         log
-                .warn("Method foo.bar.Baz.biff() (for component foo.bar.Zoop:source) returned component foo.bar.Zoop:child, which is not a page component. The page containing the component will render the client response.");
+                .warn("Method foo.bar.Baz.biff() (for component Zoop:source) returned component Zoop:child, which is not a page component. The page containing the component will render the client response.");
+
+        train_getPageName(valueResources, PAGE_NAME);
+        train_get(cache, PAGE_NAME, page);
 
         train_createPageLink(factory, page, link);
         train_toRedirectURI(link, LINK_URI);
@@ -112,7 +108,7 @@
         ComponentEventResultProcessor<Component> processor = new ComponentInstanceResultProcessor(
                 cache, factory, log);
 
-        processor.processComponentEvent(child, source, METHOD_DESCRIPTION).sendClientResponse(
+        processor.processComponentEvent(value, source, METHOD_DESCRIPTION).sendClientResponse(
                 response);
 
         verify();

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/ComponentSourceImplTest.java Fri Jun 15 17:36:40 2007
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry.internal.services;
 
-import org.apache.tapestry.internal.bindings.DefaultComponent;
 import org.apache.tapestry.internal.structure.ComponentPageElement;
 import org.apache.tapestry.internal.structure.Page;
 import org.apache.tapestry.internal.test.InternalBaseTestCase;
@@ -24,7 +23,7 @@
 
 public class ComponentSourceImplTest extends InternalBaseTestCase
 {
-    private static final String PAGE_NAME = "foo.pages.Bar";
+    private static final String PAGE_NAME = "Bar";
 
     private static final String NESTED_ELEMENT_ID = "zip.zoom";
 
@@ -35,7 +34,7 @@
         Page page = mockPage();
         Component component = mockComponent();
 
-        train_getByClassName(cache, PAGE_NAME, page);
+        train_get(cache, PAGE_NAME, page);
 
         train_getRootComponent(page, component);
 
@@ -56,7 +55,7 @@
         ComponentPageElement element = mockComponentPageElement();
         Component component = mockComponent();
 
-        train_getByClassName(cache, PAGE_NAME, page);
+        train_get(cache, PAGE_NAME, page);
 
         train_getComponentElementByNestedId(page, NESTED_ELEMENT_ID, element);
 
@@ -92,21 +91,6 @@
 
     @Test
     public void get_page_by_class()
-    {
-        RequestPageCache cache = mockRequestPageCache();
-        Page page = mockPage();
-        Component component = new DefaultComponent();
-
-        train_getByClassName(cache, DefaultComponent.class.getName(), page);
-        train_getRootComponent(page, component);
-
-        replay();
-
-        ComponentSource source = new ComponentSourceImpl(cache);
-
-        assertSame(source.getPage(DefaultComponent.class), component);
-
-        verify();
-    }
+    {}
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java?view=diff&rev=547839&r1=547838&r2=547839
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/test/java/org/apache/tapestry/internal/services/LinkFactoryImplTest.java Fri Jun 15 17:36:40 2007
@@ -42,8 +42,6 @@
 
     private static final String PAGE_LOGICAL_NAME = "sub/MyPage";
 
-    private static final String PAGE_CLASS_NAME = "foo.pages.sub.MyPage";
-
     private TypeCoercer _typeCoercer;
 
     @BeforeClass
@@ -62,7 +60,6 @@
     public void action_link_root_context_no_ids()
     {
         testActionLink(
-                PAGE_CLASS_NAME,
                 "",
                 PAGE_LOGICAL_NAME,
                 "foo.bar",
@@ -75,7 +72,6 @@
     public void action_link_root_context_with_ids()
     {
         testActionLink(
-                PAGE_CLASS_NAME,
                 "",
                 PAGE_LOGICAL_NAME,
                 "foo.bar",
@@ -89,7 +85,6 @@
     public void action_link_with_default_action()
     {
         testActionLink(
-                PAGE_CLASS_NAME,
                 "",
                 PAGE_LOGICAL_NAME,
                 "foo.bar",
@@ -103,7 +98,6 @@
     public void page_level_event_always_includes_action()
     {
         testActionLink(
-                PAGE_CLASS_NAME,
                 "",
                 PAGE_LOGICAL_NAME,
                 "",
@@ -117,7 +111,6 @@
     public void action_link_named_context_no_ids()
     {
         testActionLink(
-                PAGE_CLASS_NAME,
                 "/fred",
                 PAGE_LOGICAL_NAME,
                 "foo.bar",
@@ -137,8 +130,7 @@
         LinkFactoryListener listener = mockLinkFactoryListener();
         ComponentInvocationMap map = mockComponentInvocationMap();
 
-        train_getName(page, PAGE_CLASS_NAME);
-        train_resolvePageClassNameToPageName(resolver, PAGE_CLASS_NAME, PAGE_LOGICAL_NAME);
+        train_getLogicalName(page, PAGE_LOGICAL_NAME);
         train_getContextPath(request, "/barney");
 
         train_getRootElement(page, rootElement);
@@ -184,8 +176,7 @@
         LinkFactoryListener listener = mockLinkFactoryListener();
         ComponentInvocationMap map = mockComponentInvocationMap();
 
-        train_getName(page, PAGE_CLASS_NAME);
-        train_resolvePageClassNameToPageName(resolver, PAGE_CLASS_NAME, PAGE_LOGICAL_NAME);
+        train_getLogicalName(page, PAGE_LOGICAL_NAME);
         train_getContextPath(request, "/barney");
 
         Holder<Link> holder = new Holder<Link>();
@@ -233,8 +224,7 @@
 
         train_get(cache, PAGE_LOGICAL_NAME, page);
 
-        train_getName(page, PAGE_CLASS_NAME);
-        train_resolvePageClassNameToPageName(resolver, PAGE_CLASS_NAME, PAGE_LOGICAL_NAME);
+        train_getLogicalName(page, PAGE_LOGICAL_NAME);
         train_getContextPath(request, "/barney");
 
         train_getRootElement(page, rootElement);
@@ -346,8 +336,8 @@
     }
 
     @SuppressWarnings("unchecked")
-    private void testActionLink(String pageClassName, String contextPath, String logicalPageName,
-            String nestedId, String eventName, String expectedURI, Object... context)
+    private void testActionLink(String contextPath, String logicalPageName, String nestedId,
+            String eventName, String expectedURI, Object... context)
     {
         Request request = mockRequest();
         Response response = mockResponse();
@@ -362,8 +352,7 @@
         final Holder<Link> holder = new Holder<Link>();
 
         train_getContainingPage(element, page);
-        train_getName(page, pageClassName);
-        train_resolvePageClassNameToPageName(resolver, pageClassName, logicalPageName);
+        train_getLogicalName(page, logicalPageName);
         train_getContextPath(request, contextPath);
         train_getNestedId(element, nestedId);
 



Mime
View raw message