You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2008/05/08 04:23:23 UTC

svn commit: r654390 [5/5] - in /tapestry/tapestry5/trunk: tapestry-core/src/main/java/org/apache/tapestry/ tapestry-core/src/main/java/org/apache/tapestry/internal/services/ tapestry-core/src/main/java/org/apache/tapestry/internal/structure/ tapestry-c...

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?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- 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 Wed May  7 19:23:21 2008
@@ -18,7 +18,7 @@
 import org.apache.tapestry.Link;
 import org.apache.tapestry.internal.services.LinkFactory;
 import org.apache.tapestry.internal.services.PersistentFieldManager;
-import static org.apache.tapestry.ioc.internal.util.CollectionFactory.newList;
+import org.apache.tapestry.ioc.internal.util.CollectionFactory;
 import static org.apache.tapestry.ioc.internal.util.Defense.notNull;
 import org.apache.tapestry.ioc.internal.util.InternalUtils;
 import org.apache.tapestry.runtime.Component;
@@ -31,19 +31,19 @@
 
 public class PageImpl implements Page
 {
-    private final String _logicalPageName;
+    private final String logicalPageName;
 
-    private final Locale _locale;
+    private final Locale locale;
 
-    private final LinkFactory _linkFactory;
+    private final LinkFactory linkFactory;
 
-    private final PersistentFieldManager _persistentFieldManager;
+    private final PersistentFieldManager persistentFieldManager;
 
-    private ComponentPageElement _rootElement;
+    private ComponentPageElement rootElement;
 
-    private final List<PageLifecycleListener> _listeners = newList();
+    private final List<PageLifecycleListener> listeners = CollectionFactory.newList();
 
-    private int _dirtyCount;
+    private int dirtyCount;
 
     /**
      * Obtained from the {@link org.apache.tapestry.internal.services.PersistentFieldManager} when first needed,
@@ -54,16 +54,16 @@
     public PageImpl(String logicalPageName, Locale locale, LinkFactory linkFactory,
                     PersistentFieldManager persistentFieldManager)
     {
-        _logicalPageName = logicalPageName;
-        _locale = locale;
-        _linkFactory = linkFactory;
-        _persistentFieldManager = persistentFieldManager;
+        this.logicalPageName = logicalPageName;
+        this.locale = locale;
+        this.linkFactory = linkFactory;
+        this.persistentFieldManager = persistentFieldManager;
     }
 
     @Override
     public String toString()
     {
-        return String.format("Page[%s %s]", _logicalPageName, _locale);
+        return String.format("Page[%s %s]", logicalPageName, locale);
     }
 
     public ComponentPageElement getComponentElementByNestedId(String nestedId)
@@ -74,7 +74,7 @@
         // forms are implemented, it may be worthwhile to cache the key to element mapping. I think
         // we're going to do it a lot!
 
-        ComponentPageElement element = _rootElement;
+        ComponentPageElement element = rootElement;
 
         if (InternalUtils.isNonBlank(nestedId))
         {
@@ -87,34 +87,34 @@
 
     public Locale getLocale()
     {
-        return _locale;
+        return locale;
     }
 
     public void setRootElement(ComponentPageElement component)
     {
-        _rootElement = component;
+        rootElement = component;
     }
 
     public ComponentPageElement getRootElement()
     {
-        return _rootElement;
+        return rootElement;
     }
 
     public Component getRootComponent()
     {
-        return _rootElement.getComponent();
+        return rootElement.getComponent();
     }
 
     public void addLifecycleListener(PageLifecycleListener listener)
     {
-        _listeners.add(listener);
+        listeners.add(listener);
     }
 
     public boolean detached()
     {
-        boolean result = _dirtyCount > 0;
+        boolean result = dirtyCount > 0;
 
-        for (PageLifecycleListener listener : _listeners)
+        for (PageLifecycleListener listener : listeners)
         {
             try
             {
@@ -134,62 +134,62 @@
 
     public void loaded()
     {
-        for (PageLifecycleListener listener : _listeners)
+        for (PageLifecycleListener listener : listeners)
             listener.containingPageDidLoad();
     }
 
     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)
+        for (PageLifecycleListener listener : listeners)
             listener.containingPageDidAttach();
     }
 
     public Logger getLogger()
     {
-        return _rootElement.getLogger();
+        return rootElement.getLogger();
     }
 
     public Link createActionLink(String nestedId, String eventType, boolean forForm, Object... context)
     {
-        return _linkFactory.createActionLink(this, nestedId, eventType, forForm, context);
+        return linkFactory.createActionLink(this, nestedId, eventType, forForm, context);
     }
 
     public Link createPageLink(String pageName, boolean override, Object... context)
     {
-        return _linkFactory.createPageLink(pageName, override, context);
+        return linkFactory.createPageLink(pageName, override, context);
     }
 
     public void persistFieldChange(ComponentResources resources, String fieldName, Object newValue)
     {
-        _persistentFieldManager.postChange(_logicalPageName, resources, fieldName, newValue);
+        persistentFieldManager.postChange(logicalPageName, resources, fieldName, newValue);
     }
 
     public Object getFieldChange(String nestedId, String fieldName)
     {
-        if (_fieldBundle == null) _fieldBundle = _persistentFieldManager.gatherChanges(_logicalPageName);
+        if (_fieldBundle == null) _fieldBundle = persistentFieldManager.gatherChanges(logicalPageName);
 
         return _fieldBundle.getValue(nestedId, fieldName);
     }
 
     public void decrementDirtyCount()
     {
-        _dirtyCount--;
+        dirtyCount--;
     }
 
     public void discardPersistentFieldChanges()
     {
-        _persistentFieldManager.discardChanges(_logicalPageName);
+        persistentFieldManager.discardChanges(logicalPageName);
     }
 
     public void incrementDirtyCount()
     {
-        _dirtyCount++;
+        dirtyCount++;
     }
 
     public String getLogicalName()
     {
-        return _logicalPageName;
+        return logicalPageName;
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesImpl.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesImpl.java Wed May  7 19:23:21 2008
@@ -25,48 +25,48 @@
 
 public class PageResourcesImpl implements PageResources
 {
-    private final Locale _locale;
+    private final Locale locale;
 
-    private final ComponentMessagesSource _componentMessagesSource;
+    private final ComponentMessagesSource componentMessagesSource;
 
-    private final TypeCoercer _typeCoercer;
+    private final TypeCoercer typeCoercer;
 
-    private final ComponentClassCache _componentClassCache;
+    private final ComponentClassCache componentClassCache;
 
-    private final ContextValueEncoder _contextValueEncoder;
+    private final ContextValueEncoder contextValueEncoder;
 
     public PageResourcesImpl(Locale locale, ComponentMessagesSource componentMessagesSource, TypeCoercer typeCoercer,
                              ComponentClassCache componentClassCache, ContextValueEncoder contextValueEncoder)
     {
-        _componentMessagesSource = componentMessagesSource;
-        _locale = locale;
-        _typeCoercer = typeCoercer;
-        _componentClassCache = componentClassCache;
-        _contextValueEncoder = contextValueEncoder;
+        this.componentMessagesSource = componentMessagesSource;
+        this.locale = locale;
+        this.typeCoercer = typeCoercer;
+        this.componentClassCache = componentClassCache;
+        this.contextValueEncoder = contextValueEncoder;
     }
 
     public Messages getMessages(ComponentModel componentModel)
     {
-        return _componentMessagesSource.getMessages(componentModel, _locale);
+        return componentMessagesSource.getMessages(componentModel, locale);
     }
 
     public <S, T> T coerce(S input, Class<T> targetType)
     {
-        return _typeCoercer.coerce(input, targetType);
+        return typeCoercer.coerce(input, targetType);
     }
 
     public Class toClass(String className)
     {
-        return _componentClassCache.forName(className);
+        return componentClassCache.forName(className);
     }
 
     public String toClient(Object value)
     {
-        return _contextValueEncoder.toClient(value);
+        return contextValueEncoder.toClient(value);
     }
 
     public <T> T toValue(Class<T> requiredType, String clientValue)
     {
-        return _contextValueEncoder.toValue(requiredType, clientValue);
+        return contextValueEncoder.toValue(requiredType, clientValue);
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesSourceImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesSourceImpl.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesSourceImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/PageResourcesSourceImpl.java Wed May  7 19:23:21 2008
@@ -26,40 +26,40 @@
 
 public class PageResourcesSourceImpl implements PageResourcesSource
 {
-    private final Map<Locale, PageResources> _cache = CollectionFactory.newConcurrentMap();
+    private final Map<Locale, PageResources> cache = CollectionFactory.newConcurrentMap();
 
-    private final ComponentMessagesSource _componentMessagesSource;
+    private final ComponentMessagesSource componentMessagesSource;
 
-    private final TypeCoercer _typeCoercer;
+    private final TypeCoercer typeCoercer;
 
-    private final ComponentClassCache _componentClassCache;
+    private final ComponentClassCache componentClassCache;
 
-    private final ContextValueEncoder _contextValueEncoder;
+    private final ContextValueEncoder contextValueEncoder;
 
     public PageResourcesSourceImpl(ComponentMessagesSource componentMessagesSource, TypeCoercer typeCoercer,
                                    ComponentClassCache componentClassCache, ContextValueEncoder contextValueEncoder)
     {
-        _componentMessagesSource = componentMessagesSource;
-        _typeCoercer = typeCoercer;
-        _componentClassCache = componentClassCache;
-        _contextValueEncoder = contextValueEncoder;
+        this.componentMessagesSource = componentMessagesSource;
+        this.typeCoercer = typeCoercer;
+        this.componentClassCache = componentClassCache;
+        this.contextValueEncoder = contextValueEncoder;
     }
 
     public PageResources get(Locale locale)
     {
         Defense.notNull(locale, "locale");
 
-        PageResources result = _cache.get(locale);
+        PageResources result = cache.get(locale);
 
         if (result == null)
         {
-            result = new PageResourcesImpl(locale, _componentMessagesSource, _typeCoercer, _componentClassCache,
-                                           _contextValueEncoder);
+            result = new PageResourcesImpl(locale, componentMessagesSource, typeCoercer, componentClassCache,
+                                           contextValueEncoder);
 
             // Small race condition here, where we may create two instances of PRI for the same locale,
             // but that's not worth worrying about.
 
-            _cache.put(locale, result);
+            cache.put(locale, result);
         }
 
         return result;

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StartElementPageElement.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StartElementPageElement.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StartElementPageElement.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/StartElementPageElement.java Wed May  7 19:23:21 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package org.apache.tapestry.internal.structure;
 
 import org.apache.tapestry.MarkupWriter;
@@ -22,25 +22,25 @@
  */
 public class StartElementPageElement implements PageElement
 {
-    private final String _namespaceURI;
+    private final String namespaceURI;
 
-    private final String _name;
+    private final String name;
 
     public StartElementPageElement(String namespaceURI, String name)
     {
-        _namespaceURI = namespaceURI;
+        this.namespaceURI = namespaceURI;
 
-        _name = name;
+        this.name = name;
     }
 
     public void render(MarkupWriter writer, RenderQueue queue)
     {
-        writer.elementNS(_namespaceURI, _name);
+        writer.elementNS(namespaceURI, name);
     }
 
     @Override
     public String toString()
     {
-        return String.format("Start[%s %s]", _namespaceURI, _name);
+        return String.format("Start[%s %s]", namespaceURI, name);
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/TextPageElement.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/TextPageElement.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/TextPageElement.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/structure/TextPageElement.java Wed May  7 19:23:21 2008
@@ -1,17 +1,17 @@
-// Copyright 2006 The Apache Software Foundation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
+// Copyright 2006 The Apache Software Foundation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
 package org.apache.tapestry.internal.structure;
 
 import org.apache.tapestry.MarkupWriter;
@@ -22,22 +22,22 @@
  */
 public class TextPageElement implements PageElement
 {
-    private final String _text;
+    private final String text;
 
     public TextPageElement(String text)
     {
-        _text = text;
+        this.text = text;
     }
 
     public void render(MarkupWriter writer, RenderQueue queue)
     {
-        writer.write(_text);
+        writer.write(text);
     }
 
     @Override
     public String toString()
     {
-        return String.format("Text[%s]", _text);
+        return String.format("Text[%s]", text);
     }
 
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/ActionLinkInvoker.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/ActionLinkInvoker.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/ActionLinkInvoker.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/internal/test/ActionLinkInvoker.java Wed May  7 19:23:21 2008
@@ -34,30 +34,30 @@
  */
 public class ActionLinkInvoker implements ComponentInvoker
 {
-    private final Registry _registry;
+    private final Registry registry;
 
-    private final ComponentInvoker _followupInvoker;
+    private final ComponentInvoker followupInvoker;
 
-    private final ComponentEventRequestHandler _componentEventRequestHandler;
+    private final ComponentEventRequestHandler componentEventRequestHandler;
 
-    private final ComponentInvocationMap _componentInvocationMap;
+    private final ComponentInvocationMap componentInvocationMap;
 
-    private final TestableResponse _response;
+    private final TestableResponse response;
 
-    private final ContextValueEncoder _contextValueEncoder;
+    private final ContextValueEncoder contextValueEncoder;
 
     public ActionLinkInvoker(Registry registry, ComponentInvoker followupInvoker,
                              ComponentInvocationMap componentInvocationMap)
     {
-        _registry = registry;
-        _followupInvoker = followupInvoker;
-        _componentEventRequestHandler = _registry.getService("ComponentEventRequestHandler",
-                                                             ComponentEventRequestHandler.class);
+        this.registry = registry;
+        this.followupInvoker = followupInvoker;
+        componentEventRequestHandler = this.registry.getService("ComponentEventRequestHandler",
+                                                                ComponentEventRequestHandler.class);
 
-        _response = _registry.getObject(TestableResponse.class, null);
+        response = this.registry.getObject(TestableResponse.class, null);
 
-        _componentInvocationMap = componentInvocationMap;
-        _contextValueEncoder = _registry.getService(ContextValueEncoder.class);
+        this.componentInvocationMap = componentInvocationMap;
+        contextValueEncoder = this.registry.getService(ContextValueEncoder.class);
 
     }
 
@@ -72,16 +72,16 @@
     {
         click(invocation);
 
-        Link link = _response.getRedirectLink();
+        Link link = response.getRedirectLink();
 
-        _response.clear();
+        response.clear();
 
         if (link == null) throw new RuntimeException("Action did not set a redirect link.");
 
 
-        ComponentInvocation followup = _componentInvocationMap.get(link);
+        ComponentInvocation followup = componentInvocationMap.get(link);
 
-        return _followupInvoker.invoke(followup);
+        return followupInvoker.invoke(followup);
     }
 
     private void click(ComponentInvocation invocation)
@@ -101,11 +101,11 @@
 
                     actionLinkTarget.getEventType(),
 
-                    new URLEventContext(_contextValueEncoder, invocation.getActivationContext()),
+                    new URLEventContext(contextValueEncoder, invocation.getActivationContext()),
 
-                    new URLEventContext(_contextValueEncoder, invocation.getContext()));
+                    new URLEventContext(contextValueEncoder, invocation.getContext()));
 
-            _componentEventRequestHandler.handle(parameters);
+            componentEventRequestHandler.handle(parameters);
         }
         catch (IOException e)
         {
@@ -113,7 +113,7 @@
         }
         finally
         {
-            _registry.cleanupThread();
+            registry.cleanupThread();
         }
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyConduitSource.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyConduitSource.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyConduitSource.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry/services/PropertyConduitSource.java Wed May  7 19:23:21 2008
@@ -15,25 +15,26 @@
 package org.apache.tapestry.services;
 
 import org.apache.tapestry.PropertyConduit;
-import org.apache.tapestry.internal.bindings.PropBindingFactory;
 
 /**
- * A source for {@link PropertyConduit}s, which can be thought of as a compiled property path expression.
- * PropertyConduits are the basis of the "prop:" binding factory, thus this service defines the expression format used
- * by the {@link PropBindingFactory}.
+ * A source for {@link org.apache.tapestry.PropertyConduit}s, which can be thought of as a compiled property path
+ * expression. PropertyConduits are the basis of the "prop:" binding factory, thus this service defines the expression
+ * format used by the {@link org.apache.tapestry.internal.bindings.PropBindingFactory}.
  * <p/>
  * The expression consist of one or more terms, seperated by periods. Each term may be either the name of a JavaBean
  * property, or the name of a method (a method that takes no parameters). Method names are distinguished from property
  * names by appending empty parens. Using a method term as the final term will make the expression read-only.
  * <p/>
  * Alternately, the seperator between property names may be "?." (i.e., "user?.name").  This allows an "if not null"
- * connection: if the term is null, then the expression evaluates to null, otherwise, the expression continues to the
- * next property.  The helps avoid NullPointerExceptions.
+ * connection: if the term is null, then the expression evaluates to null, otherwise, the expression evaluation
+ * continues to the next property.  The helps avoid NullPointerExceptions.
  */
 public interface PropertyConduitSource
 {
     /**
-     * Creates a new property conduit instance for the given expression.
+     * Returns property conduit instance for the given expression. PropertyConduitSource caches the conduits it returns,
+     * so despite the name, this method does not always create a <em>new</em> conduit. The cache is cleared if a change
+     * to component classes is observed.
      *
      * @param rootClass  the class of the root object to which the expression is applied
      * @param expression expression to be evaluated on instances of the root class

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/ObjectLocator.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/ObjectLocator.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/ObjectLocator.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/ObjectLocator.java Wed May  7 19:23:21 2008
@@ -17,23 +17,22 @@
 import org.apache.tapestry.ioc.services.MasterObjectProvider;
 
 /**
- * Defines an object which can provide access to services defined within a
- * {@link org.apache.tapestry.ioc.Registry}, or to objects or object instances available by other
- * means. Services are accessed via service id, or (when appropriate) by just service interface. The
- * Registry itself implements this interface, as does
- * {@link org.apache.tapestry.ioc.ServiceResources}.
+ * Defines an object which can provide access to services defined within a {@link org.apache.tapestry.ioc.Registry}, or
+ * to objects or object instances available by other means. Services are accessed via service id, or (when appropriate)
+ * by just service interface. The Registry itself implements this interface, as does {@link
+ * org.apache.tapestry.ioc.ServiceResources}.
  */
 public interface ObjectLocator
 {
 
     /**
-     * Obtains a service via its unique service id. Returns the service's proxy. The service proxy
-     * implements the same interface as the actual service, and is used to instantiate the actual
-     * service only as needed (this is transparent to the application).
+     * Obtains a service via its unique service id. Returns the service's proxy. The service proxy implements the same
+     * interface as the actual service, and is used to instantiate the actual service only as needed (this is
+     * transparent to the application).
      *
      * @param <T>
-     * @param serviceId        unique Service id used to locate the service object (may contain <em>symbols</em>,
-     *                         which will be expanded), case is ignored
+     * @param serviceId        unique Service id used to locate the service object (may contain <em>symbols</em>, which
+     *                         will be expanded), case is ignored
      * @param serviceInterface the interface implemented by the service (or an interface extended by the service
      *                         interface)
      * @return the service instance
@@ -42,10 +41,9 @@
     <T> T getService(String serviceId, Class<T> serviceInterface);
 
     /**
-     * Locates a service given just a service interface. A single service must implement the service
-     * interface (which can be hard to guarantee). The search takes into account inheritance of the
-     * service interface (not the service <em>implementation</em>), which may result in a failure
-     * due to extra matches.
+     * Locates a service given just a service interface. A single service must implement the service interface (which
+     * can be hard to guarantee). The search takes into account inheritance of the service interface (not the service
+     * <em>implementation</em>), which may result in a failure due to extra matches.
      *
      * @param <T>
      * @param serviceInterface the interface the service implements
@@ -56,14 +54,14 @@
     <T> T getService(Class<T> serviceInterface);
 
     /**
-     * Obtains an object indirectly, using an {@link ObjectProvider} identified by the prefix of the
-     * reference.
+     * Obtains an object indirectly, using an {@link org.apache.tapestry.ioc.ObjectProvider} identified by the prefix of
+     * the reference.
      *
      * @param objectType         the type of object to be returned
-     * @param annotationProvider provides access to annotations on the field or parameter for which a value is to
-     *                           be obtained, which may be utilized in selecting an appropriate object, use
-     *                           <strong>null</strong> when annotations are not available (in which case,
-     *                           selection will be based only on the object type)
+     * @param annotationProvider provides access to annotations on the field or parameter for which a value is to be
+     *                           obtained, which may be utilized in selecting an appropriate object, use
+     *                           <strong>null</strong> when annotations are not available (in which case, selection will
+     *                           be based only on the object type)
      * @param <T>
      * @return the requested object
      * @see ObjectProvider
@@ -71,8 +69,8 @@
     <T> T getObject(Class<T> objectType, AnnotationProvider annotationProvider);
 
     /**
-     * Autobuilds a class by finding the public constructor with the most parameters. Services and
-     * resources will be injected into the parameters of the constructor.
+     * Autobuilds a class by finding the public constructor with the most parameters. Services and resources will be
+     * injected into the parameters of the constructor.
      *
      * @param <T>
      * @param clazz the type of object to instantiate
@@ -83,11 +81,10 @@
     <T> T autobuild(Class<T> clazz);
 
     /**
-     * Creates a proxy. The proxy will defer invocation of {@link #autobuild(Class)} until
-     * just-in-time (that is, first method invocation). In a limited number of cases, it is
-     * necessary to use such a proxy to prevent service construction cycles, particularly when
-     * contributing (directly or indirectly) to the {@link MasterObjectProvider} (which is itself at
-     * the heart of autobuilding).
+     * Creates a proxy. The proxy will defer invocation of {@link #autobuild(Class)} until just-in-time (that is, first
+     * method invocation). In a limited number of cases, it is necessary to use such a proxy to prevent service
+     * construction cycles, particularly when contributing (directly or indirectly) to the {@link
+     * org.apache.tapestry.ioc.services.MasterObjectProvider} (which is itself at the heart of autobuilding).
      *
      * @param <T>
      * @param interfaceClass      the interface implemented by the proxy

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/RegistryBuilder.java Wed May  7 19:23:21 2008
@@ -81,7 +81,10 @@
         add(TapestryIOCModule.class);
     }
 
-    public void add(ModuleDef moduleDef)
+    /**
+     * Adds a {@link ModuleDef} to the registry, returning the builder for further configuration.
+     */
+    public RegistryBuilder add(ModuleDef moduleDef)
     {
         lock.check();
 
@@ -90,9 +93,16 @@
         // do as there is no concept of ModuleDef identity.
 
         modules.add(moduleDef);
+
+        return this;
     }
 
-    public void add(Class... moduleBuilderClasses)
+    /**
+     * Adds a number of modules (as module classes) to the registry, returning the builder for further configuration.
+     *
+     * @see org.apache.tapestry.ioc.annotations.SubModule
+     */
+    public RegistryBuilder add(Class... moduleBuilderClasses)
     {
         lock.check();
 
@@ -117,9 +127,17 @@
 
             queue.addAll(Arrays.asList(annotation.value()));
         }
+
+        return this;
     }
 
-    public void add(String classname)
+    /**
+     * Adds a number of module classes (specified by fully qualified class name) to the registry, returning the builder
+     * for further configuration.
+     *
+     * @see org.apache.tapestry.ioc.annotations.SubModule
+     */
+    public RegistryBuilder add(String classname)
     {
         lock.check();
 
@@ -133,8 +151,14 @@
         {
             throw new IllegalArgumentException(ex);
         }
+
+        return this;
     }
 
+    /**
+     * Constructs and returns the registry; this may only be done once. The caller is responsible for invoking {@link
+     * org.apache.tapestry.ioc.Registry#performRegistryStartup()}.
+     */
     public Registry build()
     {
         lock.lock();
@@ -146,15 +170,11 @@
 
     public ClassLoader getClassLoader()
     {
-        lock.check();
-
         return classLoader;
     }
 
     public Logger getLogger()
     {
-        lock.check();
-
         return logger;
     }
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/InternalUtils.java Wed May  7 19:23:21 2008
@@ -547,4 +547,19 @@
             // Ignore.
         }
     }
+
+    /**
+     * Extracts the message from an exception.  If the exception's message is null, returns the exceptions class name.
+     *
+     * @param exception to extract message from
+     * @return message or class name
+     */
+    public static String toMessage(Throwable exception)
+    {
+        String message = exception.getMessage();
+
+        if (message != null) return message;
+
+        return exception.getClass().getName();
+    }
 }

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/MessageFormatterImpl.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/MessageFormatterImpl.java?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/MessageFormatterImpl.java (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/main/java/org/apache/tapestry/ioc/internal/util/MessageFormatterImpl.java Wed May  7 19:23:21 2008
@@ -39,10 +39,7 @@
 
             if (Throwable.class.isInstance(arg))
             {
-                Throwable t = (Throwable) arg;
-                String message = t.getMessage();
-
-                args[i] = message != null ? message : t.getClass().getName();
+                args[i] = InternalUtils.toMessage((Throwable) arg);
             }
         }
 

Modified: tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-ioc/src/site/apt/overview.apt Wed May  7 19:23:21 2008
@@ -49,7 +49,7 @@
 
   Coding applications the traditional way is like being a homesteader on the American frontier in the 1800's.  You're responsible for
   every aspect of your house: every board, every nail, every stick of furniture is something you personally created. There <is> a great
-  comfort in total self reliance, and even if house is small, the windows are a bit drafty or the floorboards creak a little, you know exactly <why> 
+  comfort in total self reliance. Even if your house is small, the windows are a bit drafty or the floorboards creak a little, you know exactly <why> 
   things are not-quite perfect.
   
   Flash forward to modern cities or modern suburbia and it's a whole different story.  Houses are built to specification from design plans, made
@@ -161,7 +161,7 @@
 {
   . . . 
 
-  private QueueWriter queueWriter = new QueueWriter();
+  private final QueueWriter queueWriter = new QueueWriter();
 
   public void execute() 
   {
@@ -308,7 +308,7 @@
   run.
 
   The contributeMetricScheduler() method allows the module to <contribute> into the MetricProducer service's <configuration>. More testability:
-  the MetricProducer isn't tied to a pre-set list of producers, instead it will have a Collection<MetricProducer> injected into its
+  the MetricProducer isn't tied to a pre-set list of producers, instead it will have a Collection\<MetricProducer\> injected into its
   constructor.  Thus, when we're coding the MetricProducerImpl class, we can test it against mock implementations of MetricProducer.
 
   The QueueWriter service in injected into the contributeMetricScheduler() method.   Since there's only one QueueWriter service,

Modified: tapestry/tapestry5/trunk/tapestry-tutorial1/src/site/apt/forms2.apt
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-tutorial1/src/site/apt/forms2.apt?rev=654390&r1=654389&r2=654390&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-tutorial1/src/site/apt/forms2.apt (original)
+++ tapestry/tapestry5/trunk/tapestry-tutorial1/src/site/apt/forms2.apt Wed May  7 19:23:21 2008
@@ -443,7 +443,7 @@
 
   ... but Tapestry and this tutorial are a work in progress, so stay patient, and check out
   the other Tapestry tutorials and resources available on the
-  {{{../index.html}Tapestry 5 home page}.
+  {{{../index.html}Tapestry 5 home page}}.